Author Topic: Order Status Description in Shopper Email (what changed ?)  (Read 763 times)

dirkb

  • Jr. Member
  • **
  • Posts: 74
Hi.

Using latest Joomla and VM 3.4.2

Before, with older versions of VM I could get the order descrption with language override into the shopper mail via override.

Using language override [COM_VIRTUEMART_ORDER_STATUS_EXPECT_PAYMENT_DESC] in description field.

and ... mail_html_shopper.php

<?php echo vmText::_($this->orderDetails['details']['BT']->order_status_description) ; ?>

Now, that seems not to work anymore. With and without editor, resave etc. ... does not show.
How can I achieve that again ?

Any ideas ? The order description is vital for user communication.

thanks d.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3905
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #1 on: May 06, 2019, 17:29:20 pm »
Try to add override in admin + front end for COM_VIRTUEMART_ORDER_STATUS_EXPECT_PAYMENT_DESC
If you change order statut in the admin, the language override key is get from admin

dirkb

  • Jr. Member
  • **
  • Posts: 74
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #2 on: May 07, 2019, 09:16:05 am »
Hi. Thanks for responding.

The issue is not the language Tag itself. If I put [COM_VIRTUEMART_ORDER_STATUS_EXPECT_PAYMENT_DESC] directly in the mail_html_shopper.php, it shows.
But the order description is conditional, I do have 5 different order status, each has its own description. In the order description is the language tag above.

This one I called before with <?php echo vmText::_($this->orderDetails['details']['BT']->order_status_description) ; ?>

That is not working anymore ? Could it be that now virtuemart shows the editor for the order status description (before it did not have the editor there) and therefore modifies the language tag code ?

Hmmm ...lost on that one. Anybody some advice ?

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2235
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #3 on: May 07, 2019, 10:01:01 am »
You have to look it up in the database:
Code: [Select]
// Get the order status description
$order_status = $this->orderDetails['details']['BT']->order_status;
// Get a database connection.
$db = JFactory::getDbo();
$query = 'SELECT `order_status_description` FROM `#__virtuemart_orderstates` WHERE `order_status_code` = ' . $db->quote($order_status);
$db->setQuery($query);
$order_status_description = $db->loadResult();

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

dirkb

  • Jr. Member
  • **
  • Posts: 74
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #4 on: May 07, 2019, 10:15:39 am »
Hi. Also, thanks for your reply.
Not sure what to make with your advice resp. code ?

Do I need to include it top in my mail_html_shopper.php to load the order status description ?


Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3905
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #5 on: May 07, 2019, 12:03:12 pm »
If you need it, then add the code provided by Jorgen before in the same file
But you can create the description using language override.
eg.
Code: [Select]
$order_status_description_key = 'ORDER_STATUS_ '.$this->orderDetails['details']['BT']->order_status.'_DESC';
echo vmText::_($order_status_description_key);


Then you add the language overrides
ORDER_STATUS_ P_DESC="Pending description"ORDER_STATUS_ C_DESC="Cancel description"
....


Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2235
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #6 on: May 07, 2019, 13:25:56 pm »
@patrick
Nice solution, didn´t think about that.

@dirkb
Both our solutions must be wrapped with the vmText exactly as Patrick has shown. That makes Patrick's solution the more elegant one :)

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

dirkb

  • Jr. Member
  • **
  • Posts: 74
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #7 on: May 07, 2019, 13:26:47 pm »
Hi Jörgen und Studio.

I did not get the code from Jörgen to work.
The Tip from Studio 42 worked, kind of, the language constanst showed up, but not the translation.
The order status gets translated, the order status description does not.

See screen attached.

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2235
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #8 on: May 07, 2019, 13:30:27 pm »
Why are You using brackets ? Get rid of them.

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

dirkb

  • Jr. Member
  • **
  • Posts: 74
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #9 on: May 07, 2019, 13:49:28 pm »
Ooops ... not sure where the brackets came from.

Did remove them, but still, the same issue. Could it be that I have to modify the database field type for the order description to display "raw" data ?

See Screen for what I have now. Order Status cap, language override cap and email coming in cap.

I'm lost ?!

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2235
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #10 on: May 07, 2019, 14:51:27 pm »
If You use this line to output :
Code: [Select]
echo vmText::_($order_status_description_key);
Then You should be good.

But I think You have a  somewhere, maybe before the L.

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3905
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #11 on: May 07, 2019, 15:00:06 pm »
If you use this solution
$order_status_description_key = 'ORDER_STATUS_ '.$this->orderDetails['details']['BT']->order_status.'_DESC';
echo vmText::_($order_status_description_key);
Then you need to add the language keys
ORDER_STATUS_X_DESC
Where X is the order_status Key
If the key is not translate in all cases, then you need to add override in Joomla language FRONT+ADMIN overrides!
Because when you generate the order in admin, the admin Keys are used for overrides and not front

dirkb

  • Jr. Member
  • **
  • Posts: 74
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #12 on: May 07, 2019, 15:30:08 pm »
Hi. Again, thanks to both of you for helping.

Below my steps in the screen.

One part of the code at the beginning of the html override.

echo vmText to call it.

Language overrides exists with the Status (L) and for both locations.

Results in the email getting the language constant, not the translation.


Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3905
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #13 on: May 07, 2019, 16:29:37 pm »
Curious, i had never this problem.
Try to replace vmText::_ with  Joomla jText::_

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2235
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Order Status Description in Shopper Email (what changed ?)
« Reply #14 on: May 07, 2019, 16:33:31 pm »
Have you tried to echo the key order_status_.... directly? with vmText of course...I am still guessing you have a hidden character in your key. No trailing or starting blanks either.

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)