Link/Redirect from Categroy to product page

  • Posts: 38
  • Thank you received: 4
  • Hikashop Business
5 months 1 week ago #357003

-- HikaShop version -- : 5.0.1
-- Joomla version -- : 5.0.0

Hello

We are very happy with Hikashop, but we have not yet been able to solve one problem.

The products are accessible in two ways, either via DOMAIN/biere (Products Listing) or DOMAIN/brauereien (Category Listing).

If someone goes via Category Listing, for example DOMAIN/brauereien/cat/casey and selects a product, the URL is DOMAIN/brauereien/freestyle-no-7.

If the visitor goes via Products Listing and selects on a product, the URL is DOMAIN/biere/freestyle-no-7.

Is there a way that I can force the link from the category page to always redirect directly to the product page?

Current: DOMAIN/brauereien/cat/casey -> DOMAIN/brauereien/freestyle-no-7
Desired: DOMAIN/brauereien/cat/casey -> DOMAIN/biere/freestyle-no-7

Regards
Stefan

Last edit: 5 months 1 week ago by smart web.

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
5 months 1 week ago #357005

Hi,

In each product, you have a field called "canonical URL". In this field, you can enter the main relative URL you want for the product.
So for your example, it would be "biere/freestyle-no-7".
This will tell search engines which URL you want to index and will avoid SEO duplicate content issues.
Then, in your HikaShop configuration page, you can find the option "force canonical URLs on listings". With that option activated, HikaShop will use these canonical URLs on the listings and so it will do what you want.

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

  • Posts: 38
  • Thank you received: 4
  • Hikashop Business
5 months 5 days ago #357101

Many thanks for your reply. I have just tested it and it works perfectly as expected. But now we have the problem that we already have hundreds of products in the shop. We have activated the option 'Use canonical URL and generate it if missing' as a test. However, this creates useless URLs, for example

/somethingdifferent_ch/index.php/hikashop-menu-for-products-listing/prod/funky-blender-raspberry-cherry-heritage-4-cherry-blend-5-5-20

Can I set how these URLs are generated?

Is there any other way we can assign the canonical URLs via batch processing?

Regards
Stefan

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
5 months 4 days ago #357103

Hi,

First, you need to clear these automatically generated URLs with a mass action with an action "update the values" on the "product_canonical" field with an empty value.
Then, you need to understand how the "Use canonical URL and generate it if missing" setting works. When HikaShop has to display a product in a listing with that setting, if there is a canonical URL provided in a product, it will use it, otherwise it will generate it as if it was dynamically generating the URL.

The URL /somethingdifferent_ch/index.php/hikashop-menu-for-products-listing/prod/funky-blender-raspberry-cherry-heritage-4-cherry-blend-5-5-20 indicates that the product was displayed in a listing from the "hikashop-menu-for-products-listing" menu item, or in a module with that menu item selected under the "menu" setting of the module.
So supposing you don't have modules wrongly configured which display on the main products listing menu item you want to use for the URLs, you could just browse your main products listing menu item listing pages after the canonical URLs have been emptied and it would regenerate them the way you want.

An alternative would be to use a mass action with an action "update the values", but instead of using the "string" mode with an empty value to erase the canonical URL, you could use the "operation" mode with a value like this:

biere/{product.product_alias}
This however supposes that your products alias is properly configured with the alias you want to be used in the URLs and not generated from the product name. So this might not be practical.

You can read more about mass actions here:
www.hikashop.com/support/documentation/167-massaction-form.html

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

  • Posts: 38
  • Thank you received: 4
  • Hikashop Business
5 months 1 day ago #357173

Thanks for your answers, Nicolas. I feel that I am in good hands with you, thank you very much for that. Unfortunately, I have not yet been able to solve the problem.

I was able to delete the cannonical urls successfully via mass action. If I then activated the option 'Use canonical URL and generate it if missing', the url looks better. However, it is random which url is generated - depending on which url is used to call up first the product. Is there no setting for which menu item is used to generate the url?

I have also tried to create a mass action according to your instructions. However, the error message 'The table {product does not exist' is displayed. What have I set wrong? I have attached a screenshot.

By the way, I installed the latest version today, so joomla and hikashop are up to date.

Regards
Stefan

Attachments:
Last edit: 5 months 1 day ago by smart web.

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
5 months 1 day ago #357177

Hi,

Is there no setting for which menu item is used to generate the url?

No, it generates it the first time it has to use it.

I have also tried to create a mass action according to your instructions. However, the error message 'The table {product does not exist' is displayed. What have I set wrong? I have attached a screenshot.

That's my bad actually. I wrote this without checking. Here is a previous thread where we talk about the same thing with the correct answer:
www.hikashop.com/support/forum/install-u...lts-urls.html#295341

The following user(s) said Thank You: smart web

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

  • Posts: 38
  • Thank you received: 4
  • Hikashop Business
5 months 1 day ago #357214

Thank you, it works!

For all those who have found this thread: the correct setting in the operation input field at the bottom in this case is 'concat('biere/',product.product_alias)'.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.066 seconds
Powered by Kunena Forum