【问题标题】:simpleCart js formatting cartsimpleCart js 格式化购物车
【发布时间】:2013-11-30 01:06:34
【问题描述】:

我在格式化购物车项目时遇到问题。我是与数量在同一条线上的增量和减量。此外,我想在某些行之间添加一些
标签。我的代码目前位于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-->

任何人都可以向我指出教程或指南吗?该文档有点用,我无法让它工作。谢谢

【问题讨论】:

    标签: javascript simplecart


    【解决方案1】:

    好的,这里有一些可能会有所帮助的代码!确保都是一行代码!!!不要试图让代码“漂亮”!

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-23
      • 1970-01-01
      • 2017-03-30
      相关资源
      最近更新 更多