From e0f4dc1164343ceb8d60de8623a18d54a404c339 Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Wed, 19 May 2021 11:51:51 +0530 Subject: [PATCH] resolve issue when add to cart --- classes/Tools.php | 5 +++++ modules/blockcart/blockcart.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 22ddaf612..502c4e4a8 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -926,6 +926,11 @@ class ToolsCore return html_entity_decode((string)$string, ENT_QUOTES, 'utf-8'); } + public static function removeHtmlComments($html) + { + return preg_replace('//', '', $html); + } + public static function safePostVars() { if (!isset($_POST) || !is_array($_POST)) { diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index fd5847434..4bebdaafb 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -224,7 +224,7 @@ class blockcart extends Module } $this->assignContentVars($params); - $res = Tools::jsonDecode($this->display(__FILE__, 'blockcart-json.tpl'), true); + $res = Tools::jsonDecode(Tools::removeHtmlComments($this->display(__FILE__, 'blockcart-json.tpl')), true); if (isset($params['cookie']->avail_rooms)) { $res['avail_rooms'] = $params['cookie']->avail_rooms; @@ -249,7 +249,7 @@ class blockcart extends Module } $this->assignContentVars(array('cookie' => $this->context->cookie, 'cart' => $this->context->cart)); - $params['json'] = $this->display(__FILE__, 'blockcart-json.tpl'); + $params['json'] = Tools::removeHtmlComments($this->display(__FILE__, 'blockcart-json.tpl')); } public function hookHeader()