I'm trying to figure out how to add css classes to the cart table that SimpleCartJS generates. (The cart layout I'm using is this: http://bootsnipp.com/snippets/featured/shopping-cart-bs-3 but it doesn't really matter)
============
This is my js configuration:
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 }
]
});
and my HTML:
<div class="simpleCart_items"></div>
============
Basically the output is a generic table.
============
Turn <table>
into <table class="table table-hover">
?
Add these rows under the simpleCart_items?
I'd like these to be rows under all the 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>
so it'd end up looking something like:
Any help?
useful link: https://github.com/wojodesign/simplecart-js/issues/362
TL;DR
Go to your simplecart.js
Search for items: function (selector)
after simpleCart.writeCart(selector);
add in a new line simpleCart.trigger("afterCreate");
add a new bind:
simpleCart.bind("afterCreate", function(){
$cart_table = $(".simpleCart_items table")
$cart_table.addClass("table").addClass("table-hover")
});
you can add here all you want as always >:3!