Post by neuron » Thu Sep 03, 2020 8:32 pm

Hello,
I don't understand why such basic things are not explain in docs.
I want to change URLs such as
https://nnkaravan.dev/index.php?route=account/login
https://nnkaravan.dev/index.php?route=account/register
to
https://nnkaravan.dev/login
https://nnkaravan.dev/register

I made necessary updates to enable SEO URL's.
There are similar questions to this in this forum but they are mostly asked for Opencart v2.x
Some of the answers suggested extenstions (which are also does not support Opencart v3.x). It is basic need so it is a shame if I will need to install an extension for it. I did not find anything about how routing works in OpenCart docs.

Thanks in advance.

Newbie

Posts

Joined
Wed Aug 12, 2020 5:40 pm

Post by IP_CAM » Thu Sep 03, 2020 9:15 pm

it is a shame if I will need to install an extension for it.
You obviously expect everything for OC, to come for free. :laugh: But
OC is not a welfare Project for the poor, one just has to use Google and
some other Sites, to find out, what one's looking for, or then pay someone,
like in any other business too, to get it made, if one cannot achieve it.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by letxobnav » Thu Sep 03, 2020 9:51 pm

it is futile to make non-indexable urls SEO urls, the hint is in the SEO part.

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 neuron » Thu Sep 03, 2020 10:48 pm

IP_CAM wrote:
Thu Sep 03, 2020 9:15 pm
it is a shame if I will need to install an extension for it.
You obviously expect everything for OC, to come for free. :laugh: But
OC is not a welfare Project for the poor, one just has to use Google and
some other Sites, to find out, what one's looking for, or then pay someone,
like in any other business too, to get it made, if one cannot achieve it.
I am actively using Symfony and Codeigniter PHP frameworks. Following their documentation I can find answer for most of my needs.
It is not about being poor, I am a developer, I like to solve things myself, but Opencart documentation is not written for developers.
Need to waste some time and dig into code.

Using SEO URL's became a basic need it should be implemented within framework. I did not make a choice of using OpenCart for this project, and I am very frustrated of Opencart

Newbie

Posts

Joined
Wed Aug 12, 2020 5:40 pm

Post by letxobnav » Thu Sep 03, 2020 11:29 pm

Futile but if you insist.
in catalog/controller/startup/seo_url.php you have:

Code: Select all

				} elseif ($key == 'path') {
					$categories = explode('_', $value);

					foreach ($categories as $category) {
						$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = 'category_id=" . (int)$category . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");

						if ($query->num_rows && $query->row['keyword']) {
							$url .= '/' . $query->row['keyword'];
						} else {
							$url = '';

							break;
						}
					}

					unset($data[$key]);
				}

change that to:

Code: Select all

				} elseif ($key == 'path') {
					$categories = explode('_', $value);

					foreach ($categories as $category) {
						$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = 'category_id=" . (int)$category . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");

						if ($query->num_rows && $query->row['keyword']) {
							$url .= '/' . $query->row['keyword'];
						} else {
							$url = '';

							break;
						}
					}

					unset($data[$key]);
				} elseif ($key == 'route') {
					// no need to query root
					if ($value == 'common/home') {
						$url = '/';
					} else {
						$sql = "SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($value) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . $this->config->get('config_language_id') . "'";
						$query = $this->db->query($sql);
						if ($query->num_rows) {
							if ($url != '/') $url .= '/';
							$url .= $query->row['keyword'];
							unset($data[$key]);
						}
					}
				}

then you can add any other route like account/login in admin->design->seo url and it removes common/home

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 paulfeakins » Fri Sep 04, 2020 7:36 pm

neuron wrote:
Thu Sep 03, 2020 10:48 pm
It is not about being poor, I am a developer, I like to solve things myself, but Opencart documentation is not written for developers.
Need to waste some time and dig into code.
We are looking for documentation writers, would you volunteer?

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


User avatar
Guru Member
Online

Posts

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

Post by IP_CAM » Fri Sep 04, 2020 9:27 pm

I like to solve things myself, but Opencart documentation is not written for developers.
Well, a Documentation for OC should not be needed for DEV's, but for OC Users, because
Developers usually already know PHP, and what else might be part of such. But, in contrary
to a lot of Code, available at the Web, OpenCart ONLY serves one Purpose, and that Purpose
is, to create income, in one or the other way :D

But who would support others, and help someone, eventually ending up as direct Competitor ?!
It's one of the main problems, when it comes to such Software. And it's more a miracle, that the
OC 'Community' Idea worked so long, compared with other Projects, I've been following, during
all those Years on the Web. And as more 'complex' a Projects gets, as less 'free' is usually part of it,
by Nature of all 'business' things, that just needs to be understud.

Still, one can find lot's of 'basic' information on/about OpenCart, but it's mostly for 'older' Versions,
and out of a time, when the 'Sharing-Idea' was still part of it. I collected a range of such Links on
my Demo Site Front Pages, in the Section: Lots of free Wisdom about Opencart, and you might
find some useful 'basic' OC info, partly still valid for later OC Versions too:
http://www.bigmax.ch/shop/index.php

Just better take it, as it comes, it's of no use, to complain, because nobody else will care about ... ::) ;)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 219 guests