simpleCart js格式化购物车

时间:2013-11-16 17:24:26

标签: javascript simplecart

我在格式化购物车项目时遇到问题。我是与数量相同的增量和减量。另外,我想在某些行之间添加一些标签。我的代码目前正在http://theconnectionsconnection.us/orderform.php?location=connections生效。

这是我的simpleCart的样子:

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

以及其他购物车代码:

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

有人可以指点我指导教程或指导吗?文档略有用,我无法让它工作。感谢

1 个答案:

答案 0 :(得分:-1)

好的,所以这里有一些可能有用的代码!确保它是一行代码!!!不要试图制作代码&#34;漂亮!&#34;

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