SilverShop\Cart\ShoppingCartController
Manipulate the cart via urls.
Synopsis
class ShoppingCartController
extends Controller
{
- // members
- private static string $url_segment = 'shoppingcart';
- private static bool $direct_to_cart_page = false;
- protected ShoppingCart $cart;
- private static array $url_handlers = ;
- private static array $allowed_actions = ;
- // methods
- public static void add_item_link()
- public static void remove_item_link()
- public static void remove_all_item_link()
- public static void set_quantity_item_link()
- protected static void build_url()
- public static string|HTTPResponse direct()
- public void init()
- protected Product|Variation|Buyable buyableFromRequest()
- public HTTPResponse add()
- public HTTPResponse remove()
- public HTTPResponse removeall()
- public HTTPResponse setquantity()
- public HTTPResponse clear()
- public void index()
- public void debug()
- protected void updateLocale()
Hierarchy
Extends
- SilverStripe\Control\Controller
Members
private
- $allowed_actions — array
- $direct_to_cart_page
—
SilverShop\Cart\bool
Whether or not this controller redirects to the cart-page whenever an item was added - $url_handlers — array
- $url_segment
protected
- $cart — SilverShop\Cart\ShoppingCart
Methods
protected
- build_url() — Helper for creating a url
- buyableFromRequest()
- updateLocale()
public
- add() — Action: add item to cart
- add_item_link()
- clear() — Action: clear the cart
- debug() — Displays order info and cart contents.
- direct() — This is used here and in VariationForm and AddProductForm
- index() — Handle index requests
- init()
- remove() — Action: remove a certain number of items from the cart
- remove_all_item_link()
- remove_item_link()
- removeall() — Action: remove all of an item from the cart
- set_quantity_item_link()
- setquantity() — Action: update the quantity of an item in the cart