All Projects → jason-napolitano → CodeIgniter4-Cart-Module

jason-napolitano / CodeIgniter4-Cart-Module

Licence: MIT License
A basic port of the CodeIgniter 3 cart library for CodeIgniter 4.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to CodeIgniter4-Cart-Module

ci4-album
🔥 CodeIgniter 4 example Album module uses Domain Driven Design Architecture with Tactical Pattern
Stars: ✭ 67 (+116.13%)
Mutual labels:  module, codeigniter, codeigniter4
Ecommwar
A leaderboard of the top open-source e-commerce platforms. Promoting the bests for building reliable stores.
Stars: ✭ 203 (+554.84%)
Mutual labels:  shopping-cart, cart
Co Cart
🛒 CoCart is a flexible, open-source solution to enabling the shopping cart via the REST API for WooCommerce.
Stars: ✭ 198 (+538.71%)
Mutual labels:  shopping-cart, cart
Codeigniter-4-CRUD-generator
ADEL CCG is an easy open-source intuitive web app to create AdminLTE4 -Bootstrap 5- dashboards with CRUD operations in php.
Stars: ✭ 87 (+180.65%)
Mutual labels:  codeigniter, codeigniter4
Grandnode
Open source, headless, multi-tenant eCommerce platform built with .NET Core, MongoDB, AWS DocumentDB, Azure CosmosDB, Vue.js.
Stars: ✭ 1,768 (+5603.23%)
Mutual labels:  shopping-cart, cart
Cezerin2
Cezerin2 is React and Node.js based eCommerce platform. React Shopping Cart. "All In One" App: Cezerin API + Cezerin Storefront + Cezerin Dashboard.
Stars: ✭ 144 (+364.52%)
Mutual labels:  shopping-cart, cart
Online-Book-Store
An online Book Store createed with Python / Flask rest, MySql,Angular and Bootstrap
Stars: ✭ 76 (+145.16%)
Mutual labels:  shopping-cart, cart
Gogrocery
Its an eCommerce app inspired from Amazon , big Basket , grofers ,grocery app , Etc
Stars: ✭ 62 (+100%)
Mutual labels:  shopping-cart, cart
ng-shopping-cart
🛒 An Angular component library to create shopping carts
Stars: ✭ 46 (+48.39%)
Mutual labels:  shopping-cart, cart
cart
Shopping cart composer package
Stars: ✭ 109 (+251.61%)
Mutual labels:  shopping-cart, cart
react-use-cart
React hook library for managing cart state
Stars: ✭ 297 (+858.06%)
Mutual labels:  shopping-cart, cart
Unchained
Headless & open-source e-commerce toolkit. The Unchained Engine is our core product and is written in Node.js ES6
Stars: ✭ 92 (+196.77%)
Mutual labels:  shopping-cart, cart
Laravel Ecommerce Iyzico
Iyzico intigrated e-Commerce system that could be developed easily in simple level.
Stars: ✭ 81 (+161.29%)
Mutual labels:  shopping-cart, cart
Expresscart
A fully functioning Node.js shopping cart with Stripe, PayPal, Authorize.net, PayWay, Blockonomics, Adyen, Zip and Instore payments.
Stars: ✭ 2,069 (+6574.19%)
Mutual labels:  shopping-cart, cart
Laravel Ecommerce
AvoRed an Open Source Laravel Shopping Cart
Stars: ✭ 1,151 (+3612.9%)
Mutual labels:  shopping-cart, cart
Arastta
Solid, Free, Open Source, Community Driven eCommerce
Stars: ✭ 251 (+709.68%)
Mutual labels:  shopping-cart, cart
svelte-commerce
Svelte ecommerce - Headless, Authentication, Cart & Checkout, TailwindCSS, Server Rendered, Proxy + API Integrated, Animations, Stores, Lazy Loading, Loading Indicators, Carousel, Instant Search, Faceted Filters, Typescript, Open Source, MIT license. 1 command deploy to your own server, 1 click deploy to netlify.
Stars: ✭ 695 (+2141.94%)
Mutual labels:  shopping-cart, cart
React With Redux Shop Ducks
shopping cart example with react and redux
Stars: ✭ 12 (-61.29%)
Mutual labels:  shopping-cart, cart
Shoppingcart
REDAXO Warenkorb AddOn - Super flexibel, ohne Checkout
Stars: ✭ 28 (-9.68%)
Mutual labels:  shopping-cart, cart
mytek
Django e-commerce web application with advanced features
Stars: ✭ 27 (-12.9%)
Mutual labels:  shopping-cart, cart

CodeIgniter4-Cart-Module

This is a composer installable, CodeIgniter 4 module that is nearly a direct port of the Codeigniter 3 Cart Library Class. Of course, this has been mildly updated and is consistent with the new version of the framework.

This means that instead of just being a class that you can use in your projects, this library has been updated with Namespaces, has been refactored to adhere to the CodeIgniter style guide and also has been built to use CodeIgniter 4's Service Container to allow for a shared Cart instance across your application.

More detailed documentation can be found here. Please note that the documentation is for the CodeIgniter 3 library but the fundamentals and inner workings of the library are still identical. The most notable changes are how you use it (read below) and to return the total items in your cart, you now call $cart->totalItems() instead of $this->cart->total_items().

Please take note that there are no tests for this package since it is just a port from an existing Codeigniter library and works just the same.

Installation:

  • Install via composer composer require jason-napolitano/codeigniter4-cart-module
  • Add it to the $psr4 array in app/Config/Autoload.php:
$psr4 = [
   'CodeIgniterCart' => ROOTPATH . 'vendor/jason-napolitano/codeigniter4-cart-module/src'

   // OTHER PSR4 ENTRIES
];

Usage

// Call the cart service
$cart = \Config\Services::cart();

// Insert an array of values
$cart->insert(array(
   'id'      => 'sku_1234ABCD',
   'qty'     => 1,
   'price'   => '19.56',
   'name'    => 'T-Shirt',
   'options' => array('Size' => 'L', 'Color' => 'Red')
));

// Update an array of values
$cart->update(array(
   'rowid'   => '4166b0e7fc8446e81e16883e9a812db8',
   'id'      => 'sku_1234ABCD',
   'qty'     => 3,
   'price'   => '24.89',
   'name'    => 'T-Shirt',
   'options' => array('Size' => 'L', 'Color' => 'Red')
));

// Get the total items. Formerly known as total_items()
$cart->totalItems();

// Remove an item using its `rowid`
$cart->remove('4166b0e7fc8446e81e16883e9a812db8');
  
// Clear the shopping cart
$cart->destroy();

// Get the cart contents as an array
$cart->contents();

License:

MIT License

Copyright (c) 2021 Jason Napolitano

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].