在volusion Ajaxify购物车 [英] Ajaxify shopping cart in volusion

查看:297
本文介绍了在volusion Ajaxify购物车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作对Volusion一个模板,我的问题是,可以在添加到购物车按钮那里Ajax化?

I am working on a template on Volusion, my question is, can the "add to cart" button there be ajaxified?

<div id="custom-buttons">
<div id="custom-cart">
    <a href="ShoppingCart.asp">
    <input class="vCSS_input_addtocart" type="image"
    src="/v/vspfiles/templates/248/images/buttons/btn_addtocart.gif" 
    name="btnaddtocart" alt="Add to cart" border="0" 
    data-image-path="/v/vspfiles/templates/248/images/buttons/btn_addtocart.gif"/>
</a>
</div>

这是code,按钮本身的工作原理,但它需要我从产品页面客场车页面,我想避免,但仍然添加的项目到购物车。

That is the code, the button itself works, but it takes me away from the product page to the cart page, and I would like to avoid that but still add the desired item to cart.

感谢您!

推荐答案

假设你的店里有管理员配置变量启用放入购物车,弹出打开,你可以简单地提供一个链接如下图所示,在模板中的任意位置,当用户点击它会通过Ajax因此只要添加的项目作为该项目没有期权或不是礼券。 Volusion已建成,其中运行脚本,处理这种自动提供的配置变量是打开的。

Assuming your store has the admin config variable "Enable Add To Cart Popup" turned on, you can simply provide a link like shown below, anywhere in your template and when the user clicks on it it will add the item via Ajax so as long as the item does not have options or is not a gift certificate. Volusion has built in scripts which run which handle this automatically provided the config variable is turned on.

<a class="unbind" href="/ShoppingCart.asp?ProductCode=xyz">
   <img border="0" align="absmiddle" src="/v/vspfiles/templates/248/images/buttons/btn_addtocart_small.gif">
</a>

下面添加到了&LT之前; /头&GT; 标签在你的模板,并使用上面的链接添加的项目。每次你点击它时它会之一的量添加到购物车。将不会有视觉反馈,该项目已被添加,根据您的要求。

Add the following to the before the </head> tag in your template and use the above link to add the item. Each time you click on it it will add a quantity of one to the cart. There will be no visual feedback that the item has been added, per your request.

<script type="text/javascript">
$(function() {
$('.unbind').unbind()
    .click(function() {
        var product_code = $(this).attr('href').substr($(this).attr('href').lastIndexOf('=') + 1).toUpperCase();
        $.ajax({
            type: "POST",
            url: '/ProductDetails.asp?ProductCode=' + product_code + '&btnaddtocart=btnaddtocart&AjaxError=Y&batchadd=Y',
            data: 'ProductCode=' + product_code + '&QTY.' + product_code + '=1'
        });
        return false;
    });
});
</script>

如果你想上点击使用上面所示的HTML项目软后车弹出(改变产品code相应的),并使用以下code。

If you want the soft cart to popup after an item is clicked on use the HTML shown above (change the product code accordingly) and use the following code.

<script type="text/javascript">
$(function() {
    $('.unbind').unbind()
        .click(function() {
            var qstr = 'ProductCode=' + global_URL_Encode_Current_ProductCode + '&QTY.' + global_URL_Encode_Current_ProductCode + '=1&ReplaceCartID=&ReturnTo=&e=&btnaddtocart.x=5&btnaddtocart.y=5';
            SoftAddSingleItem(global_URL_Encode_Current_ProductCode, 1, qstr);
            return false;
        });
});
</script>

这篇关于在volusion Ajaxify购物车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆