mc12345678:
Arrggh, won't show me the content to edit:
Quote Originally Posted by Podgeminster View Post
Tried this mod – works perfectly for orders of £100 and over which qualify for free shipping – deactivates the flat rate option when the free option is available.
However, if the total order value is below £100 and qualifies for the Flat Rate shipping of £4.15 only, neither the free or flat rate options are displayed on the Delivery Information page but the message “Sorry, we are not shipping to your region at this time. Please contact us for alternate arrangements.” is shown.
Sorry, restore includes/modules/shipping/flat.php to the way it was then modify the following:
// class methods
function quote($method = '') {
global $order;
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLAT_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}
> to:
> ```
// class methods
function quote($method = '') {
global $order;
if (IS_ADMIN_FLAG !== true && $this->enabled == true && isset($GLOBALS['freeoptions']) && $GLOBALS['freeoptions']->enabled) {
$this->enabled = false;
return false;
}
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLAT_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}
This is needed because really the module can't be determined to need to be disabled until the other module has had an opportunity to determine a quote. Previous would identify that the module was enabled (as set in the admin basically), but hadn't had an opportunity to determine if a quote should be provided at all from it.
Aggrivating as all to figure out, but finally did. Needed one more factor in the new if statement:
Changing the base code of:
// class methods
function quote($method = '') {
global $order;
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLAT_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}
to:
// class methods
function quote($method = '') {
global $order;
if (IS_ADMIN_FLAG !== true && $this->enabled == true && isset($GLOBALS['freeoptions']) && $GLOBALS['freeoptions']->enabled[B] && $method == ''[/B]) {
$this->enabled = false;
return false;
}
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLAT_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}
This way when a specific method has been identified to obtain a quote, the module will remain active for processing which is basically what was going on when trying to submit the flat rate method.
Totally tested this and the above worked for all conditions attempted (slightly exceeded the threshold to show freeoptions and flat was disabled, slightly less than the cutoff and of the two only flat showed...