added commerce ui glue
This commit is contained in:
parent
4a73cadf64
commit
152e96f695
2 changed files with 166 additions and 0 deletions
|
|
@ -30,10 +30,25 @@ migrateToNewCart($session);
|
|||
createSkuAsset($session);
|
||||
createDonationAsset($session);
|
||||
addShippingDrivers($session);
|
||||
addShoppingHandler($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
sub addShoppingHandler {
|
||||
my $session = shift;
|
||||
print "\tInstalling shopping handler.\n" unless ($quiet);
|
||||
my @changed = ();
|
||||
foreach my $handler (@{$session->config->get("contentHandlers")}) {
|
||||
if ($handler eq "WebGUI::Content::Asset") {
|
||||
push(@changed, "WebGUI::Content::Shop");
|
||||
}
|
||||
push(@changed, $handler);
|
||||
}
|
||||
$session->config->set("contentHandlers", \@changed);
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub createDonationAsset {
|
||||
my $session = shift;
|
||||
|
|
|
|||
151
lib/WebGUI/Content/Shop.pm
Normal file
151
lib/WebGUI/Content/Shop.pm
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
package WebGUI::Content::Shop;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Shop::Cart;
|
||||
#use WebGUI::Shop::Pay;
|
||||
use WebGUI::Shop::Ship;
|
||||
use WebGUI::Shop::Tax;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Content::Shop
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
A content handler that opens up all the commerce functionality.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use WebGUI::Content::Shop;
|
||||
my $output = WebGUI::Content::Shop::handler($session);
|
||||
|
||||
=head1 SUBROUTINES
|
||||
|
||||
These subroutines are available from this package:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 handler ( session )
|
||||
|
||||
The content handler for this package.
|
||||
|
||||
=cut
|
||||
|
||||
sub handler {
|
||||
my ($session) = @_;
|
||||
my $output = undef;
|
||||
my $function = "www_".$session->form->get("shop");
|
||||
if ($function ne "www_" && __PACKAGE__->can($function)) {
|
||||
$output = &$function($session);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_cart ()
|
||||
|
||||
Hand off to the cart.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_cart {
|
||||
my $session = shift;
|
||||
my $output = undef;
|
||||
my $method = "www_".$session->form->get("method");
|
||||
my $cart = WebGUI::Shop::Cart->create($session);
|
||||
if ($method ne "www_" && $cart->can($method)) {
|
||||
$output = $cart->$method();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_manageSettings ()
|
||||
|
||||
Display the commerce settings page.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_manageSettings {
|
||||
my $session = shift;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_pay ()
|
||||
|
||||
Hand off to the payment gateway.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_pay {
|
||||
my $session = shift;
|
||||
my $output = undef;
|
||||
my $method = "www_".$session->form->get("method");
|
||||
my $pay = WebGUI::Shop::Pay->create($session);
|
||||
if ($method ne "www_" && $pay->can($method)) {
|
||||
$output = $pay->$method();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_ship ()
|
||||
|
||||
Hand off to the shipper.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_ship {
|
||||
my $session = shift;
|
||||
my $output = undef;
|
||||
my $method = "www_".$session->form->get("method");
|
||||
my $ship = WebGUI::Shop::Ship->create($session);
|
||||
if ($method ne "www_" && $ship->can($method)) {
|
||||
$output = $ship->$method();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_tax ()
|
||||
|
||||
Hand off to the tax system.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_tax {
|
||||
my $session = shift;
|
||||
my $output = undef;
|
||||
my $method = "www_".$session->form->get("method");
|
||||
my $tax = WebGUI::Shop::Tax->create($session);
|
||||
if ($method ne "www_" && $tax->can($method)) {
|
||||
$output = $tax->$method();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue