cercamon Posted November 6, 2010 Share Posted November 6, 2010 Hi,I need to have a more granular control over module visibility.My intention is to show some block ONLY when a certain product or category is displayed.I presume that the options in the BO to prevent the show of the module become useless under this circumstance, am I right?For a better control, the BO could contain two fields: one indicating on which pages do you want the module to show, and alternatively other to indicate in which ones not to show.Anyway I've found that the php hook function in the module is a good place to insert custom visibility functions like: if (strpos($_SERVER['SCRIPT_NAME'],'product.php') && $_REQUEST['id_product'] == XX) { return $this->display(__FILE__, 'MODULE.tpl'); } This one works fine to limit the visibility of the module to just one (or multiple) products.But when it comes to restrict the visibility to a certain category, I don't know how to do it without querying to the DB.Any hints? Link to comment Share on other sites More sharing options...
probashi Posted November 6, 2010 Share Posted November 6, 2010 Have a look at this post:http://www.prestashop.com/forums/viewthread/39745/modules___development/solved_adding_categories_as_exception_to_show_a_block_module_or_how_to_display_a_module_block_only_in_one_category_dot__dot__dot_ Link to comment Share on other sites More sharing options...
cercamon Posted November 7, 2010 Author Share Posted November 7, 2010 That's a brilliant quick fix. Many thanks! 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