Welcome Guest, Not a member yet? Register   Sign In
Getting the customer id if session is not set
#5

(07-28-2016, 04:30 AM)InsiteFX Wrote:
(07-28-2016, 04:27 AM)wolfgang1983 Wrote:
(07-28-2016, 04:19 AM)InsiteFX Wrote: You can add this to your class:

PHP Code:
// Add this as a class variable
protected static $customerId 0;

// Then to SET it do this
self::$customerId $customer_id;

// Then to GET it do this
$customer_id self::$customerId

Do I put the bottom 2 in the __construct() area?

You first need to get your customers id, I would create two new methods setCustomerId() and getCustomerId()

I see you are getting the customers id in the postLogin method so that would be were you would set it.

You get the customer id anywhere you need it after that.

Also if you do not need the customers id outside of this class then make the variable private.

Did not work returning 0
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
RE: Getting the customer id if session is not set - by wolfgang1983 - 07-28-2016, 05:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB