Post by PVLDM » Sat Sep 21, 2019 8:20 pm

Hello!

We noticed that OpenCart accepts product_id numbers and text, thereby opening a double of the old page.

For example: product_id = 43AZAZAZAZAZA

https://demo.opencart.com/index.php?rou ... ZAZAZAZAZA

Code: Select all

<link href="https://demo.opencart.com/index.php?route=product/product&amp;product_id=43AZAZAZAZAZA" rel="canonical" />
<input type="hidden" name="redirect" value="https://demo.opencart.com/index.php?route=product/product&amp;[b]product_id=43AZAZAZAZAZA" />
<li><a href="https://demo.opencart.com/index.php?route=product/product&amp;product_id=43AZAZAZAZAZA">MacBook</a></li>
Such a page should give a 404 error!

We fixed this bug like this:

Code: Select all

/catalog/controller/product/product.php
				if (isset($this->request->get['product_id'])) {
				// проверка на такие товары index.php?route=product/product&path=71_77&product_id=53asdasdasd
				if(filter_var($this->request->get['product_id'],FILTER_VALIDATE_INT)){
					$product_id = (int)$this->request->get['product_id'];
				}
				else
				{
					$product_id = 0;
				}
		} else {
			$product_id = 0;
		}
		
Perhaps there is a more correct solution to the problem?

Thank!

Newbie

Posts

Joined
Sat Sep 21, 2019 8:06 pm

Post by letxobnav » Mon Sep 23, 2019 6:42 pm

And the problem with this is what exactly?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by PVLDM » Mon Sep 23, 2019 8:20 pm

A page opens where the text is indicated in product_id. Such a page should throw a 404 error.

+ such pages do not have the correct canonical = duplicate pages.

Newbie

Posts

Joined
Sat Sep 21, 2019 8:06 pm

Post by letxobnav » Mon Sep 23, 2019 8:36 pm

I think you should rethink your concept of duplicate pages.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by PVLDM » Tue Sep 24, 2019 2:30 am

Thank you, but you did not help me. We have no problem with takes. I pointed out the bug in the opencart.

Newbie

Posts

Joined
Sat Sep 21, 2019 8:06 pm

Post by xxvirusxx » Tue Sep 24, 2019 6:01 pm

Yep.

I think a product should be displayed when is an exact match and not contain something in product_id

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by letxobnav » Tue Sep 24, 2019 7:14 pm

It may not be correct behaviour but it has nothing to do with duplicate pages or canonical.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan
Who is online

Users browsing this forum: No registered users and 82 guests