From f80c4220a02df63456e78622462d838fc6acbb9a Mon Sep 17 00:00:00 2001 From: Romain Ruaud Date: Tue, 8 Nov 2016 17:03:27 +0100 Subject: [PATCH] Fixup html entities decoding in autocomplete providers. --- .../Model/Autocomplete/Category/ItemFactory.php | 9 +++++++-- .../Model/Autocomplete/Product/ItemFactory.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/module-elasticsuite-catalog/Model/Autocomplete/Category/ItemFactory.php b/src/module-elasticsuite-catalog/Model/Autocomplete/Category/ItemFactory.php index 8757225a9..cabcbee2c 100644 --- a/src/module-elasticsuite-catalog/Model/Autocomplete/Category/ItemFactory.php +++ b/src/module-elasticsuite-catalog/Model/Autocomplete/Category/ItemFactory.php @@ -97,8 +97,13 @@ private function addCategoryData($data) $documentSource = $category->getDocumentSource(); + $title = $documentSource['name']; + if (is_array($title)) { + $title = current($title); + } + $categoryData = [ - 'title' => $documentSource['name'], + 'title' => html_entity_decode($title), 'url' => $this->getCategoryUrl($category), 'breadcrumb' => $this->getCategoryBreadcrumb($category), ]; @@ -151,7 +156,7 @@ private function getCategoryBreadcrumb(\Magento\Catalog\Model\Category $category $breadcrumb = []; foreach ($rawPath as $categoryId) { - $breadcrumb[] = $this->getCategoryNameById($categoryId, $category->getStoreId()); + $breadcrumb[] = html_entity_decode($this->getCategoryNameById($categoryId, $category->getStoreId())); } return $breadcrumb; diff --git a/src/module-elasticsuite-catalog/Model/Autocomplete/Product/ItemFactory.php b/src/module-elasticsuite-catalog/Model/Autocomplete/Product/ItemFactory.php index bfee0adb8..0aea74953 100644 --- a/src/module-elasticsuite-catalog/Model/Autocomplete/Product/ItemFactory.php +++ b/src/module-elasticsuite-catalog/Model/Autocomplete/Product/ItemFactory.php @@ -72,7 +72,7 @@ private function addProductData($data) $product = $data['product']; $productData = [ - 'title' => $product->getName(), + 'title' => html_entity_decode($product->getName()), 'image' => $this->getImageUrl($product), 'url' => $product->getProductUrl(), 'price' => $product->getFinalPrice(),