【发布时间】:2014-07-24 00:59:40
【问题描述】:
我试图弄清楚如何将 css 类添加到 SimpleCartJS 生成的购物车表中。 (我使用的购物车布局是这样的:http://bootsnipp.com/snippets/featured/shopping-cart-bs-3 但这并不重要)
============
输入
这是我的 js 配置:
simpleCart({
checkout: {
type: "PayPal",
email: "you@yours.com"
},
cartStyle: "table",
cartColumns: [
/* Picture (same for every product right now) */
{ view: function( item, column) {
return "<a class=\"thumbnail pull-left\" href=\"#\"> "
+"<img class=\"media-object\" src=\"http://icons.iconarchive.com/icons/custom-icon-design/flatastic-2/72/product-icon.png\" "
+"style=\"width: 72px; height: 72px;\"> </a>";
}, label: false },
/* Name */
{ attr: "name", label: "Product" },
/* Quantity */
{ attr: "quantity" , label: "Qty" } ,
/* Price */
{ attr: "price" , label: "Price", view: 'currency' } ,
/* Remove */
{ view: "remove" , text: "Remove" , label: false }
]
});
还有我的 HTML:
<div class="simpleCart_items"></div>
============
输出
基本上,输出是一个通用表。
============
我该怎么做:
把
<table>变成<table class="table table-hover">?在simpleCart_items下添加这些行?
我希望这些是所有项目下的行:
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h5>Subtotal</h5></td>
<td><div class="simpleCart_total"></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h5>Estimated shipping</h5></td>
<td><div class="simpleCart_shipping"></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h3>Total</h3></td>
<td><div class="simpleCart_grandTotal"></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><a href="javascript:;" class="simpleCart_checkout">Checkout</a></td>
</tr>
所以它最终看起来像:
有什么帮助吗?
【问题讨论】:
标签: javascript jquery html simplecart