From db86acdf973ce881f2ccbc8d984456a154c92665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20FOUCRET?= Date: Tue, 20 Feb 2018 17:01:09 +0100 Subject: [PATCH 1/2] Fix #771 - Bad encoding of the URI params. --- .../Controller/Tracker/Hit.php | 22 ++++++++++++++++++- .../view/frontend/web/js/tracking.js | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/module-elasticsuite-tracker/Controller/Tracker/Hit.php b/src/module-elasticsuite-tracker/Controller/Tracker/Hit.php index bb74d4ce4..9b1e446a7 100644 --- a/src/module-elasticsuite-tracker/Controller/Tracker/Hit.php +++ b/src/module-elasticsuite-tracker/Controller/Tracker/Hit.php @@ -56,6 +56,26 @@ public function execute() $this->getResponse()->setHeader('Content-Type', 'image/png'); $this->getResponse()->sendResponse(); - $this->logEventQueue->addEvent($this->getRequest()->getParams()); + $this->logEventQueue->addEvent($this->decodeParams($this->getRequest()->getParams())); + } + + /** + * Decode URI params. + * + * @param mixed $params Params. + * + * @return mixed + */ + private function decodeParams($params) + { + if (is_string($params)) { + $params = urldecode($params); + } elseif (is_array($params)) { + foreach ($params as &$currentParam) { + $currentParam = $this->decodeParams($currentParam); + } + } + + return $params; } } diff --git a/src/module-elasticsuite-tracker/view/frontend/web/js/tracking.js b/src/module-elasticsuite-tracker/view/frontend/web/js/tracking.js index f088000c9..91221587e 100644 --- a/src/module-elasticsuite-tracker/view/frontend/web/js/tracking.js +++ b/src/module-elasticsuite-tracker/view/frontend/web/js/tracking.js @@ -160,7 +160,7 @@ var smileTracker = (function () { // Append a variable to the page function addVariable(varName, value) { - this.vars[varName] = encodeURI(value); + this.vars[varName] = encodeURIComponent(value); return this; } From 77d1e6acdccae795c8a2681c2f0e15067825173f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20FOUCRET?= Date: Tue, 20 Feb 2018 17:02:08 +0100 Subject: [PATCH 2/2] Fix #772 - Change qty field type to double in order field. --- src/module-elasticsuite-tracker/etc/elasticsuite_indices.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module-elasticsuite-tracker/etc/elasticsuite_indices.xml b/src/module-elasticsuite-tracker/etc/elasticsuite_indices.xml index 3b78f6a9e..d87f67e13 100644 --- a/src/module-elasticsuite-tracker/etc/elasticsuite_indices.xml +++ b/src/module-elasticsuite-tracker/etc/elasticsuite_indices.xml @@ -94,7 +94,7 @@ - +