Sunnysideup\Ecommerce\Control\ShoppingCartController
ShoppingCartController.
Handles the modification of a shopping cart via http requests.
Provides links for making these modifications.
- Author: : Jeremy Shipman, Nicolaas Francken
Synopsis
class ShoppingCartController
extends Controller
{
- // members
- protected array $methodsRequiringSecurityID = ;
- protected ShoppingCart $cart;
- private static string $url_segment = 'shoppingcart';
- private static array $url_handlers = ;
- private static array $allowed_actions = ;
- // methods
- public void index()
- public string Link()
- public static string add_item_link()
- public static string remove_item_link()
- public static string remove_all_item_link()
- public static string remove_all_item_and_edit_link()
- public static string set_quantity_item_link()
- public static string remove_modifier_link()
- public static string add_modifier_link()
- public static string remove_address_link()
- public static string clear_cart_link()
- public static string save_cart_link()
- public static string clear_cart_and_logout_link()
- public static string delete_order_link()
- public static void copy_order_link()
- public static void set_currency_link()
- public static string remove_from_sale_link()
- public string json()
- public mixed additem()
- public mixed setquantityitem()
- public mixed removeitem()
- public mixed removeallitem()
- public mixed removeallitemandedit()
- public mixed removemodifier()
- public mixed addmodifier()
- public mixed setcountry()
- public mixed setregion()
- public mixed setcurrency()
- public mixed removefromsale()
- public mixed save()
- public HTTPResponse|string clear()
- public HTTPResponse|string clearandlogout()
- public HTTPResponse|string deleteorder()
- public void copyorder()
- public void numberofitemsincart()
- public DBHTMLText showcart()
- public HTTPResponse|string loadorder()
- public HTTPResponse|string removeaddress()
- public HTTPResponse|string submittedbuyable()
- public HTTPResponse|string placeorderformember()
- public HTTPResponse|string loginas()
- public void debug()
- public mixed ajaxtest()
- protected void init()
- protected static string create_link()
- protected static string params_to_get_string()
- protected null|OrderItem buyable()
- protected float quantity()
- protected array parameters()
- protected void goToErrorPage()
Hierarchy
Extends
- SilverStripe\Control\Controller
Tasks
Line | Task |
---|---|
42+ | supply links for adding, removing, and clearing cart items |
42+ | link for removing modifier(s) |
612+ | : add non-ajax version of this request. |
833+ | : check that comment description actually matches what it does |
Members
private
- $allowed_actions
-
$url_handlers
Default URL handlers - (Action)/(ID)/(OtherID). - $url_segment — string
protected
- $cart — Sunnysideup\Ecommerce\Api\ShoppingCart
- $methodsRequiringSecurityID
—
array
We need to only use the Security ID on a few actions, these are listed here.
Methods
protected
- buyable() — Gets a buyable object based on URL actions.
- create_link() — returns ABSOLUTE link to the shopping cart controller.
- goToErrorPage()
- init()
- parameters() — Gets the request parameters.
- params_to_get_string() — Helper function used by link functions Creates the appropriate url-encoded string parameters for links from array.
- quantity() — Gets the requested quantity.
public
- Link()
- add_item_link()
- add_modifier_link()
- additem() — Adds item to cart via controller action; one by default.
- addmodifier() — Adds a specified modifier to the cart;.
- ajaxtest() — test the ajax response for developers only.
- clear()
- clear_cart_and_logout_link()
- clear_cart_link()
- clearandlogout()
- copy_order_link()
- copyorder()
- debug() — Handy debugging action visit.
- delete_order_link()
- deleteorder()
- index()
- json() — return json for cart... no further actions.
- loadorder() — loads an order.
- loginas() — This can be used by admins to log in as customers to place orders on their behalf...
- numberofitemsincart() — return number of items in cart.
- placeorderformember() — This can be used by admins to log in as customers to place orders on their behalf...
- remove_address_link()
- remove_all_item_and_edit_link()
- remove_all_item_link()
- remove_from_sale_link()
- remove_item_link()
- remove_modifier_link()
- removeaddress() — remove address from list of available addresses in checkout.
- removeallitem() — Removes all of a specific item.
- removeallitemandedit() — Removes all of a specific item AND return back.
- removefromsale()
- removeitem() — Removes item from cart via controller action; one by default.
- removemodifier() — Removes a specified modifier from the cart;.
- save()
- save_cart_link()
- set_currency_link() — returns a link that allows you to set a currency...
- set_quantity_item_link()
- setcountry() — sets the country.
- setcurrency()
- setquantityitem() — Sets the exact passed quantity.
- setregion()
- showcart() — return cart for ajax call.
- submittedbuyable() — allows us to view out-dated buyables that have been deleted where only old versions exist.