Description of templates/common/js/cart.js library usage to integrate with HostBill Cart API 

Setup


To setup cart connection you need to call HBCart.init(cartObjct, settings)

$(function () {
    HBCart.init({}, {
        categoryId: 1,
        url: 'http://your.hostbill.url/',
        language: 'English'
    })
})

Settings


Cart object


Events


Triggered on window.document object


$(document).on('cart.ready', function(){
	//render cart
})

API


All methods listed below will refresh HBCart.cart object.
Each of those also returns a object that can be used to bind callback functions, example:

HBCart.Api.setProduct(id).done(function(cart){
	//re-render configuration
})

Methods