Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Simple Solution (hack) for Zone Rates module.


Hutchmeister

Recommended Posts

Hi, I'm really new to OSC so have only been reading this forum for about 3 days so I apologise if this 'solution' has been submitted before [based on UK shop setup, but will apply to any zone/country setup]

 

Problem: When using the Zone Rates module one caveat is that if the upper weight limit for each zone is passed, the shipping method will be offered with ?0.00. The install/help file suggests that to stop people getting free postage one should add a really high weight limit/price entry to the zones shipping table e.g. "999:1000". This is ugly as its very possible that users will see a postage cost of ?1000 one day.

 

My solution: This is a blatant hack, and a bit embarrassing really as it shows my lack of PHP finesse. I figured that instead of showing customers a ?0.00 or ?1000 shipping cost it's way better to show them a message that says something like "A suitable Standard Shipping option could not be found. Please call customer services" and NOT show them a radio button to click.

 

To achieve this I ADDED the following to the 'catalog\includes\languages\english\modules\shipping\zones.php' file (I put it just after the line that defines the 'MODULE_SHIPPING_ZONES_UNDEFINED_RATE'):

 

define('MODULE_SHIPPING_ZONES_ZERO_COST', 'A suitable shipping option could not be found. Please call customer services.');

 

Then in the 'catalog\includes\modules\shipping\zones.php' file I added the line:

 

if ($shipping_cost == 0) {$this->quotes['error'] = MODULE_SHIPPING_ZONES_ZERO_COST;}

 

to this block of code (see line 160 for the new code. Note that your line numbers may differ a bit):

 

155	  $this->quotes = array('id' => $this->code,
156							'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
157							'methods' => array(array('id' => $this->code,
158													 'title' => $shipping_method,
159													 'cost' => $shipping_cost)));
160	  if ($shipping_cost == 0) {$this->quotes['error'] = MODULE_SHIPPING_ZONES_ZERO_COST;}
161	  if ($this->tax_class > 0) {
162		$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
163	  }

 

And that's it. So far its working well here.

 

I use this hack along with this contribution: Additional Shipping Options for Zone Module and therefore apply the hack to all relevant zone modules, but you can use it with the existing 'included' zone rates module that comes with OSC 2.2

 

If anyone has a better way please post it. If not I hope this helps someone! :D

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...