News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

update error on the cart module

Started by ibnati, June 13, 2018, 02:13:40 AM

Previous topic - Next topic

ibnati

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

Quote from: ibnati on June 13, 2018, 02:13:40 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
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

GJC Web Design

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 https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ibnati

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 :

}

// 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);