javascript - minicart js - applying discount when buying multiple items -


i have implemented minicart js website, , can add items cart , works properly. do, when user adds 2 items @ particular price (say 11.99) discount down 20.

i know there discount function minicart js documentation isn't clear. know best way achieve this?

here code i'm working with:

<?php        // connect mysql database       include "store_scripts/connect_to_mysql.php";       $dynamiclist = '';     $sql = mysqli_query($dbc, "select * products category = 'rings'");     $productcount = mysqli_num_rows($sql);      if($productcount > 0)     {         while($row = mysqli_fetch_array($sql))         {             $id = $row['id'];             $product_name = $row['product_name'];             $price = $row['price'];             $date_added = strftime("%b %d, %y", strtotime($row["date_added"]));             $dynamiclist .= '              <div id="floatedimage">                 <a href="product.php?id=' . $id . '"><img src="images/' . $product_name . '.jpg" alt="' . $product_name . '" /></a>                 <p>' . $product_name . '</p>                 <p>€' . $price . '</p>                 <p><a href="product.php?id=' . $id . '">view product details</a><p>                  <form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">                     <input type="hidden" name="cmd" value="_cart"/>                         <input type="hidden" name="business" value="test@test.com"/>                         <input type="hidden" name="item_name" value="' . $product_name . '"/>                         <input type="hidden" name="amount" value="' . $price . '"/>                         <input type="hidden" name="currency_code" value="eur"/>                         <input type="hidden" name="add" value="1"/>                         <input type="image" src="https://www.sandbox.paypal.com/en_us/i/btn/btn_cart_lg.gif" name="submit" alt="paypal - safer, easier way pay online!"/>                         <img alt="" src="https://www.sandbox.paypal.com/en_us/i/scr/pixel.gif" width="1" height="1"/>                 </form>              </div>';         }     }     else     {         $dynamiclist = "we have no products listed in our store yet";     }      mysqli_close($dbc); ?>  <!doctype html>  <head>     <meta content="text/html; charset=utf-8" http-equiv="content-type" />     <link href="css/styles.css" rel="stylesheet" type="text/css" media="screen"/>      <title>rings</title>  </head>  <body>      <div id="wrapper">          <div id="top">             <?php include('templates/top_template.php'); ?>         </div>          <div id="topnav">             <?php include('templates/topnav_template.php'); ?>         </div>          <div id="banner">          </div>          <div id="content">             <p><?php echo $dynamiclist ?></p>          </div>          <div id="rightside">             <?php include('templates/rightside_template.php'); ?>         </div>          <div id="footer">             <?php include('templates/footer_template.php'); ?>         </div>            <div id="copyrightfooter">             <?php include('templates/copyrightfooter_template.php'); ?>         </div>          <script src="minicart.js"></script>         <script>             paypal.minicart.render();            </script>     </div>  </body>  </html> 


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -