Post by gunownergear » Fri Aug 29, 2025 7:31 am

So, here's a good one for all of you great Opencart problem solving guru's.
Opencart version 4.1.0.3
Yes, I know, version 4 has a lot of bugs and I should be using something else...
What fun would that be?

Product Compare.
When I click on product compare on a product page I get this message:

Image

Although there is an X, which indicates the message should show until you click the X,
or click the link, this message fades fast, and if you are not quick
enough to click the link to the Product Comparison page, then I can't find
the Product Comparison page anywhere.
So, I put a link at the top of the website, between Account and Wishlist.
If you are quick enough to click the link in the message box, it takes you
to the Product Comparison page and nothing changes at the top.

Image

What I didn't see before I put the link up there, what actually happens is this:

Image

If you miss clicking the link in the message and let it fade away it changes the
Wishlist link to read Product Compare and puts a (1) next to it.
You will notice the heart is still there.
If you click on that link it shows the Wishlist page that is empty unless
you have products in your Wishlist it will show those products.
After you view that and go to something else, the link goes back to normal
reading Wishlist again.

The link that I made for Product Compare will have actual product that I want to compare.

I think when it adds the Product Compare to the top and puts the counter with it is pretty cool.
I would like that to happen.

So what I would like to do is one of these options:
1. Make that automatic link with the counter make it's own space instead of overwriting the Wishlist.
2. Make it overwrite the Product Compare link I made.
3. Make it quit overwriting the Wish list and make my link have a counter.
4. Make it so when the Compare Button is clicked on the product page it opens the Product Comparison page immediately, and have a counter on the link.
Now, that's not too much to ask, is it?

If you want to see what happens visit: https://gunownergear.com
Click on any product and then the compare button

Happy coding and thanks !
Dan

New member

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by paulfeakins » Fri Aug 29, 2025 11:06 pm

So there's some confusion about the Wishlist and Compare list?

You could report it as a bug on Github, if you're sure it happens in a fresh install?

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


User avatar
Legendary Member
Online

Posts

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

Post by gunownergear » Sat Aug 30, 2025 9:33 am

paulfeakins wrote:
Fri Aug 29, 2025 11:06 pm
So there's some confusion about the Wishlist and Compare list?

You could report it as a bug on Github, if you're sure it happens in a fresh install?
Hi Paul,
I thought I explained the problem pretty well, but I don't really know, am not "sure", if this is a "fresh" install issue.
I installed this back in March, and I'm just now getting around to see if everything is working right.
The Wishlist and the Comparison pages both "work" fine.

I had an issue with the wish list not too long age, which was solved by Exel and cgarofalo.
You can read their solutions in the post: [SOLVED] Wishlist Issues, which is posted below this post, and see if their coding could cause this problem.
The wish list issue was causing some crazy problems but seems to be fixed now.

The issue now is with compare, which is explained the best I can explain it, and even includes pictures.
The only extensions installed are Paypal, USPS shipping by Johnathan, and one called plusminus.twig.
Those seem to be working also.
Then I have modified some files to fix other things that were broken with code found here in this forum.
Some were to get rid of errors by khnaz35, which worked perfect.
I don't think I caused any problems. I have not changed anything in Compare for sure, and the ones I did change were code given to me by the experts here.
Maybe the problems are from the fresh install from March, and I am just now getting around to finding them, but I have checked out other posts and searches and did not find any topics related to this one.
I have confidence that this problem can be fixed by the knowledgeable folks here in this forum.
Thanks,
Dan

New member

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by khnaz35 » Sat Aug 30, 2025 4:51 pm

Hi Dan,
To fully isolate the issue, you can try creating a fresh store in a subdirectory and check if the problem also occurs on a clean installation. Please make sure not to install any additional extensions, plugins, modules, or themes. Just use a plain new OpenCart store and compare whether the same issue appears on the same version.

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 30, 2025 11:39 pm

Hi Guys,
OK, installed a fresh 4.1.0.3
I created an account.
When adding a product to Product Compare, it does not change the wording Wishlist to Product Compare at the top.
Nor is there any link what so ever to the Product Comparison page other than to click the link in the message you get after clicking the compare button on the product page, which fades fast.
So, what I would like to do is one of the 4 options listed near the bottom of my original post.

What the fresh install does do is the problem I had with the wishlist:

I had an issue with the wish list not too long age, which was solved by Exel and cgarofalo.
You can read their solutions in the post: [SOLVED] Wishlist Issues, which is posted below this post, and see if their coding could cause this problem.
The wish list issue was causing some crazy problems but seems to be fixed now.


Maybe some of that code which fixed wish list issue is causing this problem? That is the only changes I made to the wish list.
I'm not worried about changing core files, I am not planning to upgrade this version to a "newer" one.
Thank you for your time and help,
Dan

Update:

I believe this is the cause of the problem.
This code was used to make the wish list update (refresh).

catalog\view\javascript\common.js
Find:
Code: Select all

Code: Select all

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

Code: Select all

 if(json['total']) {
                        $('#wishlist-total').attr('title', json['total']).find('span').text(json['total']);
                    }

When I remove this code the "Wish List" text does not change to "Product Compare".
On the left side next to the numbers there is a yellow triangle with a ! that reads "['total'] is better written in dot notation"
but there a many of those in catalog\view\javascript\common.js
Any way to fix this and add a "total" to the link I made for the Product Compare?
Thanks,
Dan

New member

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by paulfeakins » Mon Sep 01, 2025 7:37 pm

gunownergear wrote:
Sat Aug 30, 2025 11:39 pm
OK, installed a fresh 4.1.0.3
I created an account.
When adding a product to Product Compare, it does not change the wording Wishlist to Product Compare at the top.
Nor is there any link what so ever to the Product Comparison page other than to click the link in the message you get after clicking the compare button on the product page, which fades fast.
So to be clear, you think this is an actual bug in OpenCart 4.1.0.3?

If so, could you report it here: https://github.com/opencart/opencart/issues

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


User avatar
Legendary Member
Online

Posts

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

Post by gunownergear » Wed Sep 03, 2025 7:03 am

paulfeakins wrote:
Mon Sep 01, 2025 7:37 pm
gunownergear wrote:
Sat Aug 30, 2025 11:39 pm

So to be clear, you think this is an actual bug in OpenCart 4.1.0.3?

If so, could you report it here: https://github.com/opencart/opencart/issues
Hi Paul,
Yes
The first problem I had was with the Wish List.
I I try to REMOVE a product from the wish list, this would happen:
My site:
Image
Fresh Opencart Install:
Image

This code fixed the Problem
catalog\controller\account\wishlist.php

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());
	}
The next problem I had was with the wish list not refreshing.
Same problem with Opencart fresh install.
This code fixed that problem:
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']);
                    }
However, this code caused another problem with the Product Compare, explained above.
Removing this code makes the wish list revert back to not refreshing.

Report to git hub?
What good would that do?
I've been to git hub. Don't understand what's going on there. Seems all that gets done there is a lot of arguing.
A lot of tags saying "needs testing" or "planned". Didn't see much for version 4.
When would they get around to fixing this? Next year? or longer.
I'm 66 years old, I might not make it that long. ;D
I say lets try to fix it here (some of it) if you folks are willing and have the time.
I know you say to use 3.0.4.1.
I really don't want to start over. Been at this since March. I only get to work on this a couple of days a week.
All I want is a simple, sell your product website. I can't believe none of this was tested before release.
4.1.0.3 has a lot of bells and whistles I simply don't need, and I'm not going to use.
I appreciate all of the help I get here.

Thanks, again,
Dan

New member

Posts

Joined
Sun Mar 16, 2025 7:06 am

Post by by mona » Wed Sep 03, 2025 5:14 pm

The reason we suggest to downgrade to 3.0.4.1 is because of all the issues with OC4. Yes some of the issues will be fixed here but you will undoubtedly find another. whilst I appreciate you saying that "all that work to start again" it is not starting again - there is an import-export tool and it will take far less time to do that (especially since it would be complete since your first issue) than it will be to fix these errors. There is the "greater good" and we all do love Opencart, but OC4 does feel like just one step too far - it does not appear to offer anything above OC3. It did try to by upgrading php - but that has now been superseded by a very stable - fast - and pretty much bug free OC3 version.

In short - fixing the bugs (known and of course unknown) in OC4 is necessary and you are happy to be a guinea pig on a live site - definitely not recommended - but your site - your customers - your choice.

It is not a criticism, in fact it is helpful for others to find the bugs so that at least they can be logged and listed on the forum and github.

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.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by paulfeakins » Wed Sep 03, 2025 6:24 pm

gunownergear wrote:
Wed Sep 03, 2025 7:03 am
Report to git hub?
What good would that do?
I've been to git hub. Don't understand what's going on there. Seems all that gets done there is a lot of arguing.
A lot of tags saying "needs testing" or "planned". Didn't see much for version 4.
When would they get around to fixing this? Next year? or longer.
I'm 66 years old, I might not make it that long. ;D
I say lets try to fix it here (some of it) if you folks are willing and have the time.
Reporting it on github should get it fixed in a release in the near future.

I for one am not willing to fix stuff here that should be fixed on github, it's a waste of time - you need to go through the proper channels.

No one wants to faff around, so if you want to save time, really you should take the advice of all the top developers, we suggest switching back to 3.0.4.1 and that will save time in the long run.

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


User avatar
Legendary Member
Online

Posts

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

Users browsing this forum: Mariah458 and 15 guests