如何在我的simplecart JS中添加税金和总额

时间:2015-05-25 00:49:04

标签: javascript e-commerce shopping-cart simplecart

大家好我试图使用simplecart.js为我的网站创建自定义结帐页面我想添加一个simplecart_grandtotal但它似乎没有显示。我怎么能这样做呢?我的简单代码是我从演示http://wojodesign.com/simpleCart/myCart.html

中获取的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">    
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta charset="utf-8">     
    <script src="js/jquery-1.7.min.js"></script>
        !window.jQuery && document.write('<script src="jquery-1.4.3.min.js"><\/script>');
    </script>
    <title>simpleCart (js) Demo</title>
    <link rel="stylesheet" href="example.css" type="text/css" media="screen" charset="utf-8" />
    <!--[if lte IE 6]><link rel="stylesheet" href="ie6.css" type="text/css" media="screen" charset="utf-8" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="ie7.css" type="text/css" media="screen" charset="utf-8" /><![endif]-->

    <script src="simpleCart2.js" type="text/javascript" charset="utf-8"></script>

    <!--Make a new cart instance with your paypal login email-->
    <script type="text/javascript">
        simpleCart.email = "yasdasb@gmail.com";
        simpleCart.cartHeaders = ['Image','Name','Price','Quantity_input','Total'];
        simpleCart.checkoutTo = PayPal;
    </script>


    <!--Include the SimpleCart(js) script
    <script src="javascripts/simpleCart.js" type="text/javascript" charset="utf-8"></script>

    Make a new cart instance with your paypal login email
    <script type="text/javascript">
        simpleCart = new cart("brett@wojodesign.com");
    </script>-->        
</head>

<body>
  <div class="main">   
        <div id="content">                      
            <div id="sidebar" style="margin-top:20px">
                <h2>You Might Also Like</h2>
                <div class="alsoContainer">
                    <div class="alsoImage">
                        <img src="images/thumbs/blackGold.jpg" alt="" />
                    </div>
                    <div class="alsoInfo">
                        Black Gold<br/>
                        <a href="#" onclick="simpleCart.add('quantity=1','name=Black Gold','price=58','image=images/thumbs/blackGold.jpg');return false;">add to cart</a>
                    </div>
                    <div class="alsoPrice">$58</div>
                </div>

                <div class="alsoContainer">
                    <div class="alsoImage">
                        <img src="images/thumbs/goldShoe.jpg" alt="" />
                    </div>
                    <div class="alsoInfo">
                        Gold Shoe<br/>
                        <a href="#" onclick="simpleCart.add('quantity=1','name=Gold Shoe','price=70','image=images/thumbs/goldShoe.jpg');return false;">add to cart</a>
                    </div>
                    <div class="alsoPrice">$58</div>
                </div>

                <div class="alsoContainer">
                    <div class="alsoImage">
                        <img src="images/thumbs/greenStripe.jpg" alt="" />
                    </div>
                    <div class="alsoInfo">
                        Green Stripe<br/>
                        <a href="#" onclick="simpleCart.add('quantity=1','name=Green Stripe','price=90','image=images/thumbs/greenStripe.jpg');return false;">add to cart</a>
                    </div>
                    <div class="alsoPrice">$58</div>
                </div>  

            <!--End #sidebar--> 
            </div>

            <div id="left">
            <!--Add a Div with the class "simpleCart_items" to show your shopping cart area.-->
                <div class="simpleCart_items" >
                </div>

                <div class="checkoutEmptyLinks">
                <!--Here's the Links to Checkout and Empty Cart-->
                <a href="javascript:;" class="simpleCart_empty">empty cart</a>
                <a href="javascript:;" class="simpleCart_checkout">Checkout</a>

                </div>
            </div>

        <!--End #content-->     
        </div>
    </div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

此演示没有将所有代码转到https://github.com/wojodesign/simplecart-js/blob/master/simpleCart.js并从那里获取。 然后你可以添加:

<div class="simpleCart_tax"></div>
<div class="simpleCart_taxRate"></div>
<div class="simpleCart_grandTotal"></div>

http://simplecartjs.org/documentation/displaying_cart_data