News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Order Status Description in Shopper Email (what changed ?)

Started by dirkb, May 06, 2019, 13:24:27 PM

Previous topic - Next topic

dirkb

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

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

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

You have to look it up in the database:
// 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.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

dirkb

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

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.
$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

@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.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

dirkb

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

Why are You using brackets ? Get rid of them.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

dirkb

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

If You use this line to output :
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.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

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

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

Curious, i had never this problem.
Try to replace vmText::_ with  Joomla jText::_

Jörgen

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.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.