You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Returning false from plgVmOnUpdateOrderShipment does nothing

Started by velosipedist, July 27, 2016, 02:17:12 AM

Previous topic - Next topic


I have written shipment plugin that may cancel order status changing for certain reasons.

I expect that returning false on plgVmOnUpdateOrderShipment should prevent order saving, as it happens in false return from plgVmOnUpdateOrderPayment.

But for version 3.0.16 administrator\components\com_virtuemart\models\orders.php has following implementation:

// ... line 768
$_dispatcher = JDispatcher::getInstance(); //Should we add this? $inputOrder
$_returnValues = $_dispatcher->trigger('plgVmOnUpdateOrderShipment',array(&$data,$old_order_status));

// Payment decides what to do when order status is updated
$_dispatcher = JDispatcher::getInstance(); //Should we add this? $inputOrder
$_returnValues = $_dispatcher->trigger('plgVmOnUpdateOrderPayment',array(&$data,$old_order_status));
foreach ($_returnValues as $_returnValue) {
if ($_returnValue === true) {
break; // Plugin was successfull
} elseif ($_returnValue === false) {
return false; // Plugin failed
// Ignore null status and look for the next returnValue

First $_returnValues just rewritten with next event results.

I suppose that both event result sets should be merged and if any of them contains false, then order saving will be canceled.


Thank you, interesting.

Yes, I plan for vm3.2 or vm4 to combine the triggers. We would need to add the foreach also for the shipment trigger, but I fear problems with older plugins.
Should I fix your bug, please support the VirtueMart project and become a member
Extensions approved by the core team:

GJC Web Design


Could u give an example when it would be useful to block a confirm by this function?
The conditions routine is triggered on every cart change so where would this further check be used?
GJC Web Design
VirtueMart and Joomla Developers - php developers
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
Contact for any VirtueMart or Joomla development & customisation


I am using a shipment plugin to send my order to an external service. But I want to only update the order status if this service sends an status 200 (succeeeded) back. Now I tried using the return false if the error code is not 200 so the status wont get updated but that is still not working? Is that correct?

How can I make sure the order wont get changed?

public function plgVmOnUpdateOrderShipment($data,$old_status,$inputOrder){

$method = $this->getVmPluginMethod ($data->virtuemart_shipmentmethod_id);
if (!$this->selectedThisElement ($method->shipment_element)) {
return ;

if($old_status==$method->order_status){ // already order is created

// return ;



return false;
} else {
return true;



Or do i need to update the order status back to the old order status? With the updateStatusForOneOrder function?

EDIT: Unfortunately this runs before the status gets updated, so the initial status change overrides this one in the shipment. (So I change it to C in the admin, this plugin sets it to P, because the SendOrderToPaazl returns false, but instead of ending it there it eventually changes it to C regardless.  Does anyone know how to make this work.. I just want the order to not change when the SendOrderToPaazl returns false or error 200...


i was also working on that problem. Lets find together the new core code we need here, maybe I did already for the payments you may checkout vm4.2. I sent you a pn
Should I fix your bug, please support the VirtueMart project and become a member
Extensions approved by the core team: