LemonStand Documentation

Shop_Cart

The Shop_Cart class represents a visitor's shopping cart. The class has static methods for accessing the cart content and evaluating the total price, volume and weight of the cart items. Please read the Creating the Cart page article for examples of the class usage.

All methods of this class accept the $cart_name parameter, which default value is "main". You can implement multiple shopping carts in LemonStand. You can post the cart_name parameter to the shop:on_addToCart handler in order to place an item into a specific cart. By default LemonStand always work with the shopping cart "main".

Class methods

  • static list_active_items($cart_name = "main") – returns a list of active (not postponed) cart items. The method returns an array. Each element of the array is an object of the Shop_CartItem class.
  • static list_postponed_items($cart_name = "main") - returns a list of postponed cart items. The method returns an array. Each element of the array is an object of the Shop_CartItem class.
  • static total_price($cart_name = "main", $apply_discounts = true) - returns a sum of prices of all active items in the shopping cart. Pass the FALSE value to the second parameter in order to get the cart total before discounts applied.
  • static total_volume($cart_name = "main") - returns a total volume of all active items in the shopping cart
  • static get_item_total_num($cart_name = "main", $cound_bundle_items = true) - returns a total number of all active items in the shopping cart
  • static total_weight($cart_name = "main") - returns a total weight of all items in the shopping cart
  • static get_content_id($cart_name = "main") - returns the shopping cart content identifier. The content identifier changes each time when a customer changes the shopping cart content.

See also:

Next: Shop_CartItem
Previous: Shop_BundleHelper
Return to Reference

Comments

No comments posted so far.

Add your comment

Loading form...