Post by gunownergear » Mon Aug 04, 2025 7:54 am

Greetings,
Wow, got a good one here.
Using Opencart 4.1.0.3 php version 8.3.23

Wishlist issues and I will try to explain this the best I can.

Add item to wishlist, does not update immediately, at the top of website page: wishlist(0)
Can make it update by refreshing the page, clicking on wishlist(0), or selecting another page.

Inside wishlist page, item is there, add to cart button and remove button.
Click add to cart and it does so, but does not remove item from wishlist,
even after the item has been purchased.

Here's where it gets crazy.

After purchase, without logging out, go back to wishlist to remove the item.
Click remove button and two pages appear at the same time.
One is the wishlist, with a balloon informing the item has been removed.
(Which the item has NOT been removed)
The other is the login page with a warning "Invalid token session, please log in again"
The login page is on top of the wishlist page, lower and slightly to the right of the screen.
Looks like the right column of the wishlist over the login page.
You can see the headers and the footers of both pages,
and indeed the user is logged out.
I've included a screenshot.
Image

Error in the Admin log.
2025-08-03 19:54:42 - PHP Warning: unlink(/home/gunowner/ocartdata1/storage/cache/cache.product.ae27f156d9efe2e256530f5eebca82b0.1754261552): No such file or directory in /home/gunowner/public_html/system/library/cache/file.php on line 37

Something that may be relevent is the "Invalid token session, please log in again".

When testing emails after a customer purchase, the link in the customer email goes to the login page with that message.
I thought that could be normal, but I also thought it should go to their order page. (If thy have not manually logged out.)
or at least go to the login without the message, like it does after a manual logout.
(I changed the message to read "Please Log In Again, Thank You")

Also, when checking out, I notice that sometimes I would get logged off for no reason,
when filling out the address, shipping method, payment method. Usually after clicking the payment method button,
and more often when filling the form out manually. ? Thought maybe user error ?

Hope you folks can help.
Thanks,
Dan
Last edited by gunownergear on Fri Aug 08, 2025 7:56 am, edited 1 time in total.

New member
Online

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by paulfeakins » Mon Aug 04, 2025 10:05 pm

A few things ...

What theme are you using?
Most developers don't recommend OC4 at this point.
This probably may well be caching at your web host so you should ask them.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by gunownergear » Tue Aug 05, 2025 6:15 am

Using the default opencart theme.

I emailed my hosting server, who also is a good friend of mine and he said:

"We are not caching anything on the server. There is caching of code in
OpenCart but I don't think that would cause the issues you are showing. I'm
sure you are refreshing the code cache on the OpenCart dashboard after
making code changes.

I created an account and was able to reproduce the issue. It seems like the
problem is with the "Remove the wish list item" where it seems to be
resetting the session and logging you out. If I log back in and go to wish
list then it shows that the item I removed is still there. "


Yes I do refresh after I make coding changes, but in this case I did not make any changes.
I was just checking my site to make sure everything is working and have never checked the wish list before.
Last edited by gunownergear on Wed Aug 06, 2025 6:30 am, edited 1 time in total.

New member
Online

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by ADD Creative » Tue Aug 05, 2025 3:32 pm

The issues of the wish list not updating and the error when trying to delete seem to be bugs in 4.1.0.3.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by gunownergear » Wed Aug 06, 2025 6:34 am

ADD Creative wrote:
Tue Aug 05, 2025 3:32 pm
The issues of the wish list not updating and the error when trying to delete seem to be bugs in 4.1.0.3.
So, can anyone here let me know if these "bugs" can be fixed ?

New member
Online

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by paulfeakins » Wed Aug 06, 2025 6:06 pm

gunownergear wrote:
Wed Aug 06, 2025 6:34 am
So, can anyone here let me know if these "bugs" can be fixed ?
At this point most top developers recommend using 3.0.4.1.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by Exel » Thu Aug 07, 2025 7:27 am

gunownergear wrote:
Wed Aug 06, 2025 6:34 am
ADD Creative wrote:
Tue Aug 05, 2025 3:32 pm
The issues of the wish list not updating and the error when trying to delete seem to be bugs in 4.1.0.3.
So, can anyone here let me know if these "bugs" can be fixed ?
The problem with the wishlist updating at the top is it's not being targeted anymore, semi hacky way to fix it for now:

catalog\view\javascript\common.js

Find:

Code: Select all

                    if (url !== undefined && target !== undefined) {
                        $(target).load(url);
                    }
Below it add:

Code: Select all

                    if(json['total']) {
                        $('#wishlist-total').attr('title', json['total']).find('span').text(json['total']);
                    }
Will look at the signing out error later.

Newbie

Posts

Joined
Sat Feb 13, 2021 5:16 pm

Post by Exel » Thu Aug 07, 2025 11:28 am

To fix the logout issue:

catalog\controller\account\wishlist.php

Find

Code: Select all

	/**
	 * List
	 *
	 * @return void
	 */
	public function list(): void {
		$this->load->language('account/wishlist');

		if (!$this->load->controller('account/login.validate')) {
			$this->session->data['redirect'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language'));

			//$this->response->redirect($this->url->link('account/login', 'language=' . $this->config->get('config_language'), true));
		}

		$this->response->setOutput($this->getList());
	}
Replace with:

Code: Select all

	/**
	 * List
	 *
	 * @return void
	 */
	public function list(): void {
		$this->load->language('account/wishlist');

		if (!$this->load->controller('account/login.validate')) {
			$this->session->data['redirect'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language'));
		} else {
			$this->response->redirect($this->url->link('account/login', 'language=' . $this->config->get('config_language'), true));
		}

		$this->response->setOutput($this->getList());
	}

Newbie

Posts

Joined
Sat Feb 13, 2021 5:16 pm

Post by gunownergear » Fri Aug 08, 2025 7:54 am

Exel !
Thank you ! Now at least it doesn't show the bizarre double page and removes the item and keeps me logged in !
Some code and the addition of a little word "else"
Are you for hire?

New member
Online

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by khnaz35 » Fri Aug 08, 2025 12:03 pm

Where did you got stuck?

Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy. :-*

Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by gunownergear » Sat Aug 09, 2025 8:18 am

khnaz35 wrote:
Fri Aug 08, 2025 12:03 pm
Where did you got stuck?
Hey khnaz35,
How are you doing, just going through my site. A lot of things good, a lot of thing not so good.
Wish List was really screwed up, but as it turns out it fairly easy if you're you or Excel knowing what to do.
Wish List still needs tweaked but at least now it doesn't lock up the site.
If a customer would want to return something, I, the admin, wouldn't know immediately because it doesn't send the admin an email notice.
The compare doesn't work. Probably other stuff too.
I guess I should do what everybody else is saying, use 3.0.4.1
but if it's the simple things like adding a line of code here, and the word "else" there, I think it could work out ok.
Hope you all are well, and I really appreciate the help in this forum

New member
Online

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by Exel » Sat Aug 09, 2025 8:53 am

Feel free to post a list and explanation of the things not working and I can take a look at them :)

Newbie

Posts

Joined
Sat Feb 13, 2021 5:16 pm

Post by gunownergear » Sat Aug 09, 2025 8:58 am

Exel wrote:
Sat Aug 09, 2025 8:53 am
Feel free to post a list and explanation of the things not working and I can take a look at them :)
Thank you ! I will. Ready? LOL I will start some new topics.

New member
Online

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by cgarofalo » Mon Aug 25, 2025 8:51 pm

The above solution resulted in 500 errors, I have tweaked the function as follows, and works without issue:

Code: Select all

	/**
	 * List
	 *
	 * @return void
	 */
	public function list(): void {
		$this->load->language('account/wishlist');

		if (!$this->load->controller('account/login.validate')) {
			$token = isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : '';
			$this->session->data['redirect'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language') . $token);
		}

		$this->response->setOutput($this->getList());
	}
It's just a matter of the missing customer token. Hope this helps someone.

Newbie

Posts

Joined
Wed Jul 23, 2025 1:38 am

Post by gunownergear » Wed Aug 27, 2025 7:48 am

cgarofalo wrote:
Mon Aug 25, 2025 8:51 pm
The above solution resulted in 500 errors, I have tweaked the function as follows, and works without issue:

Code: Select all

	/**
	 * List
	 *
	 * @return void
	 */
	public function list(): void {
		$this->load->language('account/wishlist');

		if (!$this->load->controller('account/login.validate')) {
			$token = isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : '';
			$this->session->data['redirect'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language') . $token);
		}

		$this->response->setOutput($this->getList());
	}
It's just a matter of the missing customer token. Hope this helps someone.
Thanks cgarofalo,
I don't remember getting any 500 errors, and still have not with Exel's solution.
I tried your solution and it works great also !
Thank you for your time. I'm sure it will help others too.
It's guys like you and the rest of the folks that post here, that help out others, that makes this forum great !
Thank you all,
Dan

New member
Online

Posts

Joined
Sun Mar 16, 2025 7:06 am
Who is online

Users browsing this forum: gunownergear and 12 guests