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

Retrieve $login variable outside of x-cart pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-17-2006, 08:56 AM
 
marnix marnix is offline
 

Newbie
  
Join Date: Apr 2006
Posts: 8
 

Default Retrieve $login variable outside of x-cart pages

I have a shop currently that has category and product pages which have html add to cart links to x-cart. I would like to have my other pages be able to retrieve the $login variable from x-cart once it is set and greet the user on all other pages not generated by the smarty engine. I've tried setting it as a session variable but that doesn't seem to work. Does anyone know how to greet users on non smarty pages?
Thanks,
Marnix
__________________
V4.1
Reply With Quote
  #2  
Old 04-17-2006, 11:09 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Might want to start here:

http://forum.x-cart.com/viewtopic.php?t=26730
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 04-17-2006, 02:25 PM
 
marnix marnix is offline
 

Newbie
  
Join Date: Apr 2006
Posts: 8
 

Default

that doesn't seem to offer how to retrieve the $login variable after it has been set though, I just need to be able to access it for other pages... any ideas?
__________________
V4.1
Reply With Quote
  #4  
Old 05-28-2006, 09:20 PM
 
jgates jgates is offline
 

Newbie
  
Join Date: May 2006
Posts: 1
 

Default

I have the same need - 1 website with 2 sections that need to be linked but separate.
Section 1. has user membership requiring login to view content/member-only pages. This is already built with custom admin front end etc
Section 2. is the site online store which takes care of prod orders + user logon details

Both sections access the same database but I don't want to make users login twice if I can just carry a session variable across between pages, accessing {$login} from the other section of the site.

Any help appreciated
__________________
v 4.1.0
Reply With Quote
  #5  
Old 07-04-2008, 07:47 PM
 
ewebartist ewebartist is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 55
 

Default Re: Retrieve $login variable outside of x-cart pages

Are there any updates on this?

I have a website running two different applications, a custom PHP application in one directory, and x-cart in another. I am interested in figuring out how to retrieve the $login variable from my custom PHP app, since I would like to show a login form if $login is empty, and hide the form if $login is set.

Also, as a side question, is it possible to retrieve cart information on non-xcart pages? Showing a mini-cart on my custom PHP app would be pretty useful as well.

Any thoughts?
__________________
Cool.

X-Cart v 4.1.8 (Live Site - Slowly dying)
X-Cart v 4.1.11 (In Development- Being born)

Joomla 1.5.6 + X-cart 4.1.11 Integration complete Killer combination!
Reply With Quote
  #6  
Old 07-05-2008, 04:59 AM
  rogue's Avatar 
rogue rogue is offline
 

X-Adept
  
Join Date: Apr 2007
Location: Loveland, Ohio
Posts: 770
 

Default Re: Retrieve $login variable outside of x-cart pages

Not very good coding practice but you can use a global variable to allow access to the data. To add this all you need is to add this line to any php module where $login is being either set and used.

Code:
global $login;

Then use the $login variable as you would normally.

To use the $login in a tpl module it will be more complicated. To access it on a tpl page you can use this code:

Code:
{php} global $login; $this->assign("login", $login); {/php}
__________________
Richard Williams
Rogue Wave Limited

Initial Inventory Imports
Daily Inventory Updates
Daily Inventory Reports
Drop Ship Support
Order Export to Shipper/Supplier
Shopping Feeds That Work
Programming for X-Cart

richard@roguewavelimited.com
http://www.roguewavelimited.com
Reply With Quote
  #7  
Old 07-08-2008, 05:52 AM
 
ewebartist ewebartist is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 55
 

Default Re: Retrieve $login variable outside of x-cart pages

Hey rogue,

Thanks! Insightful information, might come in handy for other uses. I actually found another thread that discussed how to add login/minicart functionality to non-xcart pages.

Here it is for anyone that's interested: http://forum.x-cart.com/showthread.php?t=14443

Best regards,
ewebartist
__________________
Cool.

X-Cart v 4.1.8 (Live Site - Slowly dying)
X-Cart v 4.1.11 (In Development- Being born)

Joomla 1.5.6 + X-cart 4.1.11 Integration complete Killer combination!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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:34 AM.

   

 
X-Cart forums © 2001-2020