Zen Cart Logo
Forums / Bug Reports / No TEXT_OPTION_DIVIDER in email

No TEXT_OPTION_DIVIDER in email

Views: 3,096

Results 1 to 10 of 10
16 Sep 2019, 09:29
#1
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

No TEXT_OPTION_DIVIDER in email

ZC v1.5.6c

In the order confirmation email (email_template_checkout.html) there is no TEXT_OPTION_DIVIDER between the products attribute name and products attribute value as there is on pages such as tpl_shopping_cart_default.php & tpl_account_history_info_default.php

in /includes/classes/order.php line #932 I would like to change

$this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);

to

 $this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . TEXT_OPTION_DIVIDER . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);

whilst adding the following to the end of includes/languages/english/email_extras.php

// Attribute separator in emails
define('TEXT_OPTION_DIVIDER', ' - ');

If someone could confirm that this fix is appropriate I would be happy to submit a PR

16 Sep 2019, 12:34
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: No TEXT_OPTION_DIVIDER in email

Does it provide the results you are expecting for both text and html style emails?

There may need to be some sort of substitution performed to support one or the other side as I suspect that a text only email will display that divider text as defined...

16 Sep 2019, 12:46
#3
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: No TEXT_OPTION_DIVIDER in email

mc12345678:

Does it provide the results you are expecting for both text and html style emails?

There may need to be some sort of substitution performed to support one or the other side as I suspect that a text only email will display that divider text as defined...

Ah yes, I hadn't considered the text-only requirement. I had been just looking at the source of an HTML email - which seems to contain both a text and an html portion, both of which had the desired result.

However, does not work in a text-only email. I'll look in to this some more.

16 Sep 2019, 12:50
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: No TEXT_OPTION_DIVIDER in email

I'd suggest that the language define be put into checkout_process.php instead of email_extras.php, to prevent warnings about duplicate defines.

16 Sep 2019, 12:52
#5
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: No TEXT_OPTION_DIVIDER in email

DrByte:

I'd suggest that the language define be put into checkout_process.php instead of email_extras.php, to prevent warnings about duplicate defines.

Thank you, I was looking for a suitable language file - I'll try that.

16 Sep 2019, 13:05
#6
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: No TEXT_OPTION_DIVIDER in email

Thanks to DrByte's suggestion to use a different language file the Divider now appears in both HTML and Text-only emails. To summarise:

This is the new code in /includes/classes/order.php line #932

 $this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . EMAIL_TEXT_OPTION_DIVIDER . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);

and added to includes/languages/english/checkout_process.php

define('EMAIL_TEXT_OPTION_DIVIDER', ' - ');
16 Sep 2019, 13:08
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: No TEXT_OPTION_DIVIDER in email

I'd drop the EMAIL_ prefix from the constant, since the same definition is used in other places for the same purpose, so consistency is beneficial.

16 Sep 2019, 13:10
#8
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: No TEXT_OPTION_DIVIDER in email

DrByte:

I'd drop the EMAIL_ prefix from the constant, since the same definition is used in other places for the same purpose, so consistency is beneficial.

Ok, will do.

16 Sep 2019, 18:06
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: No TEXT_OPTION_DIVIDER in email

simon1066:

Thanks to DrByte's suggestion to use a different language file the Divider now appears in both HTML and Text-only emails. To summarise:

This is the new code in /includes/classes/order.php line #932

$this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . EMAIL_TEXT_OPTION_DIVIDER . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);

> 
> and added to includes/languages/english/checkout_process.php
> 
> ```
define('EMAIL_TEXT_OPTION_DIVIDER', ' - ');

So in a text only email there is no visible: ```
 - 

16 Sep 2019, 18:19
#10
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: No TEXT_OPTION_DIVIDER in email

mc12345678:

So in a text only email there is no visible:  - , but instead it appears in the text only email as a space with a dash and another space?

Yes, that is so.