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