VirtueMart Forum

VirtueMart 2 + 3 => General Questions => Topic started by: psm on July 29, 2018, 20:24:33 pm

Title: Mail setting according product status not working
Post by: psm on July 29, 2018, 20:24:33 pm
Hello,
I am trying to set up messages which will be sent to customer after status of order will be changed (for example pending status).
And I use these two conditions in mail_html_shopper.php:

if (($this->product->product_in_stock) < 1) {
if (($this->product->product_in_stock) >= 1) {

But it is not working. When I use echo to show value of product stock, it shows nothing.

Please could you help me with this problem?

Thanks
Title: Re: Mail setting according product status not working
Post by: Studio 42 on July 30, 2018, 02:16:06 am
Are you sure that $this->product exist ?
The lood to get product in items list is :
foreach($this->orderDetails['items'] as $item) {

}
$item->product_in_stock can give you the result. But you should use a plugin and not check here the result.
You can use a shipment plugin and trigger function plgVmOnUpdateOrderShipment'(&$data,$old_order_status);
Title: Re: Mail setting according product status not working
Post by: psm on July 30, 2018, 10:42:13 am
Thank you, I do not have so many skills with virtuemart and php programming. Could you please explain me how to get product stock info from this function plgVmOnUpdateOrderShipment'?

Thanks
Title: Re: Mail setting according product status not working
Post by: Jörgen on July 30, 2018, 11:17:05 am
plgVmOnUpdateOrderShipment is not a function that gives You any feedback. It is a function that gets triggered in a plugin för virtuemart shipment. Writing a plugin is not very hard, but needs some programming skills.

regards

Jörgen @ Kreativ Fotografi
Title: Re: Mail setting according product status not working
Post by: psm on July 30, 2018, 13:20:09 pm
And can be there any troubles when I will use $item->product_in_stock?
Title: Re: Mail setting according product status not working
Post by: Jörgen on July 30, 2018, 13:43:09 pm
It should work for your email. I do not why it shouldn't.
Jörgen @ Kreativ Fotografi
Title: Re: Mail setting according product status not working
Post by: psm on July 30, 2018, 19:11:48 pm
Thanks all, it works prefectly.