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

How to restrict a category by login only
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 07-27-2015, 04:13 AM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default How to restrict a category by login only

Hello,
I want to restrict a category which will display after registrations and logged in.How to achieve that?

The flow will be in this way
1)The customer comes in the site
2)when he is trying to access that category he will ask for registrations
3)After registrations happens he will be logged in
4)after login he can able to see that category

How to achieve that?

Thanks.
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #2  
Old 07-27-2015, 05:18 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: How to restrict a category by login only

This is just psuedo code, you should find and test for the actual variables to use:
Code:
{if $cat.categoryid eq 12} {*special behavior goes here*} {if $logged ne ''} {*Show category*} {else} {*Show message to log in with link*} {/if} {else} {*Normal category behavior goes here*} {/if}
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #3  
Old 07-27-2015, 07:50 AM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default Re: How to restrict a category by login only

Quote:
Originally Posted by totaltec
This is just psuedo code, you should find and test for the actual variables to use:
Code:
{if $cat.categoryid eq 12} {*special behavior goes here*} {if $logged ne ''} {*Show category*} {else} {*Show message to log in with link*} {/if} {else} {*Normal category behavior goes here*} {/if}
Thank you totalec for your quick response. Will it ask for registration and after login will it land on that category page to view?can you please provide me detail code to achieve the goal? Thanks a lot.
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #4  
Old 07-27-2015, 10:52 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: How to restrict a category by login only

Xtech,
What you are asking can be custom coded of course. I have provided you with an example of how to achieve what you want, it is up to you and your development team to implement it properly.

If you want to hire my team we will build this solution for you. Should only take a few hours to implement it properly.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #5  
Old 07-27-2015, 11:19 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,175
 

Default Re: How to restrict a category by login only

It's increasingly complicated due to the way x-cart handles registrations and logins. You have to pass variables through the login and registration process to identify the success redirect as well.
__________________
|
Our clients strive to be the best in their industry.
We position you for success with our strategically integrated approach to software, search engine optimization and social media.

E-COMMERCE FUTURE
https://www.stackdigital.com

LINKEDIN
https://www.linkedin.com/in/smackdigital
Reply With Quote
  #6  
Old 07-27-2015, 11:15 PM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default Re: How to restrict a category by login only

Quote:
Originally Posted by totaltec
This is just psuedo code, you should find and test for the actual variables to use:
Code:
{if $cat.categoryid eq 12} {*special behavior goes here*} {if $logged ne ''} {*Show category*} {else} {*Show message to log in with link*} {/if} {else} {*Normal category behavior goes here*} {/if}

Working like a charm.But one issue after login and register how to redirect to that current category page not on home page or cart page?

How to achieve this?
Thanks.
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #7  
Old 07-28-2015, 04:16 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: How to restrict a category by login only

Look in include/login.php I would pass a variable in the URL, from your login link. Like login.php?cat_return=1.

Then test for this in the PHP file, and if found assign a variable to smarty.

Then include a hidden input field in the login form, and populate it with 0 or 1 depending on whether this return value is set.

Then on form submission and successful login, assign the $redirect_url to your special origin point if that hidden input field is populated.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


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 not 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 11:26 PM.

   

 
X-Cart forums © 2001-2020