Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Show/hide Grid Or Block Depending On User_Type Rate Topic   - - - - -

 
  • pepo1
  • Advanced Member
  • Members
  • Join Date: 23-Jun 17
  • 85 posts

Posted 22 October 2017 - 06:16 AM #1

Is it possible to show/hide a grid or block depending on user_type of logged-in user?

I know you can use {if $auth.user_type == 'V'}... with Smarty blocks to show/hide things. But, I have a grid with two blocks. I can hide content of the first block using the above code, but not the second block because it is a "Pages" block and I can't see anywhere to add any such code.

 

It would be good if you could just hide an entire grid or block rather than the content in them.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19796 posts

Posted 23 October 2017 - 07:13 AM #2

Is it possible to show/hide a grid or block depending on user_type of logged-in user?

I know you can use {if $auth.user_type == 'V'}... with Smarty blocks to show/hide things. But, I have a grid with two blocks. I can hide content of the first block using the above code, but not the second block because it is a "Pages" block and I can't see anywhere to add any such code.

 

It would be good if you could just hide an entire grid or block rather than the content in them.

 

You can create new wrapper for such blocks. All wrappers are stored here

 

design/themes/THEME/templates/blocks/wrappers

 

Take one of default wrappers as an example, and wrap it with the {if $auth.user_type == 'V'}...{/if} code


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • pepo1
  • Advanced Member
  • Members
  • Join Date: 23-Jun 17
  • 85 posts

Posted 25 October 2017 - 05:20 AM #3

That's a great tip, thanks. I created a new template, but I get an error saying "preview not available", as attached.

Any idea why?

 

UPDATE: It's OK, I didn't append ".tpl" on the end of the template name. All working now.

Attached Thumbnails

  • templates.PNG