简体   繁体   English

添加到购物车按钮不起作用 打开购物车

[英]Add to cart button is not working Open cart

Just I have kept open cart Add to cart button inside bootstrap model and I'm trying to add product into the cart but button is not working只是我一直保持打开购物车添加到购物车引导程序 model 内的按钮,我正在尝试将产品添加到购物车但按钮不起作用

Depends on version, but.取决于版本,但是。 In OpenCart 3 (in 2,3 quite similar), add-to-cart bottons work like:在 OpenCart 3 中(在 2,3 中非常相似),添加到购物车按钮的工作方式如下:

On the every product list buttons should be like this: <button type="button" onclick="cart.add('43');">...</button> .每个产品列表上的按钮应该是这样的: <button type="button" onclick="cart.add('43');">...</button> The part onclick="cart.add('ID'); is most valuable. It connects the object cart and let script in common.js to process adding to a cart. Do not remove it in any case. onclick="cart.add('ID');部分最有价值。它连接object cart ,让common.js中的脚本处理添加到购物车。任何情况下都不要删除它。

If we are talking about product page - there is a construction like this:如果我们谈论的是产品页面- 有这样的结构:

<div id="product">
  <div class="form-group">
    <label class="control-label" for="input-quantity">Qty</label>
    <input type="text" name="quantity" value="1" size="2" id="input-quantity" class="form-control" />
    <input type="hidden" name="product_id" value="43" />
    <br />
    <button type="button" id="button-cart" data-loading-text="Loading..." class="btn btn-primary btn-lg btn-block">Add to Cart</button>
  </div>
</div>

In this area we should keep all elements id , type and name untouched.在这个区域中,我们应该保持所有元素idtypename不变。 All inside <div id="product"> helps to process adding product to a cart, all of them take part in script processing and if you will change anything i mentioned - the script will stop working properly. <div id="product">内部的所有内容都有助于处理将产品添加到购物车,所有这些都参与脚本处理,如果您更改我提到的任何内容 - 脚本将停止正常工作。 You are free to change order of the tags and their classes, according to bootstrap or your own.您可以根据引导程序或您自己的方式自由更改标签及其类的顺序。 If you have already modified this block and it stops working - just restore it from a clear default OpenCart version (or your theme).如果您已经修改了此块并且它停止工作 - 只需从明确的默认 OpenCart 版本(或您的主题)恢复它。

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

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