【问题标题】:simpleCart quantity not showing correctlysimpleCart 数量未正确显示
【发布时间】:2016-02-03 08:31:31
【问题描述】:

我尝试使用以下行让 simpleCart 购物车显示名称、价格和数量

<a class="item_add" href="javascript:;"> Add to Cart </a></p>

如文档和 simplecart.js 下载中包含的示例索引文件中所述。那没有显示项目名称。

索引文件还包括替代公式:

<a href="javascript:;" onclick="simpleCart.add({name:'baby lion', price: 34.95,size:'tiny',thumb:'e.png'});" >add to cart</a>

其中添加了名称、价格但数量错误。直接添加数量属性(即quantity: Quantity)或通过getElementById方法(即quantity: document.getElementById("item_Quantity").value)会导致错误。

我的购物车的栏目设置如下:

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 }
    ]
});

如何同时显示名称和数量?

【问题讨论】:

    标签: javascript simplecart


    【解决方案1】:

    想出了答案,我没有把每个项目都列为

    <li class="simpleCart_shelfItem">
    

    相当愚蠢的错误,但它让我失望,因为其他属性显示在购物车中。现在可以了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多