Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change to the flat rate shipping module


toptiara

Recommended Posts

Posted

OK, so I have my shipping information ready to install, but I also want to offer free First Class by Royal Mail to all UK based customers. I decided to use the existing flat rate shipping module which is already in place as this is easier than putting a new one in :)

 

So, I set the flat rate to 0, but this is now available to everyone who uses the store, not just those who live in the UK.

 

If I open up the flat.php file, I can see this query which I need to change :

 

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {

$check_flag = false;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");

while ($check = tep_db_fetch_array($check_query)) {

if ($check['zone_id'] < 1) {

$check_flag = true;

break;

} elseif ($check['zone_id'] == $order->delivery['zone_id']) {

$check_flag = true;

break;

}

}

 

Its looking up Zone values from the zone table. I am assuming changing this query to pick up Country values from the country table and then just selecting UK from within admin would do what I want?

 

Does anybody happen to know what I need to change the above query to which would accomplish this please?

 

Thanks

Hand made jewellery and tiaras on our website

 

Please bear with me. Im an osC noobie!

Posted

Change the

 

$order->delivery['country']['id']

 

To be the ID of the country you desire (UK). Replace UK_ID below with the ID in the countries table.

 

 if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = 'UK_ID' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
}

 

This isn't tested, so be sure to backup.

Contributions

 

Discount Coupon Codes

Donations

Posted
Change the

 

$order->delivery['country']['id']

 

To be the ID of the country you desire (UK). Replace UK_ID below with the ID in the countries table.

 

 if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = 'UK_ID' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
}

 

This isn't tested, so be sure to backup.

 

Thanks. Tried that, but sadly it didn't work :(

 

Any other ideas please anyone?

Hand made jewellery and tiaras on our website

 

Please bear with me. Im an osC noobie!

Posted
Thanks. Tried that, but sadly it didn't work :(

 

Any other ideas please anyone?

 

Never mind I'm an idiot.

 

Found out you can add the country to a geographical zone and use that instead just by configuring the admin :)

Hand made jewellery and tiaras on our website

 

Please bear with me. Im an osC noobie!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...