The Shop Class
Cart and Order helper class
Functions
Shop::deleteItemtypeFromCart
Definition
- Name
- Shop::deleteItemtypeFromCart
- Syntax
- Array|False = Shop::deleteItemtypeFromCart( String $itemtype, );
Description
Delete items specified by itemtype from cart.
Parameters
- $itemtype
-
String The specified itemtype to be deleted from cart
Return values
Array Returns the updated cart. Returns existing car if there is no item matching the specified itemtype.
False if function fails (no cart is found).
Examples
Example 1
$cart = Array (
[id] => 7,
[user_id] => 2,
[cart_reference] => "m9hi0spkcvfk",
[country] => DK,
[currency] => DKK,
[delivery_address_id] =>
[billing_address_id] =>
[created_at] => 2019-03-28 16:58:39
[modified_at] => 2019-03-29 10:12:54
[items] => Array (
[0] => Array (
[id] => 262
[cart_id] => 7
[item_id] => 158
[quantity] => 1
)
[1] => Array (
[id] => 263
[cart_id] => 7
[item_id] => 157
[quantity] => 1
)
)
[total_items] => 2
)
$itemtype = "membership";
$cart = $SC->deleteItemtypeFromCart($itemtype);
Deletes item specified by itemtype. Returns updated cart.
$cart = Array (
[id] => 7,
[user_id] => 2,
[cart_reference] => "m9hi0spkcvfk",
[country] => DK,
[currency] => DKK,
[delivery_address_id] =>
[billing_address_id] =>
[created_at] => 2019-03-28 16:58:39
[modified_at] => 2019-03-29 10:12:54
[items] => Array (
[0] => Array (
[id] => 262
[cart_id] => 7
[item_id] => 158
[quantity] => 1
)
)
[total_items] => 1
)
Dependencies
Janitor
- Item::getItem()
- Shop::getCart()
- Shop:deleteFromCart()