Page 1 of 1

Text in pro product_id

Posted: Sat Sep 21, 2019 8:20 pm
by PVLDM
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!

Re: Text in pro product_id

Posted: Mon Sep 23, 2019 6:42 pm
by letxobnav
And the problem with this is what exactly?

Re: Text in pro product_id

Posted: Mon Sep 23, 2019 8:20 pm
by PVLDM
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.

Re: Text in pro product_id

Posted: Mon Sep 23, 2019 8:36 pm
by letxobnav
I think you should rethink your concept of duplicate pages.

Re: Text in pro product_id

Posted: Tue Sep 24, 2019 2:30 am
by PVLDM
Thank you, but you did not help me. We have no problem with takes. I pointed out the bug in the opencart.

Re: Text in pro product_id

Posted: Tue Sep 24, 2019 6:01 pm
by xxvirusxx
Yep.

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

Re: Text in pro product_id

Posted: Tue Sep 24, 2019 7:14 pm
by letxobnav
It may not be correct behaviour but it has nothing to do with duplicate pages or canonical.