Page 1 of 1

Checking if customer is logged in before checkout?

Posted: Fri Apr 01, 2016 8:28 pm
by DiZzLe
Hello, Im using OpenCart 2.1.0.2 and PayPal Express for processing payments.

How can I check if the user is logged in before letting them proceed to checkout when they click the button in the cart and if they aren't, show them a message saying "You're not logged in, please log in to proceed to checkout!".

Thanks in advance! :D
buttonss.png

The button which is located on the cart page. - buttonss.png (8.32 KiB) Viewed 4173 times


Re: Checking if customer is logged in before checkout?

Posted: Sat Apr 02, 2016 7:29 am
by oc-extensions
Hi,

In cart controller you can add

Code: Select all

$data['logged'] = $this->customer->isLogged();  
In .tpl file

Code: Select all

<?php if ($logged) { ?>
 // add here image button
<?php } else { ?>
// add here login message
<?php } ?>
Of course you can add & load text messages from language file;

Re: Checking if customer is logged in before checkout?

Posted: Wed Jun 16, 2021 2:12 pm
by hkcdn
How to modify it if it is opencart 3.x?

Re: Checking if customer is logged in before checkout?

Posted: Wed Jun 16, 2021 6:57 pm
by straightlight
hkcdn wrote:
Wed Jun 16, 2021 2:12 pm
How to modify it if it is opencart 3.x?
Same with the use of Events.

Re: Checking if customer is logged in before checkout?

Posted: Tue Jun 22, 2021 1:50 pm
by faizanyasn
In the same way with OC 3.x you can check if customer is logged in

Code: Select all

$this->customer->isLogged()

Re: Checking if customer is logged in before checkout?

Posted: Tue Jun 22, 2021 4:13 pm
by by mona
There is a setting in admin => system => settings => options tab => Guest Checkout

Maybe I am missing something ?

Re: Checking if customer is logged in before checkout?

Posted: Tue Jun 22, 2021 5:34 pm
by straightlight
by mona wrote:
Tue Jun 22, 2021 4:13 pm
There is a setting in admin => system => settings => options tab => Guest Checkout

Maybe I am missing something ?
That's during. The question is before.

Re: Checking if customer is logged in before checkout?

Posted: Fri Jun 25, 2021 3:27 pm
by Romeroo
I am pretty much pleased with your good work. You put really very helpful information.

MyCardStatement