use product code in canonical url

  • Posts: 128
  • Thank you received: 3
3 years 2 weeks ago #339703

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6.40

is it not allowed to use the product code in the canonical url? example i have a product that has a product code of EX123NEW. the product is in the category of TOYS. i want the canonical url to be TOYS/EX123NEW.html so that when someone goes to the address mywebsite.com/TOYS/EX123NEW.html it will pull up that product. i've tried everything i can think of to make this work but it keeps throwing 404 errors.

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

  • Posts: 83402
  • Thank you received: 13495
  • MODERATOR
3 years 2 weeks ago #339707

Hi,

It's possible if the "alias" is the same as a product code since it's the alias which is used in the URL.
Note however that you can't make up URLs how ever you like. It seems to respect Joomla' menu item structure and SEF routing.
So for the URL mywebsite.com/TOYS/EX123NEW.html to be possible you need to:
- empty the setting "SEF product name" in the HikaShop configuration
- turn on the "Remove products and categories id in URLs" setting in the HikaShop configuration
- create a menu item with the alias "TOYS" of the type HikaShop products listing or HikaShop category listing with its "parent cateogry" setting set to the "TOYS" category in your Joomla menu manager without any parent menu item.
- set the alias "EX123NEW" in your product.

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

  • Posts: 128
  • Thank you received: 3
3 years 2 weeks ago #339715

still not working. i've went through and double checked everything. i've attached screenshots so you can check to make sure i'm not missing anything. the actual product code is TNTRMN357S125T500L and the category is ammunition. i'd like the url to be www.tntmunitions.com/ammunition/TNTRMN357S125T500L.html . i don't understand what i'm doing wrong.

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

  • Posts: 83402
  • Thank you received: 13495
  • MODERATOR
3 years 2 weeks ago #339717

Hi,

Everything seems ok.
The only reason I can see is that you're using a third party SEF extension like SH404SEF. In that case, you need to first leave the "canonical URL" field empty in the product, and access the www.tntmunitions.com/ammunition.html URL where the system will dynamically generate the SEF URL www.tntmunitions.com/ammunition/TNTRMN357S125T500L.html for the product so that SH404SEF can store the correspondance between the non SEF URL and the SEF URL in its database. It will also add back the "canonical URL" automatically in the product.

In fact, even if you don't use SH404SEF, leaving the canonical URL empty and accessing the listing page is a good way to see what URL the SEF system generates for that product.

But maybe it doesn't work because of a bug in your version of HikaShop ? If you are really on the 2.6.1, we've made many patches to the SEF system since then so it's possible that you're missing some of them, leading to this not working properly for you while the same setup works fine on my end with the latest version.

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

  • Posts: 128
  • Thank you received: 3
3 years 2 weeks ago #339727

i'm not running any 3rd party sef. i tried what you said about leaving the canonical url empty and going to the product listing page to see what url it would generate. it actually generates the appropriate url www.tntmunitions.com/ammunition/tntrmn357s125t500l.html but it doesn't work when clicking on it and throws a 404. see attached screenshot. can i fix this without updating hikashop? i'd like to update the site at some point but right now is not a good time because of time issues and i really would just like to get this to work for right now because we're trying to use qr codes for tracking, marketing, and capturing repeat sales. thanks.

Attachments:

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

  • Posts: 83402
  • Thank you received: 13495
  • MODERATOR
3 years 2 weeks ago #339729

Hi,

Well, there are several options:
- install a SEF extension like SH404SEF. With it, you can specify the SEF URL you want for each page and you can do so regardless of your Joomla menu items structure, product codes, etc. It will bypass the problem.
- debug the issue in the router of HikaShop on your website. I can't just give you some code to apply because what I have on my end with the latest version is too different from what you have and it's more likely it would break the whole shop rather than fix anything. This will require a developer to look at it for several hours I suspect. I think it will make more sense to spend that time updating HikaShop
- don't use the product code in your product URLs for now and stick to the working URLs you were using so far, until you update HikaShop and the problem fix itself with that. In that case, you could use an extension like this to handle the redirection from the URL you want to use for the QR code to the URL that are used right now for the product page: extensions.joomla.org/extension/site-man...irection/jredirects/
That way, when you update HikaShop in the future and don't have the issue anymore, you'll be able to turn off the extension and it will directly use the URLs with the format you want.

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

  • Posts: 128
  • Thank you received: 3
3 years 1 week ago #339801

i first tried the redirect extension you mentioned but i couldn't find a way to make that work for hikashop products. i've downloaded sh404sef but i can't make it work. i keep getting 404 errors. i must be missing something. i've entered something into the canonical url for sh404sef but it keeps emptying it. i've attached a couple screenshots. do you know what i may be missing?

Attachments:

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

  • Posts: 83402
  • Thank you received: 13495
  • MODERATOR
3 years 1 week ago #339804

Hi,

When using sh404SEF, you want to turn off the "force canonical URLs on listings" setting so that sh404SEF will generate the URL of the products each time.
And that way, you can then edit the entries in sh404SEF to set the URL you want for each product.

The following user(s) said Thank You: deuce4884

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

  • Posts: 128
  • Thank you received: 3
3 years 1 week ago #339857

finally got everything working with the sh404sef. thanks for all your help

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

Time to create page: 0.084 seconds
Powered by Kunena Forum