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

View File

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

View File

@@ -23,7 +23,7 @@
<!-- Product info -->
<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">
<h1 class="text-2xl font-bold tracking-tight sm:text-3xl">{{ product.name }}</h1>
</div>
@@ -41,7 +41,7 @@
<ProductOptions v-model="product.options"/>
</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 -->
<div>
<h3 class="sr-only">Description</h3>