Post by Monarchy Catering » Fri Jun 26, 2020 9:48 pm

OC: 3.0.3.3

Code
Submenu URL: https://www.domain.com/austria/chocolates
SEO URL: category_id=2, austria
category_id=201, chocolates
Canonical: <link href="https://www.domain.com/chocolates" rel="canonical" />
Correct Canonical: <link href="https://www.domain.com/austria/chocolates" rel="canonical" />

But this states the real URL as part of the forms for Language and Currency switching:
<input type="hidden" name="redirect" value="https://www.domain.com/austria/chocolates" />

Been trying to track down how the 'redirect' is created, but just don't have enough OC internals knowledge yet. Any help to may change the code for 'canonical'?

Thanks.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by letxobnav » Fri Jun 26, 2020 10:02 pm

OC uses the current category id for the canonical, not the path to it.

Code: Select all

			if ($page == 1) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical');
			} else {
				$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical');
			}
I use:

Code: Select all

			if ($page == 1 || $page > 2) {
				$this->document->addLink($this->url->link('product/category', 'path='.$this->request->get['path']), 'canonical');
			} else {
				$this->document->addLink($this->url->link('product/category', 'path='.$this->request->get['path'].'&page='.$page), '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

Post by Monarchy Catering » Fri Jun 26, 2020 10:49 pm

Thanks for the heads-up and code. I'll try that in a while.

I do not understand how OC v3 hangs together by virtue of the 'SEO URL' as the SEO aspect and the URL work against each other within OC. If a change is made to the SEO_URL for the sub menu, e.g. "austria/chocolates", then the browser URL becomes "austria/austria/chocolates", something has to give. SEO is so important and needs to nurtured. HREFLANG fro multilingual sites is a prime example. The language shoulde be able to be pre-fixed before any of the categories, but it just creates a nasty mess.

Thanks again.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by Monarchy Catering » Sat Jun 27, 2020 4:09 am

@letxobnav Newbie question... Can I use ocmod install file to make changes?

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <code>MC-Additions</code>
    <name>MC: Code Additions</name>
    <version>1.0</version>
    <author>MC</author>
    <link></link>
    <file path="catalog/controller/product/category.php">
        <operation>
            <search>
                <![CDATA[if ($page == 1) {]]></search>
            <add position="replace">
                <![CDATA[if ($page == 1 || $page > 2) {]]></add>
        </operation>
        <operation>
            <search>
                <![CDATA['product/category', 'path=' . $category_info['category_id']), 'canonical']]></search>
            <add position="replace">
                <![CDATA['product/category', 'path=' . $this->request->get['path']), 'canonical']]></add>
        </operation>
        <operation>
            <search>
                <![CDATA['product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical']]></search>
            <add position="replace">
                <![CDATA['product/category', 'path=' . $this->request->get['path'] . '&page=' . $page), 'canonical']]></add>
        </operation>
    </file>
</modification>

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by letxobnav » Sat Jun 27, 2020 9:33 am

Can I use ocmod install file to make changes?
OCMOD files exist to make changes, I don't use them but suggest you do.

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 Monarchy Catering » Sat Jun 27, 2020 9:06 pm

I tried the OCMOD script and I'm NOT sure if it's a problem or not, but the 'LIVE' category.php exists in the OC-Storage 'modifications' folder. Should installing the OCMOD script update the Modification version, or do I need to set a something different in the OCMOD script?

Thank you.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by letxobnav » Sat Jun 27, 2020 10:17 pm

When refreshing the modifications OC first deletes all files in the modifications directory.
Then it takes a copy of the core file.
Then it makes the changes as defined in all enabled ocmod xml files, one by one, to that copy, modifications sequence is sorted on name I think.
After all modifications have been performed on all required copies of the core files, they are written to the modification directory.

So OCMOD does not apply changes to existing modification files, it creates them from scratch using all enabled modifications targeting those files.
So multiple ocmod xml files may make changes to the category.php file, in order, and that works fine as long as those modifications do not clash with eachother.

That is why I do not use it as the correct functioning of ocmod is subject to chance/probability and I do not do "maybe it works and maybe it doesn't".

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 Monarchy Catering » Sun Jun 28, 2020 3:15 pm

Thank you for the explanation and it didnt work, so chance is not good when working with software. I manually added your changes which does scare me if ever the Theme is changed or updated.
How do users keep track of manual changes of files?

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by sw!tch » Sun Jun 28, 2020 6:21 pm

Use GIT or version control if you want to track manual changes. If you feel like playing with code - Try opencarts Event System as an alternative to OCMOD, its a shame more "Marketplace" developers don't take advantage of it.

Events are cleaner and easier to manage IMO, unfortunately even with events there are times where you are forced back to OCMOD.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by letxobnav » Sun Jun 28, 2020 9:11 pm

cleaner perhaps, not better.
As far as I can tell it was intended and designed to trigger actions based on events and is now pushed (mis-used) for making changes as well, not good.
Apart from the fact that we now have ocmod, vqmod, theme editor, events, all different methods to make changes and they all don't take eachother into account and collide constantly, brilliant.

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 Monarchy Catering » Wed Jul 01, 2020 12:31 am

Thanks both for the advice and information.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm
Who is online

Users browsing this forum: Axlagusti, niagato and 474 guests