Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From the shoppingcart_functions.php file:
- 'function get_shopping_cart() {
- global $wpdb, $_POST;
- update_shopping_cart();
- ?>
- <div class="ShoppingCartTable">
- <form name="shopping_cart" action="<?php the_permalink(get_the_ID()) ?>" method="post">
- <input type="hidden" name="updateshoppingcart" value="1" />
- <table>
- <thead>
- <tr>
- <th class="first"><?php echo translate("Product"); ?></th>
- <th class="QtyColumn"><?php echo translate("Quantity"); ?></th>
- <th></th>
- <th class="PriceColumn"><?php echo translate("Item price"); ?></th>
- <th class="TotalPriceColumn last"><?php echo translate("Total price"); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- $sc_info = $wpdb->get_results("SELECT * FROM es_sc WHERE SessionID = '".session_id()."'");
- $productexists = 0;
- $grandtotalprice = 0;
- $grandtotalshipping = 0;
- $grandtotal = 0;
- $itemnr = 1;
- foreach($sc_info as $sc) {
- $prodname = $wpdb->get_var($wpdb->prepare("SELECT post_title FROM ".$wpdb->prefix."posts WHERE ID = ".$sc->ProdID));
- $prodprice = $wpdb->get_var($wpdb->prepare("SELECT Price FROM es_products WHERE PostID = ".$sc->ProdID));
- $prodshipping = $wpdb->get_var($wpdb->prepare("SELECT ShippingCost FROM es_products WHERE PostID = ".$sc->ProdID));
- $totalprice = $prodprice*$sc->Qty;
- $totalshipping = $prodshipping;
- $grandtotalprice = $grandtotalprice+$totalprice;
- $grandtotalshipping = $grandtotalshipping+$totalshipping;
- if ($itemnr%2 == 1) {
- ?>
- <tr class="odd">
- <?php
- } else {
- ?>
- <tr class="even">
- <?php } ?>
- <td><?php echo '<a href="'.get_permalink($sc->ProdID).'">'.$prodname.'</a>'; ?></td>
- <td class="QtyColumn"><input type="text" class="Qty" value="<?php echo $sc->Qty; ?>" name="Qty_<?php echo $sc->ProdID; ?>" /></td>
- <td class="PriceText"><?php echo translate("Product price"); ?><br/><?php echo translate("Shipping cost"); ?></td>
- <td class="PriceColumn"><?php echo get_currency().number_format($prodprice,2, '.', ','); ?><br/><?php echo get_currency().number_format($prodshipping,2, '.', ','); ?></td>
- <td class="TotalPriceColumn"><?php echo get_currency().number_format($totalprice,2, '.', ','); ?><br/><?php echo get_currency().number_format($totalshipping,2, '.', ','); ?></td>
- </tr>
- <input type="hidden" name="item_name_<?php echo $itemnr; ?>" value="<?php echo $prodname; ?>" />
- <input type="hidden" name="amount_<?php echo $itemnr; ?>" value="<?php echo get_currency().number_format($prodprice,2, '.', ','); ?>" />
- <input type="hidden" name="quantity_<?php echo $itemnr; ?>" value="<?php echo $sc->Qty; ?>" />
- <input type="hidden" name="shipping_<?php echo $itemnr; ?>" value="<?php echo get_currency().number_format($totalshipping,2, '.', ','); ?>" />
- <?php
- $itemnr++;
- }
- $grandtotal = $grandtotalprice+$grandtotalshipping;
- ?>
- </tbody>
- </form>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement