Interchange6::Cart::Product - Cart product class for Interchange6 Shop Machine
Cart product class for Interchange6.
See Interchange6::Role::Costs for details of cost attributes and methods.
See also "ATTRIBUTES" in Interchange6::Role::Costs.
Each cart product has the following attributes:
Can be used by subclasses, e.g. primary key value for cart products in the database.
A reference to the Cart object that this Cart::Product belongs to.
Product name is required.
Product price is required and a positive number or zero.
Price is required, because you want to maintain the price that was valid at the time of adding to the cart. Should the price in the shop change in the meantime, it will maintain this price.
Selling price is the price after group pricing, tier pricing or promotional discounts have been applied. If it is not set then it defaults to "price".
This is the integer discount percentage calculated from the difference between "price" and "selling_price". This attribute should not normally be set since as it is a calculated value.
"discount_percent" is cleared if either "set_price" or set_selling_price methods are called.
Product quantity is optional and has to be a natural number greater than zero. Default for quantity is 1.
Unique product identifier is required.
If this product is a variant of a "parent" product then canonical_sku is the sku of the parent product.
Subtotal calculated as "price" * "quantity". Lazy set via builder.
Weight of quantity 1 of this product.
Hash reference of extra things the cart product might want to store such as:
variant attributes in order to be able to change variant within cart
simple attributes to allow display of them within cart
Indicate whether products with the same SKU should be combined in the Cart
See also "METHODS" in Interchange6::Role::Costs.
get_extra($key, $key2, $key3...)
See "get" in Data::Perl::Role::Collection::Hash
set_extra($key => $value, $key2 => $value2...)
See "set" in Data::Perl::Role::Collection::Hash
delete_extra($key, $key2, $key3...)
See "keys" in Data::Perl::Role::Collection::Hash
See "clear" in Data::Perl::Role::Collection::Hash
See "exists" in Data::Perl::Role::Collection::Hash
See "defined" in Data::Perl::Role::Collection::Hash
predicate on "subtotal".
Returns 1 if "canonical_sku" is defined else 0.
Returns 0 if "canonical_sku" is defined else 1.
Determines whether a product should be combined by sku based on the value of "combine".
If "combine" isa CodeRef the result of applying that CodeRef is returned otherwise: Returns 0 if a product should not be combined Returns 1 if a product should be combined
To install Interchange6, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.