Reputation: 217
I tried having simpleCart shopping cart display name, price and quantity using the following line
<a class="item_add" href="javascript:;"> Add to Cart </a></p>
as given in documentation and in sample index file included in simplecart.js download. That did not show item name.
Index file also included alternative formulation:
<a href="javascript:;" onclick="simpleCart.add({name:'baby lion', price: 34.95,size:'tiny',thumb:'e.png'});" >add to cart</a>
which added the name, price but wrong quantity. Adding quantity attribute either directly (i.e. quantity: Quantity
) or by getElementById method (i.e. quantity: document.getElementById("item_Quantity").value
) resulted in errors.
My shopping cart's columns are set up as follows:
simpleCart({
cartColumns: [
{ attr: "name" , label: "Item"},
{ 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 }
]
});
How can I show both name and quantity?
Upvotes: 0
Views: 232
Reputation: 217
Figured out the answer, I failed to list each item as
<li class="simpleCart_shelfItem">
Pretty dumb error but it threw me off as other attributes were showing in the cart. It works now.
Upvotes: 0