Jump to content

Edit History

c64girl

c64girl

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}

 

c64girl

c64girl

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 }

 

×
×
  • Create New...