Post by DiZzLe » Fri Apr 01, 2016 8:28 pm

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 2813 times


Newbie

Posts

Joined
Thu Mar 31, 2016 12:25 am

Post by oc-extensions » Sat Apr 02, 2016 7:29 am

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;

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm

Post by hkcdn » Wed Jun 16, 2021 2:12 pm

How to modify it if it is opencart 3.x?

Newbie

Posts

Joined
Mon Oct 14, 2019 4:19 pm

Post by straightlight » Wed Jun 16, 2021 6:57 pm

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.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by faizanyasn » Tue Jun 22, 2021 1:50 pm

In the same way with OC 3.x you can check if customer is logged in

Code: Select all

$this->customer->isLogged()

For further assistance for Opencart Development you can reach me out at
http://asktofaizan.com/ocd.php | http://asktofaizan.com | http://alliancedigitals.com


Newbie

Posts

Joined
Tue Jan 12, 2021 2:28 pm

Post by by mona » Tue Jun 22, 2021 4:13 pm

There is a setting in admin => system => settings => options tab => Guest Checkout

Maybe I am missing something ?

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos


Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by straightlight » Tue Jun 22, 2021 5:34 pm

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.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Romeroo » Fri Jun 25, 2021 3:27 pm

I am pretty much pleased with your good work. You put really very helpful information.

Newbie

Posts

Joined
Thu Jun 17, 2021 1:30 pm
Who is online

Users browsing this forum: No registered users and 11 guests