Adding a MessageStack
Posted: Sat Mar 13, 2010 6:33 am
Hi,
I have the following portion of a php file on a website (Zen Cart) that displays a freight charge for given weights and location
Basically the module is displays a freight charge if the weight is over 20.0999 Kgs...
What I also want it to do is, if the weight of the order exceeds 40Kgs, display a message such as "Please Contact us for an Estimate of Freight"
I have asked on the Zen Cart forum and was offered the following as a possibility to be included in the file...
But I can't seem to get it to work, so I have landed on this forum in the hope that someone here can.
Regards,
Mike
I have the following portion of a php file on a website (Zen Cart) that displays a freight charge for given weights and location
Code: Select all
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() < 20.09999999) {
$this->enabled = false;
} else {
$this->enabled = true;
}
if ($this->enabled == true) {
$this->dest_zone = 0;
for ($i=1; $i<=$this->num_zones; $i++) {
if ((int)constant('MODULE_SHIPPING_ZONETABLE_ZONE_' . $i) > 0) {
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . constant('MODULE_SHIPPING_ZONETABLE_ZONE_' . $i) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$this->dest_zone = $i;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$this->dest_zone = $i;
break;
}
$check->MoveNext();
} // end while
} // END if ((int)constant('MODULE_SHIPPING_ZONETABLE_ZONE_' . $i) > 0)
} // END for ($i=1; $i<=$this->num_zones; $i++)
if ($this->dest_zone < 1) {
$this->enabled = false;
}
} // END if ($this->enabled == true)
} // END function zonetable()
/**
* Enter description here...
*
* @param unknown_type $method
* @return unknown
What I also want it to do is, if the weight of the order exceeds 40Kgs, display a message such as "Please Contact us for an Estimate of Freight"
I have asked on the Zen Cart forum and was offered the following as a possibility to be included in the file...
Code: Select all
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() < 20.09999999) {
$this->enabled = false;
} elseif ($_SESSION['cart']->show_weight() > 40.0) {
global $messageStack;
$messageStack->add_session('Please contact us for an estimate');
$this->enabled = false;
}
else {
$this->enabled = true;
}
Regards,
Mike