Jump to content

Show block on specific brand-pages


Recommended Posts

Hi Prestashop-Community, 

I can use a module to generate link-blocks. 
I can use the hook-system to show it in the leftColumn (sidebar). 
I could add exceptions to that hook. 

But how could I add a condition to that hook? 

My goal would be to show a link-block ONLY on the manufacturer-page of a specific brand. 

Is this somehow possible? 

Link to comment
Share on other sites

  • 1 year later...
On 4/1/2022 at 3:28 PM, Betz Developer said:

Hi Prestashop-Community, 

I can use a module to generate link-blocks. 
I can use the hook-system to show it in the leftColumn (sidebar). 
I could add exceptions to that hook. 

But how could I add a condition to that hook? 

My goal would be to show a link-block ONLY on the manufacturer-page of a specific brand. 

Is this somehow possible? 

PS 1.7

{if $page.page_name == 'index'}     Your Code {/if} 

P.S 1.6

{if $page_name == 'index'}     Your Code {/if}

In Module (PHP)

if($this->context->controller->php_self == 'controller_name') {     //Your Code }

List of controllers example

index

product

category

manufacturer

supplier

cms

brand (I'm not sure regarding this controller name 

If you want to add additional condition by product or brand use Tools::getValue for specific items

if ($page_name == 'manufacturer' && ($id_manufacturer == Tools::getValue('id_manufacturer'))) {     //Your code } 

or

if ($page_name == 'category' && ($id_category == Tools::getValue('id_category'))) {     //Your code }

or
 

{if $category.id|in_array:['1', '5', '9', '18' .....]}

Do your thing

{else}

Do something else

{/if}

 

Edited by c64girl (see edit history)
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...