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.image' => 'product_image',
'products.tax_class_id' => 'tax_class_id',
'manufacturer.name' => 'product_manufacturer',
])
->from(db_table('product'), 'products')
->join(
@@ -143,6 +144,12 @@ class ProductsHandler
->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)
->limit(1)
->firstOrNull();
@@ -185,6 +192,7 @@ class ProductsHandler
'id' => $product['product_id'],
'name' => $product['product_name'],
'description' => html_entity_decode($product['product_description']),
'manufacturer' => $product['product_manufacturer'],
'price' => $price,
'images' => $images,
];