I wasn't able to find out how OpenCart merges products with seo links on front-end. Could not find anything like LEFT JOIN seo_url table or anything. How this happens? Some cache maybe?
OpenCart v3.0.4.0
OpenCart v3.0.4.0
Not sure what "merges products with seo links" means.opensource wrote: ↑Thu Dec 12, 2024 6:55 amI wasn't able to find out how OpenCart merges products with seo links on front-end. Could not find anything like LEFT JOIN seo_url table or anything. How this happens? Some cache maybe?
OpenCart v3.0.4.0
OC translates incoming seo urls by matching the individual keywords in the seo url (divided by /) to the original querystring parameter.
(Like nice-product to product_id=453, etc).
While creating the seo urls it does the reverse (for every seo url you have on your page).
so it basically does a query per keyword and per querystring parameter to translate to and from an seo url.
I want to know which function does this on front-end. I don't see any function that would combine basic product data with seo_url table data.
In the startup
Code: Select all
public function rewrite($link) {
$url_info = parse_url(str_replace('&', '&', $link));
$url = '';
$data = array();
parse_str($url_info['query'], $data);
foreach ($data as $key => $value) {
if (isset($data['route'])) {
if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/info' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
...
...
} else {
return $link;
}
}
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
Code: Select all
controller/startup/seo_url.php
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Legendary Member
Who is online
Users browsing this forum: lockiedownunder and 14 guests