Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

vstelmakh/jquery.shoppingcart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jquery.shoppingcart

Simple shopping cart jQuery plugin using local storage.

Installation

Include script after the jQuery library (unless you are packaging scripts somehow else):

<script src="/path/to/jquery.shoppingcart.js"></script>

Browser requirements

ScreenShot

Usage

Add item:

$.shoppingcart('add',{
				'id': 123,
				'image': 'path/to/image.png',
				'name': 'ProductName',
				'code': 'Product123',
				'url': 'catalog/clothes/product/123',
				'attributes': ['S', 'Black'],
				'price': 30,
				'count': 1
			});

Only id & price are required!

Edit item:

$.shoppingcart('edit',{
				'id': 123,
				'image': 'path/to/newImage.png',
				'name': 'ProductNewName',
				'code': 'ProductNew123',
				'url': 'catalog/clothes/product/123',
				'attributes': ['M', 'White'],
				'price': 60,
				'count': 2
			});

Only id is required!

Remove item:

$.shoppingcart('remove', {'id': 123});

Clear cart:

$.shoppingcart('clear');

Get items count:

// Returns integer
$.shoppingcart('getCount');

Get total cart price:

// Returns float
$.shoppingcart('getPrice');

Get item by id:

// Returns object { 'id', 'image', 'name', 'code', 'url', 'attributes', 'price', 'count' }
$.shoppingcart('getById', id);

Get all cart items:

// Returns ARRAY of object { 'id', 'image', 'name', 'code', 'url', 'attributes', 'price', 'count' }
$.shoppingcart('getAll');

Authors

Volodymyr Stelmakh (vov1)

About

Simple shopping cart jQuery plugin using local storage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published