--- phenix/classes/Category.php 2025-06-25 14:54:20.030433767 +0200 +++ phenix/classes/Category.php 2025-06-25 14:53:14.448460123 +0200 public static function getSimpleCategories($id_lang) { @@ -876,6 +877,10 @@ public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null) { + +$which_categories=(null !==Configuration::get('PS_SUB_CAT_DISPLAY') and Configuration::get('PS_SUB_CAT_DISPLAY')==1)?' in (select id_category from ed_category where id_parent='.(int)$this->id.' or id_category='.(int)$this->id.')':' = '.(int)$this->id; + if(!$context) { $context = Context::getContext(); } @@ -909,8 +915,8 @@ '.Product::sqlStock('p', 0).' INNER JOIN `'._DB_PREFIX_.'category_product` cp ON(p.`id_product` = cp.`id_product`) - WHERE cp.`id_category` = '.(int)$this->id. - (Group::isGroupProductRestriction() ? ' + WHERE cp.`id_category` '.$which_categories + .(Group::isGroupProductRestriction() ? ' AND EXISTS ( SELECT 1 FROM `'._DB_PREFIX_.'product_group` pg @@ -998,7 +1004,7 @@ LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON(m.`id_manufacturer` = p.`id_manufacturer`) WHERE product_shop.`id_shop` = '.(int)$context->shop->id.' - AND cp.`id_category` = '.(int)$this->id + AND cp.`id_category` '.$which_categories .(Group::isGroupProductRestriction() ? ' AND EXISTS ( SELECT 1 --- phenix/controllers/admin/AdminPPreferencesController.php 2025-06-25 14:56:52.735003735 +0200 +++ phenix/controllers/admin/AdminPPreferencesController.php 2025-06-25 14:44:27.936547040 +0200 @@ -77,6 +77,14 @@ 'required' => false, 'type' => 'bool' ), + 'PS_SUB_CAT_DISPLAY' => array( + 'title' => $this->l('sub cat mod'), + 'desc' => $this->l('When active, producs from sub categories are displayed'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'required' => false, + 'type' => 'bool' + ), 'PS_TAX_RULES_GROUP' => array( 'title' => $this->l('Default tax rule group'), 'desc' => $this->l('Choosing the default tax rule when creating a new product'), @@ -581,6 +589,9 @@ Product::updateAllLinkRewrite(); unset($_POST['PS_UPDATE_FRIENDLY_PRODUCT']); } + if((int)Tools::getValue('PS_SUB_CAT_DISPLAY')) { + Configuration::updateValue('PS_SUB_CAT_DISPLAY', (int)Tools::getValue('PS_SUB_CAT_DISPLAY')); + } if(Tools::getIsset('PS_CATALOG_MODE')) { Tools::clearSmartyCache();