mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-24 07:55:35 +00:00
Updated README
This commit is contained in:
22
README.md
22
README.md
@@ -35,18 +35,30 @@ The shoppingcart gives you the following methods to use:
|
|||||||
/**
|
/**
|
||||||
* Add a row to the cart
|
* Add a row to the cart
|
||||||
*
|
*
|
||||||
* @param string $id Unique ID of the item
|
* @param string|Array $id Unique ID of the item|Item formated as array|Array of items
|
||||||
* @param string $name Name of the item
|
* @param string $name Name of the item
|
||||||
* @param int $qty Item qty to add to the cart
|
* @param int $qty Item qty to add to the cart
|
||||||
* @param float $price Price of one item
|
* @param float $price Price of one item
|
||||||
* @param Array $options Array of additional options, such as 'size' or 'color'
|
* @param Array $options Array of additional options, such as 'size' or 'color'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Basic form
|
||||||
Cart::add('293ad', 'Product 1', 1, 9.99, array('size' => 'large'));
|
Cart::add('293ad', 'Product 1', 1, 9.99, array('size' => 'large'));
|
||||||
|
|
||||||
|
// Array form
|
||||||
|
Cart::add(array('id' => '293ad', 'name' => 'Product 1', 'qty' => 1, 'price' => 9.99, 'options' => array('size' => 'large')));
|
||||||
|
|
||||||
|
// Batch method
|
||||||
|
Cart::add(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::addBatch()**
|
**Cart::addBatch()**
|
||||||
|
|
||||||
|
Don't use this anymore, just pass a multidimensional array to the `Cart::add()` method
|
||||||
|
|
||||||
```php
|
```php
|
||||||
/**
|
/**
|
||||||
* Add multiple rows to the cart
|
* Add multiple rows to the cart
|
||||||
|
|||||||
Reference in New Issue
Block a user