Forums / Managing Customers and Orders / Check if customer is logged in

Check if customer is logged in

Views: 1,120

Results 1 to 3 of 3
28 Sep 2014, 11:06 PM
#1
flyvholm avatar

flyvholm

New Zenner

Join Date:
Jul 2014
Location:
Denmark
Posts:
27
Plugin Contributions:
0

Check if customer is logged in

Is there a foolproof way of checking whether a customer is logged in? I had hoped $_SESSION['customer_id'] would do the job, but when checking out with COWOA this variable is set once the customer has entered the billing address.

Background: I've made a row of custom buttons to be displayed at all times. Which buttons should show depends on whether a customer is logged in, and it's not so good that a COWOA customer would appear as having an account and being logged in as soon as they've gone through the first step of supposedly account-less checkout.

28 Sep 2014, 11:47 PM
#2
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: Check if customer is logged in

flyvholm:

Is there a foolproof way of checking whether a customer is logged in? I had hoped $_SESSION['customer_id'] would do the job, but when checking out with COWOA this variable is set once the customer has entered the billing address.

Background: I've made a row of custom buttons to be displayed at all times. Which buttons should show depends on whether a customer is logged in, and it's not so good that a COWOA customer would appear as having an account and being logged in as soon as they've gone through the first step of supposedly account-less checkout.

if your using the current version of COWOA then you would do the same as what's required for login...

<?php if ($_SESSION['customer_id'] && (!$_SESSION['COWOA']=='True')) { ?>  
A customer is logged on button code here...
<?php } else {  ?>
not a customer button code here...
<?php } ?>

Dave
Always forward thinking... Lost my mind!

29 Sep 2014, 10:40 PM
#3
flyvholm avatar

flyvholm

New Zenner

Join Date:
Jul 2014
Location:
Denmark
Posts:
27
Plugin Contributions:
0

Re: Check if customer is logged in

Dave,

Thanks a lot for your prompt and accurate reply. So far that appears to work exactly the way I had hoped. I should have been able to figure that out for myself, but at least now the answer can be found here and may perhaps save somebody else some time.