Skip to content

Lightweight Magento 1.x ajax cart module which allows easy integration into custom theme

Notifications You must be signed in to change notification settings

stuntcoders/stunt_mage_ajax_cart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magento Ajax Cart Module

Lightweight Magento 1.x ajax cart module which allows easy integration into custom theme. Module does not override default validation, nor does it changes any default template, which allows for seemles integration.

Note: This is not a plug 'n' play module. Out of the box, it does very little. It is intended to be used by developers.

Configuration

Ajax cart be easily enabled or disabled from system configuration – System -> Configuration -> Checkout -> Shopping Cart

Ajax Cart Configuration

Integration

Custom events are triggered on document object before ajax request is sent and after response has been returned. These events should be used to update UI.

document.addEventListener('sc_ajax_cart_add_before', function (e) {
    console.log(e.detail); // { form: [Product Form Object] }
});

document.addEventListener('sc_ajax_cart_add_after', function (e) {
    console.log(e.detail); // { form: [Product Form Object], response: [XMLHttpRequest Object] }
    console.log(e.detail.response.responseJSON); // { success: [true|false], message: [Add to cart message] }
});

Copyright StuntCoders — Start Your Online Store Now