More EMS stuff.
This commit is contained in:
parent
0c64c4f386
commit
2e645f0517
3 changed files with 107 additions and 10 deletions
|
|
@ -155,20 +155,21 @@ The type (namespace) of the item you want.
|
|||
=cut
|
||||
|
||||
sub new {
|
||||
my ($class, $namespace, $load, $cmd, $plugin);
|
||||
my ($class, $session, $namespace, $load, $cmd, $plugin);
|
||||
$class = shift;
|
||||
$session = shift;
|
||||
$id = shift;
|
||||
$namespace = shift;
|
||||
|
||||
$self->session->errorHandler->fatal('No namespace') unless ($namespace);
|
||||
$self->session->errorHandler->fatal('No ID') unless ($id);
|
||||
$session->errorHandler->fatal('No namespace') unless ($namespace);
|
||||
$session->errorHandler->fatal('No ID') unless ($id);
|
||||
|
||||
$cmd = "WebGUI::Commerce::Item::$namespace";
|
||||
$load = "use $cmd";
|
||||
eval($load);
|
||||
$self->session->errorHandler->warn("Item plugin failed to compile: $cmd.".$@) if($@);
|
||||
$plugin = eval($cmd."->new('$id', '$namespace')");
|
||||
$self->session->errorHandler->warn("Couldn't instantiate Item plugin: $cmd.".$@) if($@);
|
||||
$session->errorHandler->warn("Item plugin failed to compile: $cmd.".$@) if($@);
|
||||
$plugin = eval($cmd."->new('$session', '$id', '$namespace')");
|
||||
$session->errorHandler->warn("Couldn't instantiate Item plugin: $cmd.".$@) if($@);
|
||||
return $plugin;
|
||||
}
|
||||
|
||||
|
|
|
|||
67
lib/WebGUI/Commerce/Item/Event.pm
Normal file
67
lib/WebGUI/Commerce/Item/Event.pm
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
package WebGUI::Commerce::Item::Event;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(WebGUI::Commerce::Item);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub available {
|
||||
return $_[0]->{_event}->{available};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub description {
|
||||
return $_[0]->{_event}{description};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub id {
|
||||
return $_[0]->{_event}{productId};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub isRecurring {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub name {
|
||||
return $_[0]->{_event}->{title};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub new {
|
||||
my ($class, $session, $eventId, $eventData);
|
||||
$class = shift;
|
||||
$session = shift;
|
||||
$eventId = shift;
|
||||
|
||||
my $eventData = $session->db->quickHashRef("select p.productId, p.title, p.description, p.price, e.available
|
||||
from EventManagementSystem_products as e, products as p
|
||||
where p.productId = e.productId and p.productId=".$session->db->quote($eventId));
|
||||
|
||||
bless {_event => $eventData}, $class;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub needsShipping {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub price {
|
||||
return $_[0]->{_event}->{price};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub type {
|
||||
return 'Event';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub weight {
|
||||
return 0;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue