Ted
Ted

Reputation: 497

simpleCart js formatting cart

I'm having trouble formatting the cart items. I was the increment and decrement on the same line as the Quantity. Additionally, I'd like to add some
tags in between some lines. My code is live at http://theconnectionsconnection.us/orderform.php?location=connections currently.

Heres what my simpleCart looks like:

<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>

and the rest of the cart code:

<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-->

could anybody point me towards a tutorial or guide even? the documentation is marginally useful and I can't get it to work. Thanks

Upvotes: 2

Views: 1427

Answers (1)

RandomDude
RandomDude

Reputation: 1

Okay, so here is some code that might help! Make sure it is all ONE LINE OF CODE!!! Dont try to make the code "pretty!"

    { 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>";
},

Upvotes: -1

Related Questions