Jump to content

Display Product Summary to a special group of clients


Pierre-Antoine

Recommended Posts

Hi,

 

I am using PrestaShop 1.6.0.14.

 

I would like to find a way to display product short description only to a certain group of client.

I was thinking about something like this in the product.tpl file :

if ($customer->id_group == 3)
{<div>
{$product->description_short}
</div>}
else
<!--display something else-->

It doesn't work ... Anyone would have a suggestion ?

 

Thank you in advance for your help !

Edited by Pierre-Antoine (see edit history)
Link to comment
Share on other sites

Hi,

I'm happy to help you.

 

you have to modify a php file before using customer variable in tpl file. 

You need add this code to ProductController.php

 

1. find the function initContent().

2. in a line about 264. you will see the code:

			$this->context->smarty->assign(array(
				'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
				'customizationFields' => $customization_fields,
				'id_customization' => empty($customization_datas) ? null : $customization_datas[0]['id_customization'],
				'accessories' => $accessories,
				'return_link' => $return_link,

You should add the code

'logged' => $this->context->customer->isLogged(),
'customerGroup' => ($this->context->customer->logged ? $this->context->customer->id_default_group : false),

Then from 'logged' and 'customerGroup' you can using if else condition to show your custom data.

 

Good luck ;)

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...