\ShoppingCart
Holder for items in the shopping cart and interacting with them, as well as rendering these items into an interface that allows editing of items,
- Author: morven
Synopsis
class ShoppingCart
extends Commerce_Controller
{
- // members
- private static string $url_segment = 'commerce/cart';
- private static string $class_name = "ShoppingCart";
- private static array $allowed_actions = ;
- protected static boolean $enabled = true;
- private static $title;
- protected ArrayList $items;
- protected ArrayList $discount;
- private static boolean $show_discount_form = false;
- // Inherited members from Commerce_Controller
- protected $dataRecord;
- // methods
- public void getClassName()
- public void getTitle()
- public void getMetaTitle()
- public void getShowDiscountForm()
- public void getItems()
- public void getDiscount()
- public void setDiscount()
- public ShoppingCart setAvailablePostage()
- public static Boolean isEnabled()
- public static ShoppingCart get()
- public void __construct()
- public void index()
- public Redirect remove()
- public void emptycart()
- public void usediscount()
- public void add()
- public void update()
- public void removeAll()
- public void save()
- public void clear()
- public Float TotalWeight()
- public Int TotalItems()
- public Float SubTotalCost()
- public void PostageCost()
- public Float DiscountAmount()
- public Float TaxCost()
- public Float TotalCost()
- public Form CartForm()
- public Form DiscountForm()
- public Form PostageForm()
- public void doUpdate()
- public void doAddDiscount()
- public void doGetPostage()
- public void doSavePostage()
- // Inherited methods from Commerce_Controller
- public void data()
- public void getDataRecord()
- public void setDataRecord()
- public void Link()
- public void init()
- public void getPostageAreas()
- public void results()
Hierarchy
Extends
Members
private
- $allowed_actions
- $class_name
—
string
Name of the current controller. Mostly used in templates. - $show_discount_form
—
boolean
Show the discount form on the shopping cart - $title
—
string
Overwrite the default title for this controller which is taken from the translation files. This is used for Title and MetaTitle variables in templates. - $url_segment
—
string
URL Used to access this controller
protected
Methods
public
- __construct()
- CartForm() — Form responsible for listing items in the shopping cart and allowing management (such as addition, removal, etc)
- DiscountAmount() — Find the total discount based on discount items added.
- DiscountForm() — Form that allows you to add a discount code which then gets added to the cart's list of discounts.
- PostageCost() — Get the cost of postage
- PostageForm() — Form responsible for estimating shipping based on location and postal code
- SubTotalCost() — Find the cost of all items in the cart, without any tax.
- TaxCost() — Find the total cost of tax for the items in the cart, as well as shipping (if set)
- TotalCost() — Find the total cost of for all items in the cart, including tax and shipping (if applicable)
- TotalItems() — Find the total quantity of items in the shopping cart
- TotalWeight() — Find the total weight of all items in the shopping cart
- add() — Add a product to the shopping cart via its ID number.
- clear() — Clear the shopping cart object and destroy the session. Different to empty, as that retains the session.
- doAddDiscount() — Action that will find a discount based on the code
- doGetPostage() — Search and find applicable postage rates based on submitted data
- doSavePostage() — Save applicable postage data to session
- doUpdate() — Action that will update cart
- emptycart() — Action that will clear shopping cart and associated sessions
- get() — Shortcut for ShoppingCart::create, exists because create() doesn't seem quite right.
- getClassName() — Getters and setters
- getDiscount()
- getItems()
- getMetaTitle()
- getShowDiscountForm()
- getTitle()
- index() — Default acton for the shopping cart
- isEnabled() — find out if the shopping cart is enabled
- remove() — Remove a product from ShoppingCart Via its ID. This action expects an ID to be sent through the URL that matches a specific key added to an item in the cart
- removeAll() — Empty the shopping cart object of all items.
- save() — Save the current products list and postage to a session.
- setAvailablePostage() — Set postage that is available to the shopping cart based on the country and zip code submitted
- setDiscount()
- update() — Find an existing item and update its quantity
- usediscount() — Action used to add a discount to the users session via a URL.
Inherited from Commerce_Controller
public
- Link()
- data() — Returns the associated database record
- getDataRecord()
- getPostageAreas() — Function to find relevent postage rates, based on supplied country and zip/postal code data.
- init() — Init actions that happen globally to all commerce interfaces.
- results() — Process and render search results. This has been hacked a bit to load products into the list (if they exists). Will need to come up with a more elegant solution to dealing with complex searches of objects though.
- setDataRecord()