mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 23:51:25 +00:00
Updated readme
This commit is contained in:
22
README.md
22
README.md
@@ -29,6 +29,7 @@ The shoppingcart gives you the following methods to use:
|
|||||||
|
|
||||||
**Cart::add()**
|
**Cart::add()**
|
||||||
|
|
||||||
|
```php
|
||||||
/**
|
/**
|
||||||
* Add a row to the cart
|
* Add a row to the cart
|
||||||
*
|
*
|
||||||
@@ -40,19 +41,38 @@ The shoppingcart gives you the following methods to use:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Cart::add('293ad', 'Product 1', 1, 9.99, array('size' => 'large'));
|
Cart::add('293ad', 'Product 1', 1, 9.99, array('size' => 'large'));
|
||||||
|
```
|
||||||
|
|
||||||
|
**Cart::addBatch()**
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add multiple rows to the cart
|
||||||
|
*
|
||||||
|
* @param Array $items An array of items to add, use array keys corresponding to the 'add' method's parameters
|
||||||
|
*/
|
||||||
|
|
||||||
|
Cart::addBatch(array(
|
||||||
|
array('id' => '293ad', 'name' => 'Product 1', 'qty' => 1, 'price' => 10.00),
|
||||||
|
array('id' => '4832k', 'name' => 'Product 2', 'qty' => 1, 'price' => 10.00, 'options' => array('size' => 'large'))
|
||||||
|
));
|
||||||
|
|
||||||
**Cart::update()**
|
**Cart::update()**
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the quantity of one row of the cart
|
* Update the quantity of one row of the cart
|
||||||
|
*
|
||||||
* @param string $rowId The rowid of the item you want to update
|
* @param string $rowId The rowid of the item you want to update
|
||||||
* @param integer $qty New quantity of the item
|
* @param integer|Array $attribute New quantity of the item|Array of attributes to update
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
$rowId = 'da39a3ee5e6b4b0d3255bfef95601890afd80709';
|
$rowId = 'da39a3ee5e6b4b0d3255bfef95601890afd80709';
|
||||||
|
|
||||||
Cart::update($rowId, 2);
|
Cart::update($rowId, 2);
|
||||||
|
|
||||||
|
OR
|
||||||
|
|
||||||
|
Cart::update($rowId, array('name' => 'Product 1'));
|
||||||
|
|
||||||
**Cart::remove()**
|
**Cart::remove()**
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user