feat: add manufacturer to product view

This commit is contained in:
Nikita Kiselev
2025-07-12 11:48:59 +03:00
parent f13e128d03
commit b25f6d3c73
3 changed files with 12 additions and 1 deletions

View File

@@ -134,6 +134,7 @@ class ProductsHandler
'products.price' => 'price', 'products.price' => 'price',
'products.image' => 'product_image', 'products.image' => 'product_image',
'products.tax_class_id' => 'tax_class_id', 'products.tax_class_id' => 'tax_class_id',
'manufacturer.name' => 'product_manufacturer',
]) ])
->from(db_table('product'), 'products') ->from(db_table('product'), 'products')
->join( ->join(
@@ -143,6 +144,12 @@ class ProductsHandler
->where('product_description.language_id', '=', $languageId); ->where('product_description.language_id', '=', $languageId);
} }
) )
->join(
db_table('manufacturer') . ' AS manufacturer',
function (JoinClause $join) use ($languageId) {
$join->on('products.manufacturer_id', '=', 'manufacturer.manufacturer_id');
}
)
->where('products.product_id', '=', $productId) ->where('products.product_id', '=', $productId)
->limit(1) ->limit(1)
->firstOrNull(); ->firstOrNull();
@@ -185,6 +192,7 @@ class ProductsHandler
'id' => $product['product_id'], 'id' => $product['product_id'],
'name' => $product['product_name'], 'name' => $product['product_name'],
'description' => html_entity_decode($product['product_description']), 'description' => html_entity_decode($product['product_description']),
'manufacturer' => $product['product_manufacturer'],
'price' => $price, 'price' => $price,
'images' => $images, 'images' => $images,
]; ];

View File

@@ -96,5 +96,5 @@ onMounted(() => {
if (backButton.isVisible.value) { if (backButton.isVisible.value) {
backButton.hide(); backButton.hide();
} }
}) });
</script> </script>

View File

@@ -15,6 +15,9 @@
<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>
<div>
<h3 class="text-sm font-medium">{{ product.manufacturer }}</h3>
</div>
<!-- Options --> <!-- Options -->
<div class="mt-4 lg:row-span-3 lg:mt-0"> <div class="mt-4 lg:row-span-3 lg:mt-0">