Post by RJonesUSC » Thu Feb 17, 2011 3:24 am

Hi, I'm new to OC only having used it for about a week now. I have a situation where I need to access user account session data on an external/non-OC page. I've done this in the past with other db apps such as phpbb and the like but I can't seem to find out how to do it with OC.

Can anyone point me in the right direction to get this done? I really just need the user_id to then query it and display info based on the user's customer group.

Thanks in advance

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by justinv » Fri Feb 18, 2011 4:52 am

Are the two sites on the same domain? If so you could write the userid into a cookie and read it that way on the other site.

Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Image


Active Member

Posts

Joined
Tue Oct 12, 2010 1:24 pm

Post by RJonesUSC » Fri Feb 18, 2011 5:19 am

Thanks for the suggestion. When setting the cookie, what variable do I use for the OC userid? In PHP, how do I call the userid, username, etc. of who's logged in? That user session handling info is what I'm after.

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by Qphoria » Fri Feb 18, 2011 5:27 am

$this->customer->getFirstName();
$this->customer->getLastName();
$this->customer->getEmail();

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by RJonesUSC » Fri Feb 18, 2011 5:31 am

Qphoria wrote:$this->customer->getFirstName();
$this->customer->getLastName();
$this->customer->getEmail();
Thanks. If I run that on a page outside of OC (say on a plan 'ol php page located at the root of the OC install) do you happen to know what includes are needed to use that class and functions?

New member

Posts

Joined
Tue Feb 15, 2011 4:03 am

Post by justinv » Fri Feb 18, 2011 8:32 am

It's not going to be simple, you'd need a hybrid of the customer class, you'd need a db connection to the OC db. The easiest way is to make the call to $this->customer->getXXXXX() and write it to a cookie. Then your other application can read it straight from the cookie.

Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Image


Active Member

Posts

Joined
Tue Oct 12, 2010 1:24 pm
Who is online

Users browsing this forum: Amazon [Bot] and 106 guests