Ecmall Modified: The realization of the immediate purchase function

Source: Internet
Author: User

1. Customers require immediate purchase, it is always troublesome to join the shopping cart.

2. Buy now function In fact ecmall not, eventually to jump to the shopping cart confirmation page. However, the template has options for immediate purchase.

In the template store/default/goodsinfo.html file. The code is as follows:

   <li class= "Btn_c1" title= "{$lang. Buy_now}" ><a href= "Javascript:buy_to_cart ()" ></a></li>

3. You need to add the following JS code in goodsinfo.html to achieve the option to buy Now:

function Buy_to_cart () {    if (goodsspec.getspec () = = null)    {        alert (lang.select_specs);        return;    }    var spec_id = Goodsspec.getspec (). ID;    var quantity = $ ("#quantity"). Val ();    if (quantity = = ")    {        alert (lang.input_quantity);        return;    }    if (parseint (quantity) < 1)    {        alert (lang.invalid_quantity);        return;    }    Buy_add_to_cart (spec_id, quantity);} function Buy_add_to_cart (spec_id, quantity) {    var url = site_url + '/index.php?app=cart&act=add ';    $.getjson (URL, {' spec_id ': spec_id, ' Quantity ': quantity}, function (data) {        if (data.done)        {            Window.location.href = site_url + '/index.php?app=order&goods=cart&store_id=2 ';        }        else        {            alert (data.msg);}}    );}

That's all you can do. Project Address: www.ya-jing.cn Stock Distribution Fund


Ecmall Modified: The realization of the immediate purchase function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.