From 576439fda03d4e81cb5b0cfed371f7776a73fe3a Mon Sep 17 00:00:00 2001 From: Ahmad Anbar Date: Thu, 13 Feb 2014 06:16:31 +0200 Subject: Added changelog entry. An example to the docs. Tidy code a little bit. --- user_guide_src/source/libraries/cart.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'user_guide_src/source/libraries/cart.rst') diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst index 015f1c90e..6d0dd2e3a 100644 --- a/user_guide_src/source/libraries/cart.rst +++ b/user_guide_src/source/libraries/cart.rst @@ -88,6 +88,18 @@ array will be stored in the session. However, it is best to standardize your data among all your products in order to make displaying the information in a table easier. +:: + + $data = array( + 'id' => 'sku_123ABC', + 'qty' => 1, + 'price' => 39.95, + 'name' => 'T-Shirt', + 'coupon' => 'XMAS-50OFF' + ); + + $this->cart->insert($data); + The insert() method will return the $rowid if you successfully insert a single item. @@ -195,8 +207,8 @@ Updating The Cart To update the information in your cart, you must pass an array containing the Row ID and quantity to the $this->cart->update() function, you may also update any property you have previously -defined when inserting the item such like (options, price -or other custom fields you defined). +defined when inserting the item such as options, price +or other custom fields you defined. .. note:: If the quantity is set to zero, the item will be removed from the cart. @@ -205,6 +217,7 @@ or other custom fields you defined). $data = array( 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', + 'price' => 10, 'qty' => 3 ); -- cgit v1.2.3-24-g4f1b