diff --git a/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini b/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini index 35b3253f3930e2222461cec1458558714db3ea1e..1c19d7bb062565f0d2c43b21aafa1a1a91ee85e1 100644 --- a/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini +++ b/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini @@ -56,3 +56,5 @@ VMSHIPMENT_RULES_EVALUATE_UNKNOWN_VALUE="Evaluation yields unknown value while e VMSHIPMENT_RULES_EVALUATE_LISTFUNCTION_ARGS="List function '%s' requires all arguments to be lists. (Full rule: '%s')" VMSHIPMENT_RULES_EVALUATE_LISTFUNCTION_UNKNOWN="Unknown list function '%s' encountered. (Full rule: '%s')" + +VMSHIPMENT_RULES_NOSHIPPING_MESSAGE="%s" diff --git a/rules_shipping_base.php b/rules_shipping_base.php index 422b795ab8f482afb8062da6de8888aa2e238069..c2e233bb77df4e48ebf61083b58af063e9f8ad2d 100644 --- a/rules_shipping_base.php +++ b/rules_shipping_base.php @@ -29,6 +29,9 @@ if (class_exists ('plgVmShipmentRules_Shipping_Base')) { return; } +// Keep track of warning messages, so we don't print them twice: +$printed_warnings = array(); + /** Shipping costs according to general rules. * Supported Variables: Weight, ZIP, Amount, Products (1 for each product, even if multiple ordered), Articles * Assignable variables: Shipping, Name @@ -58,6 +61,16 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { public function getVmPluginCreateTableSQL () { return $this->createTableSQL ('Shipment Rules Table'); } + + public function printWarning($message) { + global $printed_warnings; +// JFactory::getApplication()->enqueueMessage("<pre>warnings so far are:".print_r($printed_warnings,1). ", new warning: |$message|</pre>", 'warning'); + if (!in_array($message, $printed_warnings)) { + JFactory::getApplication()->enqueueMessage($message, 'error'); + $printed_warnings[] = $message; + } + + } /** * @return array @@ -534,6 +547,7 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { $method->rule_name = $r->getRuleName($cartvals); // If NoShipping is set, this method should NOT offer any shipping at all, so return FALSE, otherwise TRUE if ($r->isNoShipping()) { + $this->printWarning(JText::sprintf('VMSHIPMENT_RULES_NOSHIPPING_MESSAGE', $method->rule_name)); vmdebug('checkConditions '.$method->shipment_name.' indicates NoShipping for rule "'.$method->rule_name.'" ('.$r->rulestring.').'); return FALSE; } else {