Jump to content



Photo

Problem with postcode based shippiong module


  • Please log in to reply
No replies to this topic

#1   alba

alba
  • Members
  • 107 posts
  • Real Name:alba

Posted 15 May 2010 - 12:11

I have a module that for some reason has stopped working and im unable to determine why

The code grabs the shipping postcode and then grabs data from a database to populate some variables used in the shipping calulation

for some reason this no longer works

$topcode = $order->delivery['postcode'];

if ( $topcode == '' ){
// Something is wrong, we didn't find any zone
	$this->quotes['error'] = MODULE_SHIPPING_POSTSHIP_NO_POSTCODE_FOUND;
        return $this->quotes;
}

$qResult = tep_db_query("select * from postship_zones where '$topcode' >= s_postcode and '$topcode.' <= s_postcode") ; 
$rec = tep_db_fetch_array($qResult); 

    if ($rec['s_delivery'] = '0') {
	$days = 'same';
	}
    if ($rec['s_delivery'] = '1') {
	$days = 'next';
	} else {
	$days = $rec['s_delivery'];
}

        $dest_zone = $rec['s_zone'];
        $zones_base = constant('MODULE_SHIPPING_ZONE_' . $dest_zone . '_BASE');
        $zones_rate = constant('MODULE_SHIPPING_ZONE_' . $dest_zone . '_RATE');
        $zones_handling = constant('MODULE_SHIPPING_ZONE_' . $dest_zone . '_HANDLING');
        $zones_fuel = constant('MODULE_SHIPPING_ZONE_' . $dest_zone . '_FUEL');
	$zones_fuel_levy = $zones_fuel+1;

I i run this sql statement in phpmyadmin it returns the correct data.

If i try and echo these variables in the checkout_shipping.php to debug, they dont work.

Having said that as an experiment I moved this code to near the top of checkout_shipping.php and ran it and my echo statement returned all the variables.

does anyone have any idea whats not right here?

Edited by alba, 15 May 2010 - 12:12.