From e4acfd89e79ee920e100b594f7e0450e53c2292c Mon Sep 17 00:00:00 2001 From: O K Date: Thu, 25 Sep 2025 18:57:52 +0300 Subject: [PATCH] added group_name --- controllers/front/productdatagenerate.php | 41 ++++++++++++----------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/controllers/front/productdatagenerate.php b/controllers/front/productdatagenerate.php index 3f5e4d9..c6b5bf0 100644 --- a/controllers/front/productdatagenerate.php +++ b/controllers/front/productdatagenerate.php @@ -61,25 +61,7 @@ class ProductLinkCheckerProductDataGenerateModuleFrontController extends ModuleF continue; } - // 1. Add the main product data (as a product without a specific combination) - $all_product_data[] = [ - 'id_product' => (int)$product->id, - 'id_product_attribute' => 0, // 0 for the main product - 'meta_title' => $product->meta_title, - // Grouping meta fields for clarity - 'meta_description' => $product->meta_description, - 'title' => $product->name, - 'description' => Tools::getValue('plc_no_description') ? null : $product->description, - 'description_short' => Tools::getValue('plc_no_description_short') ? null : $product->description_short, - 'mpn' => $product->mpn ?? null, - 'reference' => $product->reference ?? null, - 'ean13' => $product->ean13 ?? null, - 'upc' => $product->upc ?? null, - 'id_language' => (int)$id_lang, - 'id_shop' => (int)$id_shop, - 'link' => $this->context->link->getProductLink($product), - 'link_rewrite' => $product->link_rewrite, - ]; + // 2. Add data for all attribute combinations if ($product->hasAttributes()) { @@ -89,6 +71,8 @@ class ProductLinkCheckerProductDataGenerateModuleFrontController extends ModuleF foreach ($combinations as $combination) { $all_product_data[] = [ 'id_product' => (int)$product->id, + 'group_name' => $combination['group_name'] ?? null, + 'attribute_name' => $combination['attribute_name'] ?? null, 'id_product_attribute' => (int)$combination['id_product_attribute'], 'meta_title' => $product->meta_title, // Meta is usually product-level 'meta_description' => $product->meta_description, @@ -108,6 +92,25 @@ class ProductLinkCheckerProductDataGenerateModuleFrontController extends ModuleF ]; } } + } else { // 1. Add the main product data (as a product without a specific combination) + $all_product_data[] = [ + 'id_product' => (int)$product->id, + 'id_product_attribute' => 0, // 0 for the main product + 'meta_title' => $product->meta_title, + // Grouping meta fields for clarity + 'meta_description' => $product->meta_description, + 'title' => $product->name, + 'description' => Tools::getValue('plc_no_description') ? null : $product->description, + 'description_short' => Tools::getValue('plc_no_description_short') ? null : $product->description_short, + 'mpn' => $product->mpn ?? null, + 'reference' => $product->reference ?? null, + 'ean13' => $product->ean13 ?? null, + 'upc' => $product->upc ?? null, + 'id_language' => (int)$id_lang, + 'id_shop' => (int)$id_shop, + 'link' => $this->context->link->getProductLink($product), + 'link_rewrite' => $product->link_rewrite, + ]; } } }