Download the PHP package simpavl/zf3-shoppingcart without Composer
On this page you can find all versions of the php package simpavl/zf3-shoppingcart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download simpavl/zf3-shoppingcart
More information about simpavl/zf3-shoppingcart
Files in simpavl/zf3-shoppingcart
Package zf3-shoppingcart
Short Description Simple ZF2 Shopping Cart
License MIT
Homepage https://github.com/martyshka/ShoppingCart
Informations about the package zf3-shoppingcart
ShoppingCart
This model is a simple ZF2 Shopping Cart solution. Provide basic functionality to create and modify Shopping Cart with any content in it. Easy to extend, just create your own Cart Entity and push it during Cart initialisation.
Inspired by
I was inspired to create the ShoppingCart by great job of Vincenzo Provenza and Concetto Vecchio (http://github.com/vikey89/ZendCart). Keeped the same idea behind but made it more flexible, easier to extend and simplier to change.
Zend Framework 3
This module was forked and repaired for zf3
Installation
For the installation uses composer composer. Add this project in your composer.json:
"require": {
"simpavl/zf3-shoppingcart": "dev-master"
}
Post Installation
Configuration:
- Add the module of
config/application.config.php
under the arraymodules
, insertShoppingCart
. - Copy a file named
shoppingcart.global.php.dist
toconfig/autoload/
and change name toshoppingcart.global.php
. - Modify config to fit your expectations.
Examples
Insert
You can insert as many items to the cart as you want. Each entry in cart will have unique token to work with. Example with one product:
Example with 2 products:
Remove
Destroy
Erase Shopping Cart completely.
Cart
Get all content of Cart.
Total Sum
Total Items
Example in controller
How to change/extend Shopping Cart
Provided Shopping Cart Entity is really basic one. You can change the structure of it. For example, if you need to add options to each item in the cart or to provide discount field and so on. What you should do:
- copy ShoppingCart/Entity/ShoppingCartEntity to your module
- modify YourModule/Entity/ShoppingCartEntity: add any fields you need to have
- during Shopping Cart initialisation provide your YourModule/Entity/ShoppingCartEntity
FunctionsReference
Function | Description |
$this->ShoppingCart()->insert(); | Add item(s) to cart. |
$this->ShoppingCart()->remove(); | Delete the item from the cart. |
$this->ShoppingCart()->destroy(); | Delete all items from the cart. |
$this->ShoppingCart()->cart(); | Extracts all items from the cart. |
$this->ShoppingCart()->total_sum(); | Counts the total sum of all items in the cart. |
$this->ShoppingCart()->total_items(); | Counts the total number of all items in the cart. |
Contributors
Aleksander Cyrkulewski - [email protected]