simpleCart(js)

items
Items:
Total:

Setup/Initialization

simpleCart(js) requires using jQuery, Prototype, or Mootools. No extra configuration is needed as long as one of them is included on the page

Quick Start

Add the script to your page and set your checkout method



To sell items from your “Shelf”, just add some classes to your html like this:

Awesome T-shirt


$35.99
Add to Cart

Then just add classes where you want your totals to show or have your checkout buttons:

 items - 
Checkout

That’s it!  See below for options you can set, and take a look at the checkout methods and different customizations available.

You can set/change simpleCart options at any time:

simpleCart({
	option1: "value" ,
	option2: "value2" 
});

Here are the possible options and their default values:

simpleCart({
	// array representing the format and columns of the cart,
	// see the cart columns documentation
	cartColumns: [
		{ attr: "name", label: "Name"},
		{ view: "currency", attr: "price", label: "Price"},
		{ view: "decrement", label: false},
		{ attr: "quantity", label: "Qty"},
		{ view: "increment", label: false},
		{ view: "currency", attr: "total", label: "SubTotal" },
		{ view: "remove", text: "Remove", label: false}
	],

	// "div" or "table" - builds the cart as a 
	// table or collection of divs
	cartStyle: "div", 

	// how simpleCart should checkout, see the 
	// checkout reference for more info 
	checkout: { 
		type: "PayPal" , 
		email: "[email protected]" 
	},

	// set the currency, see the currency 
	// reference for more info
	currency: "USD",

	// collection of arbitrary data you may want to store 
	// with the cart, such as customer info
	data: {},

	// set the cart langauge 
	// (may be used for checkout)
	language: "english-us",

	// array of item fields that will not be 
	// sent to checkout
	excludeFromCheckout: [],

	// custom function to add shipping cost
	shippingCustom: null,

	// flat rate shipping option
	shippingFlatRate: 0,

	// added shipping based on this value 
	// multiplied by the cart quantity
	shippingQuantityRate: 0,

	// added shipping based on this value 
	// multiplied by the cart subtotal
	shippingTotalRate: 0,

	// tax rate applied to cart subtotal
	taxRate: 0,

	// true if tax should be applied to shipping
	taxShipping: false,

	// event callbacks 
	beforeAdd			: null,
	afterAdd			: null,
	load				: null,
	beforeSave		: null,
	afterSave			: null,
	update			: null,
	ready			: null,
	checkoutSuccess	: null,
	checkoutFail		: null,
	beforeCheckout		: null,
        beforeRemove           : null
});

Comments

  1. Sep 11, 2012

    Mpa4Hu  said:

    Hello,  I’m interesting, if paypal returns any information, like true or something, that the payment went okay.

    I’m making some project and i need some event back.

Commenting is not available in this channel entry.