我在格式化购物车商品时遇到问题。我是与数量在同一行的增量和减量。此外,我想在某些行之间添加一些
标记。我的代码位于 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-->
有人能给我指点教程或指南吗?该文档有点用处,我无法让它工作。谢谢
最佳答案
好的,下面是一些可能有用的代码!确保都是一行代码!!!不要试图使代码“漂亮!”
{ 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>";
},
关于javascript - simpleCart js格式化购物车,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20021409/