How to run an action whenever the status of an order is updated?

Started by BSemog, September 07, 2020, 12:33:14 PM

Previous topic - Next topic

BSemog

Hello. I have a component in _admin and i want to run an action whenever the status of an order is updated. What's the best way to do this?

Jörgen

Cron job, plugin... your question ceratinly needs some more explantion.

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

pinochico

For this we have plugin, which change
- status
- description
- pay or not

But you can develop another solution - as wrote Jörgen
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

BSemog

We have a component that is responsible for sending the order details to our platform.
Right now, the user has access to a table with the orders listed where he can click to send us the order details.
What we want, is to have this process done automatically after the order status change (or after a payment happens).
I would love to not use cron jobs or having to create a plugin inside the component, since this will be installed in multiple stores.
Is there anyway of having a hook for example that calls a function inside our component?

GJC Web Design

Just use the triggers provided in VM

when an order status changes it triggers  plgVmOnUpdateOrderPayment()

have a vmcustom or system plugin with

e.g.

   function plgVmOnUpdateOrderPayment ($data,$old_order_status) {
      $status = $this->params->get('status', 'C'); // plugin param
      if($data->order_status==$status){
                    // start doing things
               }
       }


GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

pinochico

Dont forget about this (I think maybe can be problem):

- the system plugins is loaded before payments plugin
- after trigger payments plugin (order is pay), then I think not loaded your custom system plugin again
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products