From c1969028f2bac39c12b1c35bcf7bb72ca13a7c17 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 12 Nov 2013 10:41:19 +0100 Subject: [PATCH] [-] FO : Customized meesage with carriage return follow up #962 --- classes/Cart.php | 5 +++-- modules/blockcart/blockcart-json.tpl | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index c51afa6c4..9fb756f7e 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1087,9 +1087,10 @@ class CartCore extends ObjectModel ); $id_customization = Db::getInstance()->Insert_ID(); } - + + $field = preg_replace("/\/i", "\n", $field); $query = 'INSERT INTO `'._DB_PREFIX_.'customized_data` (`id_customization`, `type`, `index`, `value`) - VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSql($field).'\')'; + VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSQL($field).'\')'; if (!Db::getInstance()->execute($query)) return false; diff --git a/modules/blockcart/blockcart-json.tpl b/modules/blockcart/blockcart-json.tpl index 2afe1a214..22646e5c8 100644 --- a/modules/blockcart/blockcart-json.tpl +++ b/modules/blockcart/blockcart-json.tpl @@ -61,8 +61,8 @@ {foreach from=$datas key='index' item='data' name='datas'} {ldelim} "index": {$index}, - "value": "{$data.value|addslashes|replace: '\\\'':'\''}", - "truncatedValue": "{$data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\''}" + "value": "{Tools::nl2br($data.value|addslashes|replace: '\\\'':'\'')}", + "truncatedValue": "{Tools::nl2br($data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\'')}" {rdelim}{if !$smarty.foreach.datas.last},{/if} {/foreach}] {rdelim}{if !$smarty.foreach.customization.last},{/if}