canonical URLs

  • Posts: 158
  • Thank you received: 5
9 years 3 months ago #231449

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.1
-- Browser(s) name and version -- : chrome

I'm having a few issues with my SEF URLs. Most of my products have the correct URL i.e. www.<sitename>/<category name>/<product name> but I am seeing a large number that now have /component/hikashop added to it and I can't figure out what is causing this. All my categories have menu items so I'm confident that's not it.

I know it's possible to add the canonical URL by hand on each product, but I can't even think of a way to identify which ones need fixing.

Here is my Hikashop SEF config (I just updated the Force canonical URLs on listings from "no, generate the URLs" to "use canonical and generate if missing") Is this correct? Is there a way to update them all automatically?



Please help as this is driving me mad!

Thanks

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83933
  • Thank you received: 13588
  • MODERATOR
9 years 3 months ago #231456

Hi,

Changing that option won't help you unless you enter the correct canonical URL in your products. You should rather leave the Force canonical URLs on listings setting turned off until your modules are generating correct URLs. Otherwise, you'll have canonical URLs that you don't want in your products and you'll have to change/remove them.
If you have URLs with component/hikashop in them, it means that the module that is generating the these links has a "menu" setting which is not set to the id of a menu item of the type hikashop categories listing. Because of that the SEF system of Joomla is not able to generate links with the alias of the menu item and has to add component/hikashop instead so that the URL still works.
So you need to edit your HikaShop modules in the Joomla modules manager and check their "menu" setting under the "HikaShop options" tab and fix it.

Please Log in or Create an account to join the conversation.

  • Posts: 158
  • Thank you received: 5
9 years 3 months ago #231513

Thanks nicolas but I'm still confused as to what's causing my issue here - some products in the same category have the correct url, some don't.

I have listed my hikashop modules and the menu entry is set to 'none' but I'm not actually sure what to set it to for these modules?



I am now adding a canonical URL for each new product added but I would like to find a way of finding/editing the incorrect ones directly in the database if that's possible?

There are also some modules that I didn't create e.g. Associated products listing for category listing menu 1069 which I have disabled but I don't know what these are for either.

Thank you.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83933
  • Thank you received: 13588
  • MODERATOR
9 years 3 months ago #231522

Hi,

1. Instead of none, you should put the id of a menu item of the type hikashop categories listing, as I said previously.
When the "Force canonical URLs on listings" setting is set to use canonical URL and generate if missing, it means that when a listing of products is generated, the system will use the canonical URL instead of dynamically generating the URL. However, if the canonical URL is missing in the product, it will generate the URL dynamically and then store it as the canonical URL so that it can be used later on for other listings displays.
So the generated canonical URL for the products can have a different structure based where the product was first displayed.

2. You could run a mass action with a filter on the column "product_canonical" with a value %component/hikashop% in order to find all the products with a canonical URL with component/hikashop in it. You can use an action "display the results" to see them, or an action "update the values" on the same column to clear the canonical URLs.

3. In old versions of HikaShop, HikaShop was generating an associated products listing module for each categories listing menu item so that the module could display the products and the menu item the categories.
Now, with new versions of HikaShop, the categories menu items can directly display the products themselves without an associated module.
So these are not useful anymore unless the menu items for which they were created was not saved since you updated (it's when the menu item is saved that the settings of the associated module is ported to the menu item's new system).

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
8 years 7 months ago #251860

nicolas wrote: Hi,

Changing that option won't help you unless you enter the correct canonical URL in your products. You should rather leave the Force canonical URLs on listings setting turned off until your modules are generating correct URLs. Otherwise, you'll have canonical URLs that you don't want in your products and you'll have to change/remove them.
If you have URLs with component/hikashop in them, it means that the module that is generating the these links has a "menu" setting which is not set to the id of a menu item of the type hikashop categories listing. Because of that the SEF system of Joomla is not able to generate links with the alias of the menu item and has to add component/hikashop instead so that the URL still works.
So you need to edit your HikaShop modules in the Joomla modules manager and check their "menu" setting under the "HikaShop options" tab and fix it.


hikashop 2.6.4
Joomla 3.6.2

Should all active "HikaShop Content Modules" be linked to the samen hikashop menu(category listing) under the Hikashop option>Data display>menu (in the module) ?

Because I haven't done this.

Might this be the rasons why I get some different canoncial urls :
i.e.
"product_title/related_product-7702
"product_title"
"product_title_/category_pathwayxxx/related_product-7701

I know that this is the correct one "product_title_/category_pathwayxxx

Last edit: 8 years 7 months ago by river.

Please Log in or Create an account to join the conversation.

  • Posts: 83933
  • Thank you received: 13588
  • MODERATOR
8 years 7 months ago #251891

Hi,

There is no correct and not correct URLs. There are different URLs calculated based on how the menus and modules are configured.
There might be a version you prefer over the others, but there is no way for the canonical system to know that.
So the way it works is that when a URL of a product needs to be displayed on a listing and that there is no canonical URL, it will generate it based on the settings of the current menu/module/plugin.
So for example, if the first page which displays a link to your product page is a search page of the Joomla search module, then it will use the menu item configured in the settings of your HikaShop products search plugin. And it won't have a category_pathway since you don't come from a categories listing but directly from the search system.
That's why it's best to specify the canonical URL you want, or at least display the products listing where you want the link to be generated so that it adds it for you.

Please Log in or Create an account to join the conversation.

  • Posts: 2667
  • Thank you received: 68
8 years 7 months ago #251908

I do it with SQL

SET @lastid = 500;

UPDATE prefix_hikashop_product SET product_alias = CONCAT(product_id, '-',  product_mycustom_field,  '-any-terms') WHERE product_id > @lastid;

UPDATE prefix_hikashop_product SET product_canonical = CONCAT('/maincategory/',  product_alias)
WHERE product_id > @lastid;

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum