fix(product): decode html entities for product and category names

This commit is contained in:
2025-09-25 16:33:48 +03:00
parent a381b3a6ee
commit acbfaebcf4
3 changed files with 10 additions and 10 deletions

View File

@@ -79,7 +79,7 @@ class CategoriesHandler
return [ return [
'id' => (int)$category['id'], 'id' => (int)$category['id'],
'image' => $category['image'] ?? '', 'image' => $category['image'] ?? '',
'name' => $category['name'], 'name' => html_entity_decode($category['name'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'description' => $category['description'], 'description' => $category['description'],
'children' => $category['children'], 'children' => $category['children'],
]; ];
@@ -102,7 +102,7 @@ class CategoriesHandler
$branch[] = [ $branch[] = [
'id' => (int)$category['id'], 'id' => (int)$category['id'],
'image' => $image, 'image' => $image,
'name' => $category['name'], 'name' => html_entity_decode($category['name'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'description' => $category['description'], 'description' => $category['description'],
'children' => $category['children'] ?? [], 'children' => $category['children'] ?? [],
]; ];

View File

@@ -154,7 +154,7 @@ class ProductsService
$allImages[] = [ $allImages[] = [
'url' => $image, 'url' => $image,
'alt' => $product['product_name'], 'alt' => html_entity_decode($product['product_name'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
]; ];
$price = $this->currency->format( $price = $this->currency->format(
@@ -173,7 +173,7 @@ class ProductsService
return [ return [
'id' => (int) $product['product_id'], 'id' => (int) $product['product_id'],
'product_quantity' => (int) $product['product_quantity'], 'product_quantity' => (int) $product['product_quantity'],
'name' => $product['product_name'], 'name' => html_entity_decode($product['product_name'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'price' => $price, 'price' => $price,
'images' => $allImages, 'images' => $allImages,
]; ];
@@ -263,7 +263,7 @@ class ProductsService
), ),
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
'alt' => $product['product_name'], 'alt' => html_entity_decode($product['product_name'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
]; ];
} catch (Exception $e) { } catch (Exception $e) {
$this->logger->logException($e); $this->logger->logException($e);
@@ -281,9 +281,9 @@ class ProductsService
return [ return [
'id' => $product['product_id'], 'id' => $product['product_id'],
'name' => $product['product_name'], 'name' => html_entity_decode($product['product_name'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'description' => html_entity_decode($product['product_description']), 'description' => html_entity_decode($product['product_description'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'manufacturer' => $product['product_manufacturer'], 'manufacturer' => html_entity_decode($product['product_manufacturer'], ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'price' => $price, 'price' => $price,
'minimum' => $product['minimum'], 'minimum' => $product['minimum'],
'quantity' => $product['quantity'], 'quantity' => $product['quantity'],

View File

@@ -23,7 +23,7 @@
<!-- Product info --> <!-- Product info -->
<div <div
class="mx-auto max-w-2xl px-4 pt-3 pb-16 sm:px-6 lg:grid lg:max-w-7xl lg:grid-cols-3 lg:grid-rows-[auto_auto_1fr] lg:gap-x-8 lg:px-8 lg:pt-16 lg:pb-24 rounded-t-lg"> class="mx-auto max-w-2xl px-4 pt-3 pb-24 sm:px-6 rounded-t-lg">
<div class="lg:col-span-2 lg:border-r lg:pr-8"> <div class="lg:col-span-2 lg:border-r lg:pr-8">
<h1 class="text-2xl font-bold tracking-tight sm:text-3xl">{{ product.name }}</h1> <h1 class="text-2xl font-bold tracking-tight sm:text-3xl">{{ product.name }}</h1>
</div> </div>
@@ -41,7 +41,7 @@
<ProductOptions v-model="product.options"/> <ProductOptions v-model="product.options"/>
</div> </div>
<div class="py-10 lg:col-span-2 lg:col-start-1 lg:border-r lg:border-gray-200 lg:pt-6 lg:pr-8 lg:pb-16"> <div class="py-10">
<!-- Description and details --> <!-- Description and details -->
<div> <div>
<h3 class="sr-only">Description</h3> <h3 class="sr-only">Description</h3>