只是我一直打开购物车,在bootstrap模型中添加了按钮,我试图将产品添加到购物车中,但是按钮不起作用
答案 0 :(得分:0)
取决于版本,但是。在OpenCart 3(在2,3中非常相似)中,添加到购物车的botton的工作方式如下:
在每个产品列表上的按钮应如下所示:sizeof (int) * CHAR_BIT / 3 + 3
。 <button type="button" onclick="cart.add('43');">...</button>
部分最有价值。它连接对象onclick="cart.add('ID');
,并让 common.js 中的脚本处理添加到购物车中的内容。在任何情况下都不要删除它。
如果我们谈论的是产品页面-会有这样的构造:
cart
在此区域中,应保持所有元素<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>
,id
和type
不变。 name
中的所有内容均有助于处理将产品添加到购物车的过程,它们全部都参与了脚本处理,如果您要更改我提到的任何内容,脚本将无法正常工作。您可以根据引导程序或您自己的自由更改标签及其类的顺序。如果您已经修改了此块并且它停止工作-只需从一个清晰的默认OpenCart版本(或您的主题)中恢复它即可。