Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Hide Menu Item Unless Member
 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 09-24-2019, 08:24 AM
 
Dawn Howard Dawn Howard is online now
 

Senior Member
  
Join Date: Apr 2006
Posts: 179
 

Default Hide Menu Item Unless Member

Is there are a way to hide a header menu item unless the user is logged in with an approved membership?
__________________
Dawn
X-Cart Business 5.3.6.3 - Testing Phase
Mods:
Order Forms - Custom Mod
Freight on Board - Custom Mod
Catalog Order Form
Call For Price

X-Cart 4.4.3 Gold - Live Store


Running on Windows
Reply With Quote
  #2  
Old 09-24-2019, 08:44 AM
 
Ed B. Ed B. is online now
 

eXpert
  
Join Date: Apr 2016
Posts: 218
 

Default Re: Hide Menu Item Unless Member

I guess it suffices to
  • create a @ManyToMany relations between the entities in models "menus" and "membership"
  • in your appropriate view class, define a function that tells if the user's membership is in related to the menu item
  • in appropriate twig file, you make sure that the menu item appears only if (s)he has the right membership using the function above
Of course, there will be usual routine routine writing of codes to edit the relations, add a an admin menu to open the editing page, etc. etc., unless you want to deal with the sql database directly.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #3  
Old 09-24-2019, 09:14 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,582
 

Default Re: Hide Menu Item Unless Member

You can set menu item to show only for logged in customers but that's it. As long as customer is logged in the menu item will show regardless of membership.
If you need it for membership it has to be custom coded and extend the menu functionality to be able to set not only "logged in" but also memberships that apply.


An easier solution, however still involving some coding, will be to set the menu for logged in only and then if not-approved membership tries to go to the page redirect to static page with some explanation why it is not working for them. This approach is easier to do and will not involve any database changes and complicated admin/customer sides coding.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:32 PM.

   

 
X-Cart forums © 2001-2018