Jump to content

If statement for profile ID in Controler .tpl file


bobthebob01
 Share

Recommended Posts

Hi,

 

Here is the situation. I created a employee profile which can only add and edit product. But i want to stop that profile of being able to enable/disable product on the "edit product page". I managed to do it on the product list page.

 

The way i see it, is that i want to hide the html block displaying the "enable/disable" button. Adding a simple "display: none" will suffice, and have the button set to "disable" by default.

 

I easily managed to make the button "disable" but default. But i'm having problem with the {if} statement for profile ID.

 


{if ((int)Context::getContext()->employee->id_profile) == 3}

{else}

{/if}

 

which translate for me into:

{if ((int)Context::getContext()->employee->id_profile) == 3}

my html block with "display: none" to the div wrpping the button

{else}

my html block displaying the button

{/if}

 

It actually works fine in terms of displaying or not the html block accordingly. But it creates a problem with all other product tabs (Prices, SEO, Associations, Shipping, Combinations etc.). When i click on any of them, the page reload but stay on the first tab "Information". It never loads the other tabs.

And i'm pretty sure it's not something else because as soon as i remove my custom {if} statement, everything works fine.

 

Does anybody has an idea why it seems to interfer with the tab?

 

Thank you in advance.

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More