shop:on_deleteCartItem AJAX handler
Defined in |
/modules/shop/classes/shop_actions.php, lines 672-687 |
Author |
LemonStand eCommerce Inc. |
Removes an item from the cart.
Usually this AJAX handler used on the Cart page together with shop:cart action.
You can use this handler for creating the Remove Item links for individual cart items. The following example creates the Remove Item
link which sends the shop:on_deleteCartItem AJAX request to LemonStand and updates the cart page content on success.
<a onclick="return $(this).getForm().sendRequest(
'shop:on_deleteCartItem',
{update: {'cart_page': 'cart_partial'},
confirm: 'Do you really want to remove this item from the cart?',
extraFields: {key: '<?= $item->key ?>'}})"
href="#">Remove Item</a>
Field |
Type |
Description |
key |
string |
specifies a key of a shopping cart item to remove, required. |
cart_name |
string |
specifies the shopping cart name, the default value is main. |
Supported form field details
¶
key form field
¶
cart_name form field
Specifies the shopping cart name, the default value is main.
Generated PHP variable details
¶
countries variable
A collection of countries for populating the country list for the Estimate Shipping Cost feature.
Each element in the collection is an object of the Shop_Country class.
¶
states variable
A list of states for a currently selected country.
Each element in the collection is an object of the Shop_CountryState class.
¶
shipping_info variable
A customer's shipping location.
For new customers all fields in the object are empty.
¶
discount variable
float $discount;
A discount value, calculated using the price rules, defined on the Shop/Discounts page in the Administration Area.
The discount value can be not accurate on the Cart page, because price rules can refer to customer details like the shipping
location which are not known on the Cart page and will become available only during the checkout process.
¶
applied_discount_rules variable
array $applied_discount_rules;
A list of discount rules applied to the cart products.
Each element in the array is an object with two fields: rule (Shop_CartPriceRule object) and discount.
You can use this variable for displaying a list of applied discounts. Example:
<h3>Applied discounts</h3>
<? foreach ($applied_discount_rules as $rule_info): ?>
<p>
<?= $rule_info->rule->name ?>
<?= $rule_info->rule->description ?> -
<?= format_currency($rule_info->discount) ?><br/>
</p>
<? endforeach ?>
¶
cart_total variable
float $cart_total;
A sum of all cart items.
¶
subtotal variable
float $subtotal;
A sum of all cart items. Matches the $cart_total variable value.
¶
cart_total_tax_incl variable
float $cart_total_tax_incl;
¶
cart_tax variable
float $cart_tax;
A total tax amount for all cart items.
¶
cart_taxes variable
array $cart_taxes;
A list of all taxes applied to the cart items.
Each element in the array is an object with two fields: name, total.
¶
coupon_code variable
string $coupon_code;
A coupon code provided by the customer.
|