Its not possible to add a multiline strings to MODULE_PAYMENT_MONEYORDER_PAYTO like the following:
Account: John Doe\nIBAN: AB12 3546 7890 0012 3456 00\nVWZ: Your Order ID
or:
Account: John Doe<br>IBAN: AB12 3546 7890 0012 3456 00<br>VWZ: Your Order ID
Because the language file uses the same value for email (\n) and html output (<br>):
define('MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION', 'Make Payable To: ' . MODULE_PAYMENT_MONEYORDER_PAYTO . '<br /><br />Send To:<br />' . nl2br(STORE_NAME_ADDRESS) . '<br /><br />' . 'Your order will not ship until we receive payment.');
define('MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER', "Make Payable To: ". MODULE_PAYMENT_MONEYORDER_PAYTO . "\n\nSend To:\n" . STORE_NAME_ADDRESS . "\n\n" . 'Your order will not ship until we receive payment.');
I think the best would be to allow \n and use nl2br() in the lang file as it is still used for the STORE_NAME_ADDRESS value:
define('MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION', 'Make Payable To: ' . nl2br(MODULE_PAYMENT_MONEYORDER_PAYTO) . '<br /><br />Send To:<br />' . nl2br(STORE_NAME_ADDRESS) . '<br /><br />' . 'Your order will not ship until we receive payment.');
But before this makes sense, we have to solve a bug. After saving our string with \n it is correctly added to the database:
But if we want to edit it, the data runs in admin/modules.php through objectInfo() and this class uses tep_db_prepare_input() and removes the backlash (admin/includes/classes/object_info.php) resulting n:
My temporary solution in modules.php:
// because of a bug: https://github.com/osCommerce/oscommerce2/issues/606
function prepare_value_for_stripslashes(&$data) {
foreach ($data as &$value) {
if (is_array($value)) {
prepare_value_for_stripslashes($value);
}
else {
$value = str_replace('\\', '\\\\', $value);
}
}
}
$module_info['keys'] = $keys_extra;
prepare_value_for_stripslashes($module_info);
$mInfo = new objectInfo($module_info);
I tried tep_cfg_textarea( in the database column set_function as well (as done with STORE_NAME_ADDRESS), but it does not solve the problem because the line breaks are replaced by \n text strings before they are saved in the database. :(
Its not possible to add a multiline strings to MODULE_PAYMENT_MONEYORDER_PAYTO like the following:
or:
Because the language file uses the same value for email (
\n
) and html output (<br>
):I think the best would be to allow
\n
and usenl2br()
in the lang file as it is still used for the STORE_NAME_ADDRESS value:But before this makes sense, we have to solve a bug. After saving our string with![Image](https://www.maxrev.de/files/2017/11/2017_11_01_10_44_41.png)
\n
it is correctly added to the database:But if we want to edit it, the data runs in![Image](https://www.maxrev.de/files/2017/11/2017_11_01_10_46_44.png)
admin/modules.php
throughobjectInfo()
and this class usestep_db_prepare_input()
and removes the backlash (admin/includes/classes/object_info.php
) resultingn
:My temporary solution in
modules.php
:I tried
tep_cfg_textarea(
in the database columnset_function
as well (as done withSTORE_NAME_ADDRESS
), but it does not solve the problem because the line breaks are replaced by\n
text strings before they are saved in the database. :(