- Posts: 240
- Thank you received: 13
Mass action filters
3 years 7 months ago #349036
by khashiz
Mass action filters was created by khashiz
-- HikaShop version -- : 4.7
-- Joomla version -- : 4.2.7
-- PHP version -- : 8.1
hi
i tried to create a mass action but i didnt managed to
i use mass actions to run a php script to send a sms message to customers when an order is created or updated.
now i want to create a mass action to run that script when an item is deleted from order. supose that the order has 5 items and admin deletes one of the products called "XXX"
I dont know how to get the name "XXX" of that specific product in my php script. can you help me with that ?
-- Joomla version -- : 4.2.7
-- PHP version -- : 8.1
hi
i tried to create a mass action but i didnt managed to
i use mass actions to run a php script to send a sms message to customers when an order is created or updated.
now i want to create a mass action to run that script when an item is deleted from order. supose that the order has 5 items and admin deletes one of the products called "XXX"
I dont know how to get the name "XXX" of that specific product in my php script. can you help me with that ?
Please Log in or Create an account to join the conversation.
3 years 7 months ago #349038
by nicolas
Replied by nicolas on topic Mass action filters
Hi,
I suppose you'll want to use the same trigger "After an order has been updated" in your mass action.
In your action's code, you could look at the values in $_REQUEST.
There, you'll find the controller with the key "ctrl", the task with the key "task", etc
I would recommend you start with this PHP code in your mass action:
That way, you'll get a list of all the data passed by the browser to the server when an order is being modified and you can then adapt your code to get the information you need for your checks etc.
For example, when a product is deleted from an order, the ctrl key will have the value "order", the task key will have the value saveproduct. Then, you'll have
with the order_product_id of the product being deleted and you also need to check that
is set to 0. If it's not 0, then the quantity of the product might be changing (or not).
I suppose you'll want to use the same trigger "After an order has been updated" in your mass action.
In your action's code, you could look at the values in $_REQUEST.
There, you'll find the controller with the key "ctrl", the task with the key "task", etc
I would recommend you start with this PHP code in your mass action:
Code:
<?php var_dump($_REQUEST);
For example, when a product is deleted from an order, the ctrl key will have the value "order", the task key will have the value saveproduct. Then, you'll have
Code:
$_REQUEST['data']['order']['product']['order_product_id']
Code:
$_REQUEST['data']['order']['product']['order_product_quantity']
The following user(s) said Thank You: khashiz
Please Log in or Create an account to join the conversation.
3 years 7 months ago #349065
by khashiz
Replied by khashiz on topic Mass action filters
this was exactly the code i was looking for.
thank you very much
thank you very much
Please Log in or Create an account to join the conversation.
Time to create page: 0.280 seconds