fix grouping
This commit is contained in:
@@ -69,25 +69,27 @@ class ProductLinkCheckerProductDataGenerateModuleFrontController extends ModuleF
|
||||
$combinations = $product->getAttributeCombinations($id_lang);
|
||||
if ($combinations) {
|
||||
foreach ($combinations as $combination) {
|
||||
$all_product_data[$product->id . '_' . $combination['id_product_attribute']] = [
|
||||
'id_product' => (int)$product->id,
|
||||
'id_product_attribute' => (int)$combination['id_product_attribute'],
|
||||
'meta_title' => $product->meta_title, // Meta is usually product-level
|
||||
'meta_description' => $product->meta_description,
|
||||
// Title and descriptions are also from the main product
|
||||
'title' => $product->name,
|
||||
'description' => Tools::getValue('plc_no_description') ? null : $product->description,
|
||||
'description_short' => Tools::getValue('plc_no_description_short') ? null : $product->description_short,
|
||||
// These fields are specific to the combination
|
||||
'mpn' => $combination['mpn'] ?? null,
|
||||
'reference' => $combination['reference'] ?? null,
|
||||
'ean13' => $combination['ean13'] ?? null,
|
||||
'upc' => $combination['upc'] ?? null,
|
||||
'id_language' => (int)$id_lang,
|
||||
'id_shop' => (int)$id_shop,
|
||||
'link' => $this->context->link->getProductLink($product, null, null, null, (int)$id_lang, (int)$id_shop, (int)$combination['id_product_attribute']),
|
||||
'link_rewrite' => $product->link_rewrite,
|
||||
];
|
||||
if (!isset($all_product_data[$product->id . '_' . $combination['id_product_attribute']])) {
|
||||
$all_product_data[$product->id . '_' . $combination['id_product_attribute']] = [
|
||||
'id_product' => (int)$product->id,
|
||||
'id_product_attribute' => (int)$combination['id_product_attribute'],
|
||||
'meta_title' => $product->meta_title, // Meta is usually product-level
|
||||
'meta_description' => $product->meta_description,
|
||||
// Title and descriptions are also from the main product
|
||||
'title' => $product->name,
|
||||
'description' => Tools::getValue('plc_no_description') ? null : $product->description,
|
||||
'description_short' => Tools::getValue('plc_no_description_short') ? null : $product->description_short,
|
||||
// These fields are specific to the combination
|
||||
'mpn' => $combination['mpn'] ?? null,
|
||||
'reference' => $combination['reference'] ?? null,
|
||||
'ean13' => $combination['ean13'] ?? null,
|
||||
'upc' => $combination['upc'] ?? null,
|
||||
'id_language' => (int)$id_lang,
|
||||
'id_shop' => (int)$id_shop,
|
||||
'link' => $this->context->link->getProductLink($product, null, null, null, (int)$id_lang, (int)$id_shop, (int)$combination['id_product_attribute']),
|
||||
'link_rewrite' => $product->link_rewrite,
|
||||
];
|
||||
}
|
||||
$all_product_data[$product->id . '_' . $combination['id_product_attribute']]['attributes'][] = [
|
||||
'group_name' => $combination['group_name'] ?? null,
|
||||
'attribute_name' => $combination['attribute_name'] ?? null,
|
||||
|
||||
Reference in New Issue
Block a user