简体   繁体   English

禁用JOOMLA 1.7中的evinessmart组件的添加到购物车按钮上的弹出窗口

[英]Disable popup on add to cart button of virtuemart component in JOOMLA 1.7

I am using Virtuemart 2.0.0 shopping cart component for JOOMLA 1.7. 我正在为JOOMLA 1.7使用Virtuemart 2.0.0购物车组件。 On flypage (product detail page) there a button "Add to Cart" for add product in cart. 在flypage(产品详细信息页面)上,有一个“添加到购物车”按钮,用于在购物车中添加产品。

When click on that button a popup box is open, popup box contains some option and details like product name, continue shopping button and go to checkout. 当单击该按钮时,将打开一个弹出框,该弹出框包含一些选项和详细信息,例如产品名称,继续购物按钮并转到结帐。

I want disable that popup box on add to cart button when i click that button page is redirect to checkout page. 当我单击该按钮页面重定向到结帐页面时,我想禁用“添加到购物车”按钮上的弹出框。

So, anybody give me any idea to disable the popup and where i got that option in configuration of virtuemart on admin side 所以,任何人都给我任何想法来禁用弹出窗口,以及在管理端配置我的功能时我在哪里获得了该选项

One way is to modify the function that is in the vmprices.js file, and comment out the lines that show the popup, if you want you can add some other behavior right there, the function is sendtocart. 一种方法是修改vmprices.js文件中的函数,并注释掉显示弹出窗口的行,如果要在此添加其他行为,则该函数为sendtocart。 For example to remove the popup should do this. 例如删除弹出窗口应执行此操作。

(function($) {
    $.fn.product = function(options) {

    this.each(function(){
        var cart = $(this),
        addtocart = cart.find('input.addtocart-button'),
        plus   = cart.find('.quantity-plus'),
        minus  = cart.find('.quantity-minus'),
        select = cart.find('select'),
        radio = cart.find('input:radio'),
        virtuemart_product_id = cart.find('input[name="virtuemart_product_id[]"]').val(),
        quantity = cart.find('.quantity-input');

        **//addtocart.click(function(e) { 
            //sendtocart(cart);
            //return false;
        //});**

        plus.click(function() {
            var Qtt = parseInt(quantity.val());
            if (Qtt != NaN) {
                quantity.val(Qtt + 1);
            }
        });
        minus.click(function() {
            var Qtt = parseInt(quantity.val());
            if (Qtt != NaN && Qtt>0) {
                quantity.val(Qtt - 1);
            }
        });
        select.change(function() {
            $.setproducttype(cart,virtuemart_product_id);
        });
        radio.change(function() {
            $.setproducttype(cart,virtuemart_product_id);
        });
    });

转到enefitmart组件并查看左侧栏,选择倒数第二个配置选项卡,然后打开配置选项卡,然后在上方查看某些选项卡,然后选择结帐选项卡,在该选项卡中查看一些选项,然后选择其第一个选项禁用购物车弹出窗口。

Not sure if those settings still exists in 1.7 but it used to be under: 不知道这些设置在1.7中是否仍然存在,但以前位于以下位置:

Components->VirtueMart->Admin-> Configuration->Site 组件-> VirtueMart->管理->配置->站点

Click on the Configuration link underneath the "Select theme" for your Shop drop-down menu. 单击“商店”下拉菜单中“选择主题”下方的“配置”链接。 There set the following values: 设置以下值:

Customer Checkout in a popup (GreyBox)? 弹出窗口(GreyBox)中的客户结帐? No 没有

Use Ajax to add, update or delete products from the cart? 使用Ajax从购物车中添加,更新或删除产品? No 没有

VM 2.0 no longer uses themes so there is not changing any setting for the theme any more. VM 2.0不再使用主题,因此不再更改主题的任何设置。 If you want to change how any of the pages looks or works, you use a simple template override like you do for other Joomla extensions. 如果要更改任何页面的外观或工作方式,请像其他Joomla扩展一样使用简单的模板替代。

Copy this file - 复制此文件-

components/com_virtuemart/views/productdetails/tmpl/default.php

Place the copy here - 将副本放在这里-

YOUR_TEMPLATE/html/com_virtuemart/productdetails/default.php

Make any changes you want then. 然后进行所需的任何更改。

One way is to modify the function that is in the vmprices.js file, and comment out the lines that show the popup, if you want you can add some other behavior right there, the function is sendtocart. 一种方法是修改vmprices.js文件中的函数,并注释掉显示弹出窗口的行,如果要在此添加其他行为,则该函数为sendtocart。 For example to remove the popup should do this. 例如删除弹出窗口应执行此操作。

function sendtocart(form){

        $.ajaxSetup({ cache: false })
        var datas = form.serialize();
        $.getJSON(siteurl+'index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json',encodeURIComponent(datas),
            function(datas, textStatus) {
                if(datas.stat ==1){
                    //var value = form.find('.quantity-input').val() ;
                    var txt = form.find(".pname").val()+' '+vmCartText;
                                            $.facebox.settings.closeImage = closeImage;
                                            $.facebox.settings.loadingImage = loadingImage;
                                            $.facebox.settings.faceboxHtml = faceboxHtml;
                    //$.facebox({ text: datas.msg +"<H4>"+txt+"</H4>" }, 'my-groovy-style');
                } else if(datas.stat ==2){
                    var value = form.find('.quantity-input').val() ;
                    var txt = form.find(".pname").val();
                                            $.facebox.settings.closeImage = closeImage;
                                            $.facebox.settings.loadingImage = loadingImage;
                                            $.facebox.settings.faceboxHtml = faceboxHtml;
                    //$.facebox({ text: datas.msg +"<H4>"+txt+"</H4>" }, 'my-groovy-style');
                } else {
                                            $.facebox.settings.closeImage = closeImage;
                                            $.facebox.settings.loadingImage = loadingImage;
                                            $.facebox.settings.faceboxHtml = faceboxHtml;
                    //$.facebox({ text: "<H4>"+vmCartError+"</H4>"+datas.msg }, 'my-groovy-style');
                }
                if ($(".vmCartModule")[0]) {
                    $(".vmCartModule").productUpdate();
                }
            });
            $.ajaxSetup({ cache: true });
    };

Most simple way is to uncheck the 'use product script' box in Configuration > Templates. 最简单的方法是取消选中“配置”>“模板”中的“使用产品脚本”框。

Then in your product detail template change: 然后在您的产品详细信息模板中进行更改:

<noscript><input type="hidden" name="task" value="add" /></noscript> 

to: 至:

<input type="hidden" name="task" value="add" />

removing the noscript tags 删除noscript标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM