Jump to content

If "In Group 2" Display Attribute in product.tpl


wakasm

Recommended Posts

Is there a way to display custom text or attributes in product.tpl by using group as a flag?

I dislike prestashops "wholesale" system since I can't create a group that just sees the products at their wholesale price, so I instead want to add wholesale as a custom attribute.

I've figured everything out that I need except what code would control "If in group X" -> Do this.

I think maybe I have to modify product.php to respect groups first? Any help would be appreciated.

Link to comment
Share on other sites

It is possible to modify PrestaShop to display the wholesale price for a certain customer group. See my post here for how to create a variable $trade that is available to all the TPL files. You can then use code like the following in product.tpl:

{if $trade}{convertPrice price=$product->wholesale_price}{else}{convertPrice price=$product->getPrice(true, $smarty.const.NULL)}{/if}



and the following in other TPL files:

{if $trade}{convertPrice price=$product.wholesale_price}{else}{convertPrice price=$product.price}{/if}



There are many places it needs to be changed though.

Link to comment
Share on other sites

  • 2 weeks later...

I am interested in making a change to only one the product.tpl file. I want to display some custom text if the belong to GROUP 2 that I have set up in my backend.

I feel this should be a simple solution - just a method to retrieve that they are in that group and an if/then statement that prints out the message.

if in group 2 - print this.

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