我在格式化购物车项目时遇到问题。I是与数量在同一行上的增量和减量。此外,我还想添加一些
在某些行之间添加标签。我的代码目前在http://theconnectionsconnection.us/orderform.php?location=connections上运行。
下面是我的simpleCart的样子:
<script>
simpleCart({
cartColumns: [
{ attr: "name" , label: "Name" } ,
{ attr: "price" , label: "Price", view: 'currency' } ,
{ view: "decrement" , label: false , text: "-" } ,
{ attr: "quantity" , label: "Qty" } ,
{ view: "increment" , label: false , text: "+" } ,
{ attr: "total" , label: "SubTotal", view: 'currency' } ,
{ view: "remove" , text: "Remove" , label: false }
]
});
</script>以及购物车代码的其余部分:
<div id='left_large'>
<div class='simpleCart_shelfItem'>
<h2 class='item_name'> Awesome T-shirt </h2>
<p>
<input type='text' value='1' class='item_Quantity'>
<span class='item_price'>$35.99</span>
<a class='item_add' href='javascript:;'> Add to Cart </a>
</p>
</div>
<div class='simpleCart_shelfItem'>
<h2 class='item_name'> Awesome underwear </h2>
<p>
<input type='text' value='1' class='item_Quantity'>
<span class='item_price'>$12.99</span>
<a class='item_add' href='javascript:;'> Add to Cart </a>
</p>
</div>
<div class='simpleCart_shelfItem'>
<h2 class='item_name'> Awesome pants </h2>
<p>
<input type='text' value='1' class='item_Quantity'>
<span class='item_price'>$67.50</span>
<a class='item_add' href='javascript:;'> Add to Cart </a>
</p>
</div>
</div><!-- emd left_large -->
<div id='right_small'><!-- SHOPPING CART -->
<!-- show the cart -->
<div class='simpleCart_items'></div>
<br />
<span class='simpleCart_quantity'></span> items - <span class='simpleCart_total'></span><a href='javascript:;' class='simpleCart_checkout'>Checkout</a>
</div><!--end right small-->有人能给我指点一下教程或指南吗?文档有点用处,我不能让它正常工作。谢谢
发布于 2017-03-20 08:00:37
好的,这里有一些可能会有帮助的代码!确保它只有一行代码!不要试图让代码变得“漂亮!”
{ view: function(item, column){
return"<a href='javascript:;' class='simpleCart_decrement'><button>-</button></a> "+item.get('quantity')+" <a href='javascript:;' class='simpleCart_increment'><button>+</button></a></p>";
},https://stackoverflow.com/questions/20021409
复制相似问题