How to put a cute little update under quantity on view cart in Cs-cart

Do you miss an update button on your cart like amazon.com has in the image below ?

amazon_cart_update

This post will show you how you can add an update link like this in cs-cart without touching core files.  This is a minor modification so you can edit any of your existing addon.  If you don’t have an existing addon, do the changes in my_changes addon just make sure you have it installed.  To illustrate I will do the changes in my_changes addon.

  1. Make sure you have the addon installed.  Verify from Administration->addons page.
    my_changes_installed
  2. Make sure ‘Value changer’ for the Quantity field is enabled.  Verify from Settings->Appearance.
  3. Add the JavaScript code, create folder and files if not present.
    skins\basic\customer\addons\my_changes\hooks\index\footer.post.tpl

    {literal}
    <script type="text/javascript">
    $(document).ready(function() { // removes the link from review stars
    
    // add update link
     $('div[class="center valign cm-value-changer"]').each(function(){
     var $this = $(this);
     $this.append('<p><a class = "upd_qty" style="font-size: 11px;">{/literal}{$lang.update}{literal}</a></p>') ;
     });
    
     // hide update link by default
     $('a[class="upd_qty"]').hide() ;
    
     // show update link on increase or decrease & hide + if reached max
    
     $('a[class="cm-increase"]').click(function(){
     var $this = $(this);
     $this.parent().find('a[class="upd_qty"]').show('slow');
    
     });
    
     $('a[class="cm-decrease"]').click(function(){
     var $this = $(this);
     $this.parent().find('a[class="upd_qty"]').show('slow');
     });
    
     // update link
     $('a[class="upd_qty"]').click(function(){
     $('#button_cart').click();
     });
    });
    </script>
    {/literal}
    
  4. That’s it, just the clear cache admin.php?cc and check view cart page.
    cart_update_link
Posted in CS-Cart
One comment on “How to put a cute little update under quantity on view cart in Cs-cart
  1. david says:

    it`s quite useful and workable,thank you shikhar

Leave a Reply

Your email address will not be published. Required fields are marked *

*