NAME
Interchange6::Cart::Product - Cart product class for Interchange6 Shop Machine
DESCRIPTION
Cart product class for Interchange6.
See Interchange6::Role::Costs for details of cost attributes and methods.
ATTRIBUTES
Each cart product has the following attributes:
id
Can be used by subclasses, e.g. primary key value for cart products in the database.
cart
A reference to the Cart object that this Cart::Product belongs to.
name
Product name is required.
price
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
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".
discount_percent
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.
quantity
Product quantity is optional and has to be a natural number greater than zero. Default for quantity is 1.
sku
Unique product identifier is required.
subtotal
Subtotal calculated as "price" * "quantity". Lazy set via builder.
total
Total calculated as "subtotal" plus all "costs" in Interchange6::Role:Costs.
uri
Product uri
extra
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
METHODS
"extra" methods
get_extra($key, $key2, $key3...)
set_extra($key => $value, $key2 => $value2...)
delete_extra($key, $key2, $key3...)
keys_extra
clear_extra
exists_extra($key)
defined_extra($key)
"subtotal" methods
clear_subtotal
Clears "subtotal".
has_subtotal
predicate on "subtotal".