PHP Class ShoppingCart_Controller, silvershop-core

Inheritance: extends Controller
Exibir arquivo Open project: burnbright/silverstripe-shop Class Usage Examples

Protected Properties

Property Type Description
$cart

Public Methods

Method Description
add ( SS_HTTPRequest $request ) : SS_HTTPResponse Action: add item to cart
add_item_link ( Buyable $buyable, $parameters = [] )
clear ( $request ) : AjaxHTTPResponse | boolean Action: clear the cart
debug ( ) Displays order info and cart contents.
direct ( boolean | string $status = true ) : boolean This is used here and in VariationForm and AddProductForm
index ( ) Handle index requests
init ( )
remove ( SS_HTTPRequest $request ) : SS_HTTPResponse Action: remove a certain number of items from the cart
remove_all_item_link ( Buyable $buyable, $parameters = [] )
remove_item_link ( Buyable $buyable, $parameters = [] )
removeall ( SS_HTTPRequest $request ) : SS_HTTPResponse Action: remove all of an item from the cart
set_quantity_item_link ( Buyable $buyable, $parameters = [] )
setquantity ( $request ) : AjaxHTTPResponse | boolean Action: update the quantity of an item in the cart

Protected Methods

Method Description
build_url ( $action, $buyable, $params = [] ) Helper for creating a url
buyableFromRequest ( ) : Product | ProductVariation | Buyable
params_to_get_string ( $array ) Creates the appropriate string parameters for links from array
updateLocale ( $request )

Method Details

add() public method

Action: add item to cart
public add ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

build_url() protected static method

Helper for creating a url
protected static build_url ( $action, $buyable, $params = [] )

buyableFromRequest() protected method

protected buyableFromRequest ( ) : Product | ProductVariation | Buyable
return Product | ProductVariation | Buyable

clear() public method

Action: clear the cart
public clear ( $request ) : AjaxHTTPResponse | boolean
$request
return AjaxHTTPResponse | boolean

debug() public method

Displays order info and cart contents.
public debug ( )

direct() public static method

This is used here and in VariationForm and AddProductForm
public static direct ( boolean | string $status = true ) : boolean
$status boolean | string
return boolean

index() public method

Handle index requests
public index ( )

init() public method

public init ( )

params_to_get_string() protected static method

Produces string such as: MyParam%3D11%26OtherParam%3D1 ...which decodes to: MyParam=11&OtherParam=1 you will need to decode the url with javascript before using it.
protected static params_to_get_string ( $array )

remove() public method

Action: remove a certain number of items from the cart
public remove ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

removeall() public method

Action: remove all of an item from the cart
public removeall ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

setquantity() public method

Action: update the quantity of an item in the cart
public setquantity ( $request ) : AjaxHTTPResponse | boolean
$request
return AjaxHTTPResponse | boolean

updateLocale() protected method

protected updateLocale ( $request )

Property Details

$cart protected_oe property

protected $cart