The MassAction feature is perfect for what I want to do. I want to send JSON data to my API on the status change of a specific order. So I use the MassAction tool. Everything works fine and I can filter for my product and trigger a PHP script. The script does what it has to.
$url = "https://xyz.test:3535/newCustomerKey";
$user = $this->get($data->order_product_name);
echo $user;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Accept: application/json",
"Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = <<<DATA
{
"key": 123,
"product": "XXX",
"customerEmail": "XXX"
}
DATA;
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($curl);
curl_close($curl);
Now the problem, how can I get the email of the customer from the order? When I echo $this I got "plgSystemHikashopmassaction".
On a custom Email Template i would do something like this: $user_email = @$customer->email;
Is there any way to get the data of the order from my custom script?
For the MassAction I use the trigger After an order is changed and filter on some stuff.
Thanks a lot for the help!