Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/totoprayogo1916/codeigniter4-cart
Cart Library for Codeigniter 4 (Originally from CodeIgniter3)
https://github.com/totoprayogo1916/codeigniter4-cart
cart codeigniter4 codeigniter4-library shopping shopping-cart
Last synced: 3 months ago
JSON representation
Cart Library for Codeigniter 4 (Originally from CodeIgniter3)
- Host: GitHub
- URL: https://github.com/totoprayogo1916/codeigniter4-cart
- Owner: totoprayogo1916
- License: mit
- Fork: true (bcit-ci/ci3-cart-library)
- Created: 2022-10-11T12:14:26.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-20T03:26:37.000Z (10 months ago)
- Last Synced: 2024-09-30T11:06:16.598Z (3 months ago)
- Topics: cart, codeigniter4, codeigniter4-library, shopping, shopping-cart
- Language: PHP
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeIgniter 4 Cart Library
The Cart Library originally from CodeIgniter 3.
## Usage
Feel free to read the original: https://codeigniter.com/userguide3/libraries/cart.html```php
use Totoprayogo1916\CodeIgniter\Libraries\Cart;$cart = new Cart();
// Insert an array of values
$cart->insert([
'id' => 'sku_1234ABCD',
'qty' => 1,
'price' => '19.56',
'name' => 'T-Shirt',
'options' => ['Size' => 'L', 'Color' => 'Red']
]);
// Update an array of values
$cart->update([
'rowid' => '4166b0e7fc8446e81e16883e9a812db8',
'id' => 'sku_1234ABCD',
'qty' => 3,
'price' => '24.89',
'name' => 'T-Shirt',
'options' => ['Size' => 'L', 'Color' => 'Red']
]);// Get the total items.
$cart->total_items();// Remove an item using its `rowId`
$cart->remove('4166b0e7fc8446e81e16883e9a812db8');
// Clear the shopping cart
$cart->destroy();// Get the cart contents as an array
$cart->contents();
```