took Sku a bit further

This commit is contained in:
JT Smith 2008-02-21 04:19:26 +00:00
parent 33928cba06
commit 40b432da40

View file

@ -104,6 +104,73 @@ sub definition {
}
#-------------------------------------------------------------------
=head2 applyOptions ( options )
Accepts a configuration data hash reference that configures a sku a certain way. For example to turn "a t-shirt" into "an XL red t-shirt". See also getOptions().
=head3 options
A hash reference containing the sku options.
=cut
sub applyOptions {
my ($self, $options) = @_;
$self->{_skuOptions} = $options;
}
#-------------------------------------------------------------------
=head2 getOptions ( )
Returns a hash reference of configuration data that can return this sku to a configured state. See applyOptions() for details.
=cut
sub getOptions {
my $self = shift;
return $self->{_skuOptions};
}
#-------------------------------------------------------------------
=head2 getMaxAllowedInCart ( )
Returns 99999999. Should be overriden by subclasses that have a specific value. Subclasses that are unique should return 1. Subclasses that have an inventory count should return the amount in inventory.
=cut
sub getMaxAllowedInCart {
return 99999999;
}
#-------------------------------------------------------------------
=head2 getPrice ( )
Returns 0.00. Needs to be overriden by subclasses.
=cut
sub getPrice {
return 0.00;
}
#-------------------------------------------------------------------
=head2 getTaxRate ( )
Returns undef unless the "Override tax rate?" switch is set to yes. If it is, then it returns the value of the "Tax Rate Override" field.
=cut
sub getTaxRate {
my $self = shift;
return ($self->get("overrideTaxRate")) ? $self->get("taxRateOverride") : undef;
}
#-------------------------------------------------------------------
=head2 indexContent ( )
@ -119,6 +186,60 @@ sub indexContent {
}
#-------------------------------------------------------------------
=head2 isShippingRequired
Returns a boolean indicating whether shipping is required. Defaultly returns 0. Needs to be overriden by subclasses that use shipping.
=cut
sub isShippingRequired {
return 0;
}
#-------------------------------------------------------------------
=head2 newBySku ( session, sku )
Returns a sku subclass based upon a sku lookup.
=head3 session
A reference to the current session.
=head3 sku
The sku attached to the object you wish to instanciate.
=cut
sub newBySku {
my ($class, $session, $sku) = @_;
my $assetId = $session->db->quickScalar("select assetId from Sku where sku=?", [$sku]);
return WebGUI::Asset->newByDynamicClass($session, $assetId);
}
#-------------------------------------------------------------------
=head2 processStyle ( output )
Returns output parsed under the current style.
=head3 output
An HTML blob to be parsed into the current style.
=cut
sub processStyle {
my $self = shift;
my $output = shift;
return $self->getParent->processStyle($output);
}
#-------------------------------------------------------------------
=head2 www_edit ( )