jpmad4it Posted February 29, 2008 Posted February 29, 2008 Hi there I am using this mod: http://addons.oscommerce.com/info/2367 It is the latest version World Zones 2.0. I have been trying to experiment with the code in includes/modules/shipping/worldzones.php I wish to say that if the country ISO code equals 'GB' and the cart quantity is greater than or equal to 2, then shipping is free. I have this code so far: // elari - Added to select default country if not in listing if ($dest_zone == 0) { $dest_zone = $this->num_zones; // the zone is the lastest zone avalaible } // elari - Added to select default country if not in listing if ($dest_zone == 0) { $error = true; // this can no more achieve since by default the value is set to the max number of zones } else { $shipping = -1; $zones_cost = constant('MODULE_SHIPPING_WORLDZONES_COST_' . $dest_zone); //THIS IS MY MODIFICATION for ($i=0, $n=sizeof($products); $i<$n; $i++) { global $cart, $order; $products = $cart->get_products(); $Qty = $products[$i]['quantity']; } if ($Qty > 2 && $dest_country == 'GB'){ $zones_cost = 0; } // Alane - Begin percent mod if (MODULE_SHIPPING_WORLDZONES_MODE == 'percent'){ $shipping = $order_total * $zones_cost; $shipping_method = MODULE_SHIPPING_WORLDZONES_TEXT_WAY . ' ' . $order->delivery['country']['title'] . ': ' .MODULE_SHIPPING_WORLDZONES_TEXT_MODE; if ($shipping_num_boxes > 1) { $shipping_method .= $shipping_num_boxes . 'x '; } } else { // Alane - End percent mod I am trying to get the cart quantity here, and set that number to the variable $Qty. The variable $dest_country is set earlier in the file (I think) My code is the part under the comment //THIS IS MY MODIFICATION. I placed the other code here so that you could see where in the file I have placed it. Any ideas anyone? As this isn't working for me :-( kind regards Jp Quote
satish Posted February 29, 2008 Posted February 29, 2008 $Qty = $products[$i]['quantity']; should be $Qty += $products[$i]['quantity']; Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
jpmad4it Posted March 1, 2008 Author Posted March 1, 2008 hmmmm, that didnt work either i'm afraid. Any other ideas? Quote
jpmad4it Posted March 3, 2008 Author Posted March 3, 2008 hmmmm, that didnt work either i'm afraid. Any other ideas? Does anyone at all have an inkling? :blush: Quote
jpmad4it Posted March 3, 2008 Author Posted March 3, 2008 Make sure that $dest_country is actually doing anything.... Off the top of my head, this looks more useful; if (($cart->count_contents() > 2) && $order->delivery['country']['title'] == 'GB'){ $zones_cost = 0; } You can get rid of this, I think; for ($i=0, $n=sizeof($products); $i<$n; $i++) { global $cart, $order; $products = $cart->get_products(); $Qty = $products[$i]['quantity']; } This did the trick: if (($cart->count_contents() >= 2) && $dest_country == 'GB'){ $zones_cost = 0; } As $dest_country is set to $order->delivery['country']['iso_code_2']; earlier in the code! Thanks very much :lol: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.