SilverCommerce\ShoppingCart\Control\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: ilateral (http://www.ilateral.co.uk)
Synopsis
class ShoppingCart
extends Controller
{
- // members
- private static string $url_segment = 'shoppingcart';
- protected array $templates = ;
- private static $title;
- private static string $checkout_class = Checkout::class;
- private static boolean $redirect_on_add = false;
- protected ShoppingCartModel $dataRecord;
- private static array $allowed_actions = ;
- // methods
- protected void init()
- public void getTitle()
- public void getMetaTitle()
- public void getDataRecord()
- public void setDataRecord()
- public string Link()
- public string AbsoluteLink()
- public string RelativeLink()
- public ArrayList getMenu()
- public void Menu()
- public void index()
- public Redirect remove()
- public void emptycart()
- public void usediscount()
- public Redirect checkout()
- public void removediscount()
- public boolean ShowTax()
- public Form CartForm()
- public Form DiscountForm()
- public Form PostageForm()
- public void doUpdate()
Hierarchy
Extends
- SilverStripe\Control\Controller
Members
private
- $allowed_actions
—
array
These methods are mapped to sub URLs of this controller. - $checkout_class
—
string
Class Name of object we use as an assotiated estimate. - $redirect_on_add
—
boolean
Redirect the user to the cart when an item is added? - $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
- $dataRecord
—
SilverCommerce\ShoppingCart\Control\ShoppingCartModel
The associated dataRecord - $templates
—
array
Setup default templates for this controller
Methods
protected
- init() — Overwrite default init to support subsites (if installed)
public
- AbsoluteLink() — Get an absolute link to this controller
- CartForm() — Form responsible for listing items in the shopping cart and allowing management (such as addition, removal, etc)
- DiscountForm() — Form that allows you to add a discount code which then gets added to the cart's list of discounts.
- Link() — Get the link to this controller
- Menu()
- PostageForm() — Form responsible for estimating shipping based on location and postal code
- RelativeLink() — Get a relative (to the root url of the site) link to this controller
- ShowTax() — Should the purchase total show a breakdown of tax and subtotal?
- checkout() — Setup the checkout and redirect to it
- doUpdate() — Action that will update cart
- emptycart() — Action that will clear shopping cart and associated items
- getDataRecord()
- getMenu() — If content controller exists, return it's menu function
- getMetaTitle()
- getTitle()
- index() — Default acton for the shopping cart
- 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
- removediscount()
- setDataRecord()
- usediscount() — Action used to add a discount to the users session via a URL.