Post by mminten » Fri Jun 01, 2018 4:18 am

So we are using OC 2.3.0.2 and have an abandoned cart email that gets sent from Mailchimp after 6 hours. When the link is clicked it directs the customer to the Cart Page here: https://garrysun.com/index.php?route=checkout/cart

The problem is that if they aren't logged in there may be nothing in their cart and they are sent to a 404 error page (you can see this in the link above).

Due to a bunch of broken links on our site, I am going to automatically redirect all 404 errors to the home page which would cause the cart page to get redirected automatically as well.

Is there a way to say... if the cart is empty send them to the login page so that they don't get the 404 page but if the cart has items or they are logged in then let them continue to the cart page?

Any ideas?

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by Qphoria » Sat Jun 02, 2018 9:45 pm

Why does the checkout/cart page show 404? That's the main issue...
It should show the empty cart message. if you want to redirect to login on empty then you can do the following.
But until you fix that 404 issue, it will never find the cart page to check that code.

1. EDIT: catalog/controller/checkout/cart.php

2. FIND:

Code: Select all

public function index() {
3. AFTER, ADD:

Code: Select all

if  (!$this->customer->isLogged() && !$this->cart->hasProducts() && empty($this->session->data['vouchers']) )  {
	$this->response->redirect($this->url->link('account/login'));
}

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 266 guests