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