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

METHODS

clear_subtotal

Clears "subtotal".

clear_total

Clears "total".

has_subtotal

predicate on "subtotal".

has_total

predicate on "total".