Download the PHP package pinga/cart without Composer
On this page you can find all versions of the php package pinga/cart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package cart
Short Description A simple PHP shopping cart package
License MIT
Homepage https://github.com/getpinga/cart
Informations about the package cart
Pinga Cart
This is a very simple PHP cart library. Cart data can either be saved in PHP session or browser cookie. Maintained and expanded by Taras Kondratyuk and based on seikan/Cart.
Usage
Configuration
-
Install the package:
-
Include in your main PHP script:
- Use in your script:
Options
Parameter | Type | Description |
---|---|---|
cartMaxItem | int | The maximum item can be added to cart. 0 = Unlimited |
itemMaxQuantity | int | The maximum quantity per item can be added to cart. 0 = Unlimited |
useCookie | bool | Use cookie to keep cart data when browser is closed. |
Add Item
Adds an item to cart.
bool \$cart->add( string \$id[, int \$quantity][, array $attributes] );
Update Item
Updates quantity of an item. Attributes must be provides if item with same ID exists with different attributes.
bool \$cart->update( string \$id, int $quantity[, array \$attributes] );
Remove Item
Removes an item. Attributes must be provided to remove specified item, or all items with same ID will be removed from cart.
bool \$cart->remove( string $id[, array \$attributes] );
Get Items
Gets a multi-dimensional array of items stored in cart.
array \$cart->getItems( );
Get Item
Gets a multi-dimensional array of one item stored in cart.
array \$cart->getItem( string $id[, string \$hash] );
Check Cart Empty
Checks if the cart is empty.
bool \$cart->isEmpty( );
Get Total Item
Gets the total of items in the cart.
int \$cart->getTotaltem( );
Get Total Quantity
Gets the total of quantity in the cart.
int \$cart->getTotalQuantity( );
Get Attribute Total
Gets the sum of a specific attribute.
int \$cart->getAttributeTotal( string $attribute );
Clear Cart
Clears all items in the cart.
\$cart->clear( );
Destroy Cart
Destroys the entire cart session.
\$cart->destroy( );
Item Exists
Checks if an item exists in cart.
bool \$cart->isItemExists( string \$id[, array \$attributes] );