function XML2JSON($xml)
{
    $result = array("ack" => (string) $xml->ack, "resultCount" => (string) $xml->paginationOutput->totalEntries, "pageNumber" => (string) $xml->paginationOutput->pageNumber, "itemCount" => (string) $xml->paginationOutput->entriesPerPage);
    $itemNum = (int) $xml->searchResult[0]['count'];
    for ($i = 0; $i < $itemNum; $i++) {
        $basicInfo = basic($xml, $i);
        $sellerInfo = seller($xml, $i);
        $shippingInfo = shipping($xml, $i);
        $info = array("basicInfo" => $basicInfo, "sellerInfo" => $sellerInfo, "shippingInfo" => $shippingInfo);
        $item = array("item" . $i => $info);
        $result = array_merge($result, $item);
    }
    echo json_encode($result);
}
function generateCartList($dbAdapter)
{
    if (!isset($_SESSION["Cart"])) {
        echo '<h1> No Items in your Cart. </h1>';
    } else {
        echo '<table class="table">
				<tr style="border-bottom:2px solid #596a7b" width="100%">
					<th>Image</th>
					<th>Title</th>
					<th>Size</th>
					<th>Stock</th>
					<th>Quantity</th>
					<th>Frame</th>
					<th>Cost</th>
				</tr>';
        //outputs the cart items from the Session.
        $sub = displayCartItems($dbAdapter);
        //outputs subtotal.
        $sub = number_format((double) $sub, 2, '.', '');
        echo '</table>';
        echo '<div class = "pull-right">';
        echo '<form action = "browse-cart.php?cart=clear" method="GET">';
        echo '<input type = "hidden" name = "cart" value = "clear">';
        echo '<button type="submit" class="btn btn-primary">Remove Entire Cart</button>';
        echo "</form>";
        echo '</div><br>';
        echo '<hr>';
        echo '<h3 class = "pull-right">SubTotal</h3>';
        echo "<div>";
        echo "<h2>Shipping Options</h2><br>";
        echo '<div id = "sub1" class = "pull-right">$' . $sub . '</div>';
        echo '<form action = "browse-cart.php" method="GET">';
        // calls shipping function to calculate shipping cost.
        $shipCost = shipping($sub);
        echo '</form>';
        echo "</div>";
        echo "<hr>";
        //outputs total cost.
        echo "<div class = 'pull-right'><h3>Total</h3><div id = 'total'>\$" . calcTotal($sub, $shipCost) . "</div></div><br>";
        echo '<form action = "index.php" method = "POST">';
        echo '<button type = "submit" class="btn btn-primary">Continue Shopping</button>';
        echo '</form>';
        echo '<br><button class="btn btn-primary">Check Out</button>';
        echo "</div>";
    }
}
Beispiel #3
0
 /**
  * calculate every delivery for order
  * @param type $order
  * @param type $pretend
  * @return type
  */
 public function calculateEveryDelivery($order, $pretend)
 {
     $saveContentPrice = $order->content_price;
     $saveDeliveryPirce = $order->delivery_price;
     $calculations = array();
     foreach (shipping(app('veer')->siteId) as $method) {
         $order->delivery_method_id = $method->id;
         $order = $this->recalculateOrderDelivery($order, $method, $pretend);
         $calculations[$method->id] = array("method" => $method->toArray(), "delivery_price" => $order->delivery_price, "delivery_hold" => $order->delivery_hold, "delivery_free" => $order->delivery_free, "content_price_change" => $order->content_price - $saveContentPrice);
         $order->content_price = $saveContentPrice;
         $order->delivery_price = $saveDeliveryPirce;
     }
     return $calculations;
 }
 @($TotalCoupon += $discount1);
 if ($DataCustomers[13] == $setup[2]) {
     @($ShippingFile = $AdminFolder . '/db/shipping/' . $setup[2] . '.dat');
 } elseif (in_array($DataCustomers[13], $multi_country)) {
     foreach ($multi_country as $value) {
         if ($value == $DataCustomers[13]) {
             @($ShippingFile = $AdminFolder . '/db/shipping/' . $value . '.dat');
         }
     }
 } else {
     @($ShippingFile = $AdminFolder . '/db/shipping/international.dat');
 }
 if (@$setup[0] == 2 && $weight != 'null') {
     $sc = shipping($total_weight, $ShippingFile);
 } else {
     $sc = shipping($total, $ShippingFile);
 }
 $ShippingMode = explode(',', $sc[5]);
 $ShippingPrice = explode(',', $sc[6]);
 @($nb = $_POST['shipping_mode']);
 if (!empty($sc[1]) && !empty($sc[2])) {
     $shipping = isset($_POST['shipping_mode']) ? $ShippingPrice[$nb] : $ShippingPrice[0];
     $shipmode = isset($_POST['shipping_mode']) ? $ShippingMode[$nb] : $ShippingMode[0];
 }
 $DigitalProduct[] = $digital;
 $FormatTotal = number_format($total, 2, '.', ',');
 echo " <tr>\n";
 echo " <td valign=\"top\" nowrap class=\"bord\" width=\"60\"><div align=\"center\"><img src=\"th_images/th_{$id_item}.jpg\" border=\"0\" align=\"top\" width=\"60\" OnError=\"this.src='img/noimage.jpg';\"></td>\n";
 echo " <td valign=\"top\" nowrap class=\"bord\"><div align=\"center\"><strong>{$title}</strong>";
 if ($option1 != "null") {
     echo '<br>' . $option1;