az1000 Posted July 23, 2013 Share Posted July 23, 2013 (edited) Hello friends. I want to add block layered filter and features to manufacturers products page on the left or right block. Is it possible in prestashop? Please help if anybody knows. Thanks in advance. Edited July 23, 2013 by az1000 (see edit history) Link to comment Share on other sites More sharing options...
tomerg3 Posted July 23, 2013 Share Posted July 23, 2013 As far as I know, the module was not designed to work on those pages. It may require quite a bit of customization to get it to work for manufacturers page as well. Link to comment Share on other sites More sharing options...
az1000 Posted July 25, 2013 Author Share Posted July 25, 2013 can anybody help please? Link to comment Share on other sites More sharing options...
tomerg3 Posted July 25, 2013 Share Posted July 25, 2013 What kind of help are you looking for? I already mentioned the module does not support what you're asking. Your options are: 1) Use a different module which support this option. 2) Ask Prestashop to add this feature (I wouldn't hold my breath for a quick turnaround). 3) Find a developer to make this customization for you. I would suggest option #1 as it would likely be the cheapest. Link to comment Share on other sites More sharing options...
az1000 Posted August 10, 2013 Author Share Posted August 10, 2013 Can anybody from programmers or devellopers help me please? may be free or paid? Link to comment Share on other sites More sharing options...
mascotasavila Posted October 18, 2013 Share Posted October 18, 2013 I'm looking for the same change in blocklayered, get to know how it was? Thanks! Link to comment Share on other sites More sharing options...
tomerg3 Posted October 18, 2013 Share Posted October 18, 2013 You can check out our Ajax Filter module. It can be displayed in Manufacturer page, search page, home page. It can display at top of pages, or on the left / right columns. More info at http://www.prestashop.com/forums/topic/118467-module-ajax-filter-ajax-based-filter-using-price-supplier-man-category-feature-attribute/ Link to comment Share on other sites More sharing options...
tgiordmaina Posted June 25, 2015 Share Posted June 25, 2015 (edited) I want update this topic because now the addon to handle filtering on manufacturer product pages is available on official prestashop addons store and works perfectly : https://addons.prestashop.com/en/product.php?id_product=19882 Best Regards Edited June 25, 2015 by tgiordmaina (see edit history) 1 Link to comment Share on other sites More sharing options...
garciasanchezdani Posted December 1, 2016 Share Posted December 1, 2016 Hi all, I needed to obtain manufacturers pages loading products through ajax, so I looked for it in google, but didn't find anything... So I developed it, by editing files of module blocklayered, and now I've it working well! If someone is interested, write here and I'd share code. Best regards Link to comment Share on other sites More sharing options...
rohi222 Posted January 7, 2017 Share Posted January 7, 2017 Hi garciasanchezdani, Can you please share the code as everyone is looking for the solution of it? Link to comment Share on other sites More sharing options...
garciasanchezdani Posted January 9, 2017 Share Posted January 9, 2017 (edited) Hi, here is the code I edited:In file modules/blocklayered/blocklayered.php: (do a backup of file before, please) Around line 691, change: if (Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))) == Configuration::get('PS_HOME_CATEGORY')) return; to: if (Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))) == Configuration::get('PS_HOME_CATEGORY') && $this->context->controller->php_self != "manufacturer") return; Around line 1782, change: if ($id_parent == $home_category) return false; to if ($id_parent == $home_category && !Tools::getIsset("id_manufacturer_layered")) return false; Around line 1995, above this code: $this->nbr_products = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'cat_filter_restriction'); add this code: if(Tools::getIsset("id_manufacturer_layered")){ $this->nbr_products = Db::getInstance()->getValue( ' SELECT COUNT(*) FROM '._DB_PREFIX_.'cat_filter_restriction cfr LEFT JOIN '._DB_PREFIX_.'product p ON p.id_product = cfr.id_product WHERE p.id_manufacturer = '.Tools::getValue("id_manufacturer_layered") ); } Around line 2025, add: $id_manufacturer_layered = ""; if(Tools::getIsset("id_manufacturer_layered")) $id_manufacturer_layered = " AND m.id_manufacturer = ".Tools::getValue("id_manufacturer_layered"); just before the line $this->products = Db::getInstance()->executeS... Edit sql query, changing where clause: WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") to WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") '.$id_manufacturer_layered.' Around line 3178, add: $current_friendly_url = $filter_block['current_friendly_url']; //manufacturers page if(!isset($filter_block['current_friendly_url']) && Tools::getValue("p") > 1){ $current_friendly_url = "/page-".Tools::getValue("p"); } before the line $vars = array(........ and, in $vars array, also change: 'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$filter_block['current_friendly_url'], to 'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$current_friendly_url, Inside getProducts functions, add: //manufacturers if(sizeof($products) == 0){ $selected_filters["manufacturer"] = Tools::getValue("id_manufacturer_layered"); $products = $this->getProductByFilters($selected_filters); } after $products = $this->getProductByFilters($selected_filters); Edited January 9, 2017 by garciasanchezdani (see edit history) Link to comment Share on other sites More sharing options...
rohi222 Posted January 9, 2017 Share Posted January 9, 2017 Thank you very much. Let me apply and see if it works. I hope its for 1.6.1 version. 1 Link to comment Share on other sites More sharing options...
pesu Posted February 23, 2017 Share Posted February 23, 2017 Hi, I added the code and I don't get it to work. I'm using 1.6.1.11. I got a warning: Warning: Invalid argument supplied for foreach() in /xxxxx/modules/blocklayered/blocklayered.php on line 759 Is it something I have missed? Link to comment Share on other sites More sharing options...
rygar_84 Posted February 28, 2017 Share Posted February 28, 2017 Hi, here is the code I edited: In file modules/blocklayered/blocklayered.php: (do a backup of file before, please) Around line 691, change: if (Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))) == Configuration::get('PS_HOME_CATEGORY')) return; to: if (Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))) == Configuration::get('PS_HOME_CATEGORY') && $this->context->controller->php_self != "manufacturer") return; Around line 1782, change: if ($id_parent == $home_category) return false; to if ($id_parent == $home_category && !Tools::getIsset("id_manufacturer_layered")) return false; Around line 1995, above this code: $this->nbr_products = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'cat_filter_restriction'); add this code: if(Tools::getIsset("id_manufacturer_layered")){ $this->nbr_products = Db::getInstance()->getValue( ' SELECT COUNT(*) FROM '._DB_PREFIX_.'cat_filter_restriction cfr LEFT JOIN '._DB_PREFIX_.'product p ON p.id_product = cfr.id_product WHERE p.id_manufacturer = '.Tools::getValue("id_manufacturer_layered") ); } Around line 2025, add: $id_manufacturer_layered = ""; if(Tools::getIsset("id_manufacturer_layered")) $id_manufacturer_layered = " AND m.id_manufacturer = ".Tools::getValue("id_manufacturer_layered"); just before the line $this->products = Db::getInstance()->executeS... Edit sql query, changing where clause: WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") to WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") '.$id_manufacturer_layered.' Around line 3178, add: $current_friendly_url = $filter_block['current_friendly_url']; //manufacturers page if(!isset($filter_block['current_friendly_url']) && Tools::getValue("p") > 1){ $current_friendly_url = "/page-".Tools::getValue("p"); } before the line $vars = array(........ and, in $vars array, also change: 'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$filter_block['current_friendly_url'], to 'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$current_friendly_url, Inside getProducts functions, add: //manufacturers if(sizeof($products) == 0){ $selected_filters["manufacturer"] = Tools::getValue("id_manufacturer_layered"); $products = $this->getProductByFilters($selected_filters); } after $products = $this->getProductByFilters($selected_filters); Could you please upload the file.. plus my blocklayered.php is slightly different from yours. Im on 1.6.1.11 Link to comment Share on other sites More sharing options...
Riva Posted April 2, 2017 Share Posted April 2, 2017 Give me please your blocklayered.php Link to comment Share on other sites More sharing options...
federico.crispino Posted April 7, 2017 Share Posted April 7, 2017 (edited) Hello, I have modified the file but I don't see the filter in the left column on manufacturer page. Thank you Federico Edited April 12, 2017 by federico.crispino (see edit history) Link to comment Share on other sites More sharing options...
Santoro Tea Posted May 28, 2017 Share Posted May 28, 2017 Hi, I have modified blocklayered.php but I don't see the filter in manufacturer page on left column. Thank you Link to comment Share on other sites More sharing options...
mpatzekov Posted March 23, 2018 Share Posted March 23, 2018 On 1/9/2017 at 11:43 AM, garciasanchezdani said: Hi, here is the code I edited: In file modules/blocklayered/blocklayered.php: (do a backup of file before, please) Around line 691, change: if (Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))) == Configuration::get('PS_HOME_CATEGORY')) return; to: if (Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))) == Configuration::get('PS_HOME_CATEGORY') && $this->context->controller->php_self != "manufacturer") return; Around line 1782, change: if ($id_parent == $home_category) return false; to if ($id_parent == $home_category && !Tools::getIsset("id_manufacturer_layered")) return false; Around line 1995, above this code: $this->nbr_products = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'cat_filter_restriction'); add this code: if(Tools::getIsset("id_manufacturer_layered")){ $this->nbr_products = Db::getInstance()->getValue( ' SELECT COUNT(*) FROM '._DB_PREFIX_.'cat_filter_restriction cfr LEFT JOIN '._DB_PREFIX_.'product p ON p.id_product = cfr.id_product WHERE p.id_manufacturer = '.Tools::getValue("id_manufacturer_layered") ); } Around line 2025, add: $id_manufacturer_layered = ""; if(Tools::getIsset("id_manufacturer_layered")) $id_manufacturer_layered = " AND m.id_manufacturer = ".Tools::getValue("id_manufacturer_layered"); just before the line $this->products = Db::getInstance()->executeS... Edit sql query, changing where clause: WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") to WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") '.$id_manufacturer_layered.' Around line 3178, add: $current_friendly_url = $filter_block['current_friendly_url']; //manufacturers page if(!isset($filter_block['current_friendly_url']) && Tools::getValue("p") > 1){ $current_friendly_url = "/page-".Tools::getValue("p"); } before the line $vars = array(........ and, in $vars array, also change: 'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$filter_block['current_friendly_url'], to 'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$current_friendly_url, Inside getProducts functions, add: //manufacturers if(sizeof($products) == 0){ $selected_filters["manufacturer"] = Tools::getValue("id_manufacturer_layered"); $products = $this->getProductByFilters($selected_filters); } after $products = $this->getProductByFilters($selected_filters); Thanks for the suggestions @garciasanchezdani . As the other users here described, the same happened to me. After applying your modifications on the file, Prestashop showed an error which is: Warning: Invalid argument supplied for foreach() in /xxxxx/modules/blocklayered/blocklayered.php on line ... Also, the blocklayered filter did not appear on the manufacturers page. I did a quick edit on your code and added this: if (is_array($filters) || is_object($filters)) { before this: foreach ($filters as $type => $val) { of course, added the closing } at the end, so that the whole piece of code is now: if (is_array($filters) || is_object($filters)) { foreach ($filters as $type => $val) { switch ($type) { case 'id_attribute_group': foreach ($val as $attr) { $attr_id = preg_replace('/_\d+$/', '', $attr); if (in_array($attr_id, $attributes) || in_array(array('id_attribute_group' => $attr_id), $attribute_group_list)) { $smarty->assign('nobots', true); $smarty->assign('nofollow', true); return; } $attributes[] = $attr_id; } break; case 'id_feature': foreach ($val as $feat) { $feat_id = preg_replace('/_\d+$/', '', $feat); if (in_array($feat_id, $features) || in_array(array('id_feature' => $feat_id), $feature_list)) { $smarty->assign('nobots', true); $smarty->assign('nofollow', true); return; } $features[] = $feat_id; } break; default: if (in_array($type, $blacklist)) { if (count($val)) { $smarty->assign('nobots', true); $smarty->assign('nofollow', true); return; } } elseif (count($val) > 1) { $smarty->assign('nobots', true); $smarty->assign('nofollow', true); return; } break; } } } Now Prestashop (mine is 1.6.1.4) does not trigger the error anymore, but again - the blocklayered navigation filter is not visible on manufacturers page. Any ideas @garciasanchezdani? I see that other users have the same issue too. Do you know is there anything that we are missing? We really appreciate any help here. Thanks! Link to comment Share on other sites More sharing options...
hakeryk2 Posted August 10, 2018 Share Posted August 10, 2018 I am having same issue, anyone can help? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now