Post by pm-netti » Thu Oct 17, 2019 5:46 pm

This start strange problem with SEO url, OC 3.0.3.2

SEO url: hornby-r8788-skaledale-rural-corrugated-nissen-hut-pre-built
language id: 1

These found from table 'seo_url', also language id is enabled in table 'language'.

My test it work, when 'missing' error status in file startup/seo_url.php:

Code: Select all

 /* else {
		$this->request->get['route'] = 'error/not_found';

		break;
}*/
But other server it is not work. What is this error? Can it is some character collate issue?

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by letxobnav » Thu Oct 17, 2019 6:02 pm

In Default OC funding the keyword is language independent, It will take the first occurrence it finds, regardless of language.
Collate error hardly, that mostly happens when you have fields with different collation and try to compare them, besides, Mysql will report such an error.

if your question is, why does this query

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE keyword = '" . $this->db->escape($part) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
not find

Code: Select all

hornby-r8788-skaledale-rural-corrugated-nissen-hut-pre-built
I would suggest to run the query yourself via phpmyadmin and see.

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 pm-netti » Thu Oct 17, 2019 6:24 pm

letxobnav wrote:
Thu Oct 17, 2019 6:02 pm
I would suggest to run the query yourself via phpmyadmin and see.
This is already checked, I am uploaded backup from table 'seo-url', there is not problem.

But new finding:

What mean 'cardinality' of table seo_url? Columns 'query' and 'keyword' cardinality is empty of my test store. But my live store column 'query' cardinality is 59 and column 'keyword' cardinality is 177.
What this cardinality do?
Last edited by pm-netti on Thu Oct 17, 2019 6:44 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by letxobnav » Thu Oct 17, 2019 6:43 pm

cardinality means how many unique values are there for the column.

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 pm-netti » Thu Oct 17, 2019 6:53 pm

letxobnav wrote:
Thu Oct 17, 2019 6:43 pm
cardinality means how many unique values are there for the column.
These Cardnality is not can change in phpmyadmin. Can these do issue?

I think, that this is Opencart bug. My test in file startup/seo_url.php:

Code: Select all

$parts = explode('/', $this->request->get['_route_']);
			
			echo "<pre>"; print_r($parts); echo "</pre>";
This create array:

Code: Select all

Array
(
    [0] => peku
    [1] => test
    [2] => peco-sl-310-nickel-silver-rail-joiners-24
)
There array is my admin username and sub domain name. Why?
This remove fisrt key ('peku'):

Code: Select all

	array_pop($parts);
This is not found SEO keyword 'test':

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE keyword = '" . $this->db->escape($part) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
And stop loop.
This is work my test server:

Code: Select all

 /* else {
					$this->request->get['route'] = 'error/not_found';

					break;
} */
But when it move to other server, it is not work.

I now try use function array_reverse.
Last edited by pm-netti on Thu Oct 17, 2019 7:26 pm, edited 2 times in total.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by letxobnav » Thu Oct 17, 2019 7:11 pm

cardinality is a measurement not a parameter so no, you cannot set it and if you think you should then you still do not understand what it is.
So what is the issue you are trying to solve now?

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 pm-netti » Thu Oct 17, 2019 7:38 pm

I am solved this? ;D
This is not need anyone foreach loop, this is work my test store:

Code: Select all

$parts = explode('/', $this->request->get['_route_']);
			
$parts = array_reverse($parts);
			
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE keyword = '" . $this->db->escape($parts[0]) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");

if ($query->num_rows) {
	
	/*
	
	 do links this 
	 
	 */
	
}  else {
		$this->request->get['route'] = 'error/not_found';
}
Is this OK? ;)

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by letxobnav » Thu Oct 17, 2019 7:46 pm

if you do not want the username and test domain to be part of the seo url, make sure your rewritebase in htaccess is correct.

array_reverse has nothing to do with it.

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 pm-netti » Thu Oct 17, 2019 7:55 pm

letxobnav wrote:
Thu Oct 17, 2019 7:46 pm
if you do not want the username and test domain to be part of the seo url, make sure your rewritebase in htaccess is correct.
This is not need do, seo url create in admin product page, is not .htaccess.
I added yet this:

Code: Select all

  if(count($parts) > 1){
     $parts = array_reverse($parts);
  }
Last edited by pm-netti on Mon Oct 21, 2019 3:37 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by letxobnav » Thu Oct 17, 2019 8:09 pm

ok,
the seo url code takes the _route_ get variable and divides it into the chunks between the "/" separator characters.
for each of those chunks as keywords it tries to find a query like product_id=34 or category_id=22...
If it can find those it will use those as the internal get variables you did not have in the seo url.

This has nothing to do with language or the order of the arrays.

But, for the last time, if your rewritebase is not set correctly for the subdirectory your shop is in, then the directory names will become part of the "_route_" get variable and you most likely do not have a matching query for those in the seo_url database and as such you will get a not found page.

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 pm-netti » Thu Oct 17, 2019 8:47 pm

letxobnav wrote:
Thu Oct 17, 2019 8:09 pm
This has nothing to do with language or the order of the arrays.
Sort order of array: However, it seems to me that the seo_url address to search for is always the last key one in the array. In this case, array_reverse "does the job to home". :)

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland
Who is online

Users browsing this forum: No registered users and 30 guests