Author Topic: Mail setting according product status not working  (Read 418 times)

psm

  • Jr. Member
  • **
  • Posts: 108
Mail setting according product status not working
« 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

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3673
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Mail setting according product status not working
« Reply #1 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);

psm

  • Jr. Member
  • **
  • Posts: 108
Re: Mail setting according product status not working
« Reply #2 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

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1969
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Mail setting according product status not working
« Reply #3 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
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

psm

  • Jr. Member
  • **
  • Posts: 108
Re: Mail setting according product status not working
« Reply #4 on: July 30, 2018, 13:20:09 pm »
And can be there any troubles when I will use $item->product_in_stock?

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1969
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Mail setting according product status not working
« Reply #5 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
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

psm

  • Jr. Member
  • **
  • Posts: 108
Re: Mail setting according product status not working
« Reply #6 on: July 30, 2018, 19:11:48 pm »
Thanks all, it works prefectly.