Welcome Guest, Not a member yet? Register   Sign In
A question about CI cart
#2

[eluser]theprodigy[/eluser]
Quote:when a add a product in my cart,i want to get the row id as a return value.
This would be rather difficult to do considering CI's Cart class allows you to insert multiple items with a single call.
Quote:By using a multi-dimensional array, as shown below, it is possible to add multiple products to the cart in one action. This is useful in cases where you wish to allow people to select from among several items on the same page.
Code:
$data = array(
               array(
                       'id'      => 'sku_123ABC',
                       'qty'     => 1,
                       'price'   => 39.95,
                       'name'    => 'T-Shirt',
                       'options' => array('Size' => 'L', 'Color' => 'Red')
                    ),
               array(
                       'id'      => 'sku_567ZYX',
                       'qty'     => 1,
                       'price'   => 9.95,
                       'name'    => 'Coffee Mug'
                    ),
               array(
                       'id'      => 'sku_965QRS',
                       'qty'     => 1,
                       'price'   => 29.95,
                       'name'    => 'Shot Glass'
                    )
            );

$this->cart->insert($data);
If you insert 3 items into the cart, which row id would you expect to get?


Messages In This Thread
A question about CI cart - by El Forum - 09-28-2010, 08:35 AM
A question about CI cart - by El Forum - 09-28-2010, 08:56 AM
A question about CI cart - by El Forum - 09-28-2010, 09:04 AM
A question about CI cart - by El Forum - 09-28-2010, 11:15 AM
A question about CI cart - by El Forum - 09-29-2010, 01:40 AM
A question about CI cart - by El Forum - 09-29-2010, 02:18 AM
A question about CI cart - by El Forum - 09-29-2010, 09:04 AM
A question about CI cart - by El Forum - 09-29-2010, 10:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB