if ($eachServiceVal != "" && $charge != "") { $resultShippingArray[$product_option_id][] = array("service_name" => $eachServiceVal, "rate" => $charge); } } } break; case 'CP': //echo "entered CP"; $cPost = new CanadaPost(); $cPost->setPrice($product_price); $cPost->setCustomer(array('city' => '', 'provOrState' => $destination_state, 'country' => $destination_country, 'postalCode' => $destination_zip)); $shipping_weight . $product_length . $product_width . $product_height; $cPost->addProduct(array('quantity' => $quantity, 'weight' => $shipping_weight, 'length' => $product_length, 'width' => $product_width, 'height' => $product_height, 'description' => 'Product Description')); // echo "CPPPPP"; $assoc_Array = array(); $assoc_Array[$product_option_id] = $cPost->getRates('array'); //echo $cPost->getErrorMessage(); if ($cPost->getErrorMessage() == "success") { foreach ($assoc_Array[$product_option_id]['product'] as $canShipping) { if ($canShipping['name'] != "" && $canShipping['rate'] != "") { $resultShippingArray[$product_option_id][] = array("service_name" => $canShipping['name'], "rate" => $canShipping['rate']); } } } break; case 'Flat Rate': $queryFlatRate = "SELECT * FROM " . $tableprefix . "flat_rate_seller WHERE seller_id ='" . $artist_id . "'"; $queryFlatRateQ = mysql_query($queryFlatRate); if (mysql_num_rows($queryFlatRateQ) == 0) { $queryFlatRate = "SELECT * FROM " . $tableprefix . "flat_rate_default"; $queryFlatRateQ = mysql_query($queryFlatRate);
echo time(); ?> " /> <input type="submit" name="submit" value="Estimate" /> <input type="button" name="close" onclick="javascript:window.close();" value="Close Window" /> </form> </div> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { if (isset($_POST['ttime'])) { require_once "class.canadapost.php"; $cPost = new CanadaPost(); $cPost->setPrice($_POST['price']); $cPost->setCustomer(array('city' => $_POST['city'], 'provOrState' => $_POST['prov'], 'country' => $_POST['country'], 'postalCode' => $_POST['postal'])); $cPost->addProduct(array('quantity' => $_POST['quantity'], 'weight' => $_POST['weight'], 'length' => $_POST['length'], 'width' => $_POST['width'], 'height' => $_POST['height'], 'description' => ' ')); $assoc_Array = $cPost->getRates('array'); if ($assoc_Array === false) { echo 'Error: ' . $cPost->getErrorMessage(); } else { // echo "<pre>"; // var_dump( $assoc_Array ); // echo "</pre>"; ?> <div style="border-bottom: solid 1px #ccc; height: 5px; margin-bottom: 5px;"></div> <div class="shippingRatesDivHeader"> <div><strong> Shipping Type </strong></div> <div><strong> Rate ($) </strong></div> <div><strong> Est. Shipping Date </strong></div> <div><strong> Est. Delivery Date </strong></div> <div class="clear"></div> </div>