VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: motobrat on July 25, 2020, 11:46:08 AM

Title: Wrong multicategory product url from base category
Post by: motobrat on July 25, 2020, 11:46:08 AM
I heve problem with multicategory products urls.
For examle i have Product A in Base category -> Category A and Category B. In the settings of Product A set Force canonical category to Category A. But URL of this product from base category is to ategory B! Why and how can i fix this?
Joomla! 3.9.20, VirtueMart 3.8.4 10335
Title: Re: Wrong multicategory product url from base category
Post by: jjk on July 25, 2020, 12:19:01 PM
My first guess is that Cloudflare's 'Rocket Loader' and/or their 'Super Cache' might cause that problem.
Title: Re: Wrong multicategory product url from base category
Post by: motobrat on July 25, 2020, 12:41:06 PM
No, at my local server the same problem.
Title: Re: Wrong multicategory product url from base category
Post by: jjk on July 25, 2020, 16:23:59 PM
Eventually the problem is that (some) of your product language tags are not set for Russian if one selects a product in Russian language.
Long time ago some people in this forum also reported 'canonical' problems when using a T3 template.
Title: Re: Wrong multicategory product url from base category
Post by: motobrat on July 26, 2020, 08:09:06 AM
The canonical link is correct on the page. But the product link is not correct from the parent category and does not match the conanic link.
Title: Re: Wrong multicategory product url from base category
Post by: motobrat on July 28, 2020, 12:33:07 PM
For example:
The canonical URL is correct on the page. But the product URL is not correct from the parent category and does not match the canonical link.
This is the product URL: https://motobrat.com.ua/mototyuning/tun-suzuki/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html
The canonical URL is https://motobrat.com.ua/mototyuning/dugi/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html
Url must be the same like canonical URL.
Title: Re: Wrong multicategory product url from base category
Post by: pinochico on July 28, 2020, 13:31:31 PM
Show admin setup for this product (category, canonical category).
If you not send, then it is only academic debate :)

And info if you use any SEF app.
Title: Re: Wrong multicategory product url from base category
Post by: motobrat on July 28, 2020, 19:47:53 PM
I dont use another sef component.
Here is screenshot of product configuration.
Title: Re: Wrong multicategory product url from base category
Post by: AH on July 29, 2020, 09:25:49 AM

This is what I see:


<base href="https://motobrat.com.ua/mototyuning/dugi/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html" />
<link href="https://motobrat.com.ua/mototyuning/dugi/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html" rel="canonical" />

<base href="https://motobrat.com.ua/mototyuning/tun-suzuki/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html" />
<link href="https://motobrat.com.ua/mototyuning/dugi/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html" rel="canonical" />

I am not sure what you expect - the canonical category is set to :
"dugi"

And is used correctly for the canonical links for both URLS
Title: Re: Wrong multicategory product url from base category
Post by: motobrat on July 29, 2020, 12:12:55 PM
I didn't say that the canonical url is not correct. incorrect link to a product from the canonical category. Here is a link to the category.
For base ctegory URL https://motobrat.com.ua/mototyuning/dugi.html
Proudct URLmust be https://motobrat.com.ua/mototyuning/dugi/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html
Like canonical URL.
Now the product URL from another category https://motobrat.com.ua/mototyuning/tun-suzuki/zadnie-dugi-mototsikla-suzuki-intruder-volusia-2c-c800-2c-c50-detail.html
In other words, the actual url must match the canonical one, so that product pages that are added in several categories will open in the same category that is specified in the product settings as canonical.
Title: Re: Wrong multicategory product url from base category
Post by: pinochico on July 29, 2020, 19:08:12 PM
> In other words, the actual url must match the canonical one, so that product pages that are added in several categories will open in the same category that is specified in the product settings as canonical.

Nop.

If you want this, I think you must use SEF app.
I see, in your T3 template all link for product is canonical - maybe is bug from template or VM.
But if you need only one link for product as active (only canonical link, other links redirect to this), then you need SEF app - I use Artio SEF.

In other words, if you go in non-canonical product category and then click on product link, you see non-canonical link - URL not changed to canonical link.
Title: Re: Wrong multicategory product url from base category
Post by: AH on July 29, 2020, 19:20:24 PM
QuoteIn other words, the actual url must match the canonical one, so that product pages that are added in several categories will open in the same category that is specified in the product settings as canonical.

That is not how VM works when it displays products that are in multiple categories

What you see it doing is how it works.

The canonical just allows you to force a "main" category in the canoncal url instead of allowing VM to do it base on the lowest category_id number

Title: Re: Wrong multicategory product url from base category
Post by: motobrat on July 29, 2020, 20:40:46 PM
I apologize for my poor English, maybe I was not able to convey the essence of the problem or you are trying to shift the responsibility, advising me to use other SEF components that will give additional load on the server and given the heavy and not sufficiently optimized component of Virtuemart, the site will work very slowly ...
One thing I don't understand is why you insist that canonical links work correctly? I had no complaints about incorrect canonical links. I just asked by what logic is the product A, which is in category A and category B, which has a canonical link to category A and an actual link to category B?
Why does a VM SEF router work like that? After all, a buyer who enters category A sees Product A, enters the link and goes to the product page, which is located in category B by the actual link. On the product page, following the links "next product" and "previous product", the buyer will not find products from category A, which are not sloping correctly. This is not only a matter of SEO, but also of site usability.
Opening a topic on the forum, I just asked how can I fix this? I have not asked anyone to do this, I will do it myself. But first I asked the developers of this component, who know the structure of their component and could suggest in which file and on which line to fix it.
Instead, I see advice to switch to a different SEF component ...
Title: Re: Wrong multicategory product url from base category
Post by: motobrat on July 29, 2020, 20:47:50 PM
Quote from: AH on July 29, 2020, 19:20:24 PM
That is not how VM works when it displays products that are in multiple categories

What you see it doing is how it works.

The canonical just allows you to force a "main" category in the canoncal url instead of allowing VM to do it base on the lowest category_id number

Apparently Virtuemart knows better which link a webmaster should install on a product and from which category. Apparently the developers were guided by this logic. Can this be changed somehow?
Title: Re: Wrong multicategory product url from base category
Post by: AH on July 30, 2020, 10:35:30 AM
I do not advise using any other plugin VM

QuoteI just asked by what logic is the product A, which is in category A and category B, which has a canonical link to category A and an actual link to category B?

Yes, that seems pretty logical to most users and good practice!

QuoteApparently Virtuemart knows better which link a webmaster should install on a product and from which category. Apparently the developers were guided by this logic. Can this be changed somehow?

VM creates its links for products - correct. That is clearly not what you want.

If you want something different you can do your own bespoke coding - maybe someone else can guide you.