Mass action filters

  • Posts: 197
  • Thank you received: 13
1 year 8 months ago #349036

-- 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 ?

Please Log in or Create an account to join the conversation.

  • Posts: 82584
  • Thank you received: 13293
  • MODERATOR
1 year 8 months ago #349038

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:

<?php var_dump($_REQUEST);
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
$_REQUEST['data']['order']['product']['order_product_id']
with the order_product_id of the product being deleted and you also need to check that
$_REQUEST['data']['order']['product']['order_product_quantity']
is set to 0. If it's not 0, then the quantity of the product might be changing (or not).

The following user(s) said Thank You: khashiz

Please Log in or Create an account to join the conversation.

  • Posts: 197
  • Thank you received: 13
1 year 8 months ago #349065

this was exactly the code i was looking for.

thank you very much

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum