to use JS currect on your site. you must use pubsub.
ccpubsub
ccpubsub.ready event
fired when all relevant scripts are loaded.
ccpubsub.subscribe("ready", function(){
// .. your code here
})
ccpubsub.pageview event
fired when user view a page
ccpubsub.subscribe("pageview", function(){
// .. your code here
})
ccpubsub.cart_add event
fired when user add an item to the shopping cart.
recieved parameters: pid - product id, qty, price
ccpubsub.subscribe("cart_add", function(event_name, data){
// .. your code here
// event_name = "cart_add"
// data.internalsource - upsale or default
// data.pid = item id
// data.price = price
// data.qty = selected qty
})
ccpubsub.cart_remove event
fired when user clicks on add to cart button.
recieved parameters: pid - product id
ccpubsub.subscribe("cart_remove", function(pid){
// .. your code here
})
ccpubsub.cart_updated event
fired when cart is changed.
recieved parameters: {data}
ccpubsub.subscribe("cart_updated", function(pid){
// .. your code here
})
ccpubsub.paybutton_click event
fired when user clicks on add to cart button.
recieved parameters: cart object
ccpubsub.subscribe("paybutton_click", function(cart){
// .. your code here
})
ccpubsub.more_items_click_loaded event
fired when user clicks on load more items.
recieved parameters: State, data, page, tags
ccpubsub.subscribe("more_items_click_loaded", function(state,data,page,tags){
// .. your code here
})