payment provider name html entities not processed in text email messages
ZC 1.5.6c, One Page Checkout 2.3.1, PHP 7.3.15.
Last night I had to add some details to the payment provider names on the payment checkout page, in order to specify limitations on which cards could be handled. HTML elements/tags like span and br work fine, but I found that if I write an apostrophe (') as an HTML entity then this appears verbatim in the email message to the customer for the order, although the apostrophe is correctly shown on the web page.
I assume not all strings are intended to include HTML code, but on the other hand, it is not clear if these should be written directly or with HTML entities.
The relevant strings I have used are:
MODULE_PAYMENT_PAYPALWPP_MARK_BUTTON_TXT in
includes/languages/LANGUAGE/modules/payment/paypalwpp.php
and
MODULE_PAYMENT_SQUARE_TEXT_CATALOG_TITLE in
includes/languages/LANGUAGE/modules/payment/square.php
As this only affects the text email (I did not test with HTML mail), I presume it is a filtering bug somewhere, but I have tried to track it down yet.
Re: payment provider name html entities not processed in text email messages
Even though the name of the configuration setting isn't intuitive, you can identify those HTML-code-to-character conversions via the E-Mail Options::Convert currencies for TEXT emails setting.
Re: payment provider name html entities not processed in text email messages
Hi lat9,
Wow, interesting. thanks! While not a currency, I added ":','" to the end of the list for testing.
Obviously not an idea solution long-term. I think I will play with adding text explanations to each payment provider (in a separate line from the name string), which will not be affected by email issues.
Re: payment provider name html entities not processed in text email messages
One way to add extra text (which I'm exploring adding in v1.2 of the module) is this:
1. Add another language define to the module's language file:
Code:
define('MODULE_PAYMENT_SQUARE_TEXT_NOTICES_TO_CUSTOMER', '(Only Visa/MC accepted)'); // customize to suit
2. Edit the array returned by the module's "selection()" function:
(Add the code shown in red here)
Code:
$selection = array(
'id' => $this->code,
'module' => $this->title,
'fields' => array(
array(
'field' => '<div>' . MODULE_PAYMENT_SQUARE_TEXT_NOTICES_TO_CUSTOMER . '</div>',
),
array(
'title' => MODULE_PAYMENT_SQUARE_TEXT_CREDIT_CARD_NUMBER,
https://p176.p0.n0.cdn.getcloudapp.c...0f3d58ea889d74
Re: payment provider name html entities not processed in text email messages
Thanks very much! Took a bit of time to try this, worked perfectly.
Also tried with Paypal, editing similar parts of the corresponding code to display, not quite a clean, but acceptable for me at this stage.
Code:
return array('id' => $this->code,
'module' => '<img src="' . MODULE_PAYMENT_PAYPALEC_MARK_BUTTON_IMG . '" alt="' . MODULE_PAYMENT_PAYPALWPP_TEXT_BUTTON_ALTTEXT . '" /><br / >' . MODULE_PAYMENT_PAYPALWPP_MARK_BUTTON_TXT . ' <br /> ' . MODULE_PAYMENT_PAYPALWPP_TEXT_NOTICES_TO_CUSTOMER);
/*'module' => '<img src="' . MODULE_PAYMENT_PAYPALEC_MARK_BUTTON_IMG . '" alt="' . MODULE_PAYMENT_PAYPALWPP_TEXT_BUTTON_ALTTEXT . '" /><span style="font- size:11px; font-family: Arial, Verdana;"> ' . MODULE_PAYMENT_PAYPALWPP_MARK_BUTTON_TXT . '</span>');*/