Author Topic: update error on the cart module  (Read 335 times)

ibnati

  • Beginner
  • *
  • Posts: 28
  • A beginner
update error on the cart module
« on: June 13, 2018, 02:13:40 am »
hello

i have used   virtuemart for the shop area of the site

but i remarked asmall error on the vrtuemart cart also it doesn't update numbers of product and don't remove products  from the cart when i click on remove iconswhen the header is sticky and when the header  menu is not sticky it works correctly , can you please can you check it and tell me how to fix it ?

the site link is http://devo.cutwatches.com/index.php/en/grid-products 

and i use the php 7.0 and latest version of virtuemart   , let me know if you need more infos

thanks
amine


jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26975
  • Always on vacation
    • Jenkin Hill Internet
Re: update error on the cart module
« Reply #1 on: June 13, 2018, 09:48:19 am »
it doesn't update numbers of product and don't remove products  from the cart when i click on remove iconswhen the header is sticky and when the header  menu is not sticky it works correctly

So the error is on;py seen when the tamplate header is fixed. The issue is therefore with your template, not with VirtueMart, presumably a JavaScrip conflict.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM..3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8014
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: update error on the cart module
« Reply #2 on: June 13, 2018, 10:51:18 am »
Yes .. template issue ... the sticky header is a completely different duplicated html  -- i.e. there is 2 of everything on the page and I assume having 2 cart modules isn't working
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ibnati

  • Beginner
  • *
  • Posts: 28
  • A beginner
Re: update error on the cart module
« Reply #3 on: June 14, 2018, 01:44:55 am »
also the issue is not on the header it on the update script of the module because when i use an other module it works but the issue is that the other module don't have remove from cart option

also this the update js of this module may be you can see where is the issue :

Code: [Select]
}

// Remove item in cart
$(function(){
    var cprefix = "#vmCartModule", wcart = $(cprefix),
    releaseCart = function(rs){
        var ncart = $(rs.data).filter(cprefix);
        if(!ncart.length) {
            return false;
        }
        wcart.find('.moduleMiniCart').html(ncart.find('.moduleMiniCart').html());
        wcart.find('.view_cart_link').html(ncart.find('.view_cart_link').html());
    };

    wcart.on({
        'fetch-cart': function(){
            var $this = $(this);

            $.ajaxSetup({ cache: false });
            var params = {
                option: 'com_ajax',
                module: 'virtuemart_carte',
                method: 'getData',
                format: 'json'
            };
            $.getJSON(buildUrl(location.href), params,function (rs, textStatus) {
                releaseCart(rs);                               
            });
        }
    });

    // remove item in cart
    $(document).delegate('[data-miniaction="rcart"]', 'submit.removeItem', function(){

        wcart.addClass('process');           
        $.post(buildUrl(location.href), $(this).serialize(), function(rs){ 
            releaseCart(rs);
        }).done(function(){
            wcart.removeClass('process');
        });

        return false;     
    });

    // ajax add
    window.Virtuemart = $.extend(window.Virtuemart, {
        cartEffect: function (form) {

            if(usefancy){ $.fancybox.showActivity(); }

            $.ajax({
                type: "POST",
                cache: false,
                dataType: "json",
                url: window.vmSiteurl + "index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json"+vmLang,
                data: form.serialize(),
                beforeSend: function(){
                    wcart.addClass('process');
                },
                complete: function(){
                    wcart.removeClass('process');
                }
            }).done(function(datas, textStatus) {

                if(datas.stat ==1){

                    var txt = datas.msg;
                } else if(datas.stat ==2){
                    var txt = datas.msg +"<H4>"+form.find(".pname").val()+"</H4>";
                } else {
                    var txt = "<H4>"+vmCartError+"</H4>"+datas.msg;
                }       
                if(usefancy){
                    $.fancybox({
                        "titlePosition" :     "inside",
                        "transitionIn"    :    "fade",
                        "transitionOut"    :    "fade",
                        "changeFade"    :   "fast",
                        "type"            :    "html",
                        "autoCenter"    :   true,
                        "closeBtn"      :   false,
                        "closeClick"    :   false,
                        "content"       :   txt
                    });
                } else {
                    $.facebox.settings.closeImage = closeImage;
                    $.facebox.settings.loadingImage = loadingImage;
                    $.facebox({ text: txt }, 'my-groovy-style');
                }

                // update cart
                wcart.trigger('fetch-cart');
            });
        }     
    });
});

})(jQuery);