Jump to content

Granular Module View Control


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...