Resolve link structure once and for all

  • Posts: 198
  • Thank you received: 5
9 years 3 months ago #238424

-- url of the page with the problem -- : pearblossomfarms.com
-- HikaShop version -- : 2.6.2
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.4
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : n/a

I have been struggling with trying to create elegant links for my store's products and I am at a complete loss after reading almost every post on this matter in the forum.
I used canonical links, I have used redirects, I am at the end of my rope because I figure something big is evading my scrutiny.

Let me try to explain. There are two aspects to this issue that I need to resolve. One is dependent on the other.

1) Difference between link to category or Product from the main menu
WHen I create a link to a category (lets keep it simple) from the Joomla main menu and using the Hikashop type menmu link I get a link that looks like this:

https://pearblossomfarms.com/products/jalapeno-sauces
But when I click on the same category from the list of categories in the home page (in other words, not by using a menu link but by clicking on the title of the category in a category list module, this is what I get:
https://pearblossomfarms.com/categories/category/soft-jelled-jellies

I happen to dislike both these links. My ideal link would say:
https://pearblossomfarms.com/soft-jelled-jellies

But I seem unable to make hikashop create such a simple link. At the very least, I would like those two links to be the same, but the only way I can accomplish that is by using the Canonical Link feature. That has been touch and go. The canonical links all worked fine until a couple of days ago, until they all broke and all my categories (and products it turns out) gave me 404 pages. I cannot recall doing any change that could have obliterated the canonical links.

Is there a way to create links, no matter if from the category list or if from the Main Menu simply have a structure like this:

domain.com/category-name (for the categories)

domain.com/category-name/product-name (for the products)

???

By the way, one of the links to a single product I am getting after arriving to the category page looks like this:
https://pearblossomfarms.com/products/jalapeno-sauces/product/dads-red-jalapeno-sauce-bottle

Which reduced to the pattern above would look like this:

domain.com/products/category-name/product/product-name

Why do I need the extra /products/ and /product/ before the actual names of (respectively) the category name and the product name in the link? As long as they are unique, why is Hikashop adding these terms in the link and how do I make it stop and simply build links as the example above?

Also, why would a hikashop link to a product or category be different than the same link but generated not from the menu, but from the category list? I don't want to place a canonical link in every product or have to create a menu link for every product. I want hikashop to create a simple, elegant link whether that link is in the menu or in the product list.

Thank you. Sorry if I seem frazzled. It's because I am, and I realize I could be doing something wrong that is causing this. Please set me straight.

Last edit: 9 years 3 months ago by conticreative.

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

  • Posts: 198
  • Thank you received: 5
9 years 3 months ago #238427

OK, I answered part of my question.

In the preferences, I set:
Category SEF name = category
Product SEF name = (empty)

and at least now the "product" part of the URL is gone. Yet the /category/ part remains and there is no way to take that out, because Hikashop interprets a "null" value as being the same value for both products and categories.

I realize that I could put something like /cat/ or even just /c/ , but I want that /category/ part of the URL gone. Then if I am stupid enough to create a category and a product name with the same alias, woo on me, bury me at the 50 yard line of Yankee Stadium and erase me from the history books.

The other thing I would love to solve, of course, is why hikashop cannot create a unique category link for a given category when using the Hikashop menu. Canonical URLs are fine and dandy, but I have learn not to trust them when every single one of them stopped working overnight. I don't want to have to change all the canonicals every time I make a small change to simplify the links, or at least, I want them to still work even if I change the link structure as I just did. Can't be too hard.

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

  • Posts: 84233
  • Thank you received: 13675
  • MODERATOR
9 years 3 months ago #238448

Hi,

SEF URLs is a complex matter because Joomla makes it so.

A URL is constructed like that:
parent menu item alias if any / menu item alias / SEF name / element alias

The SEF name allows HikaShop to know whether the element being called is a product or a category.
The parent menu item alias and the menu item alias are added automatically by Joomla's SEF system.

Removing the SEF name completely from the URLs is possible. You need to do two things:
- empty the product SEF name
- create a menu item for each of your categories with the same structure.
That way, the links of the categories will be automatically the links of the menu items and the category SEF name won't be needed.

Then, you say that you want to remove the "categories" part of the URL. That part is the menu item alias which is added automatically by Joomla's SEF. The only way to remove it is to make that menu item as the default menu item of the website.

So it's technically possible to have the URLs you want with the default Joomla SEF system and HikaShop, but it might require adapting your Joomla menu items structure, because that's how is made the Joomla SEF system.

Otherwise, a more flexible but more time consuming solution is to use a 3rd party SEF extension like SH404SEF with its URL alias system, which allows you to change each URL to whatever you want manually.

Why does HikaShop have canonical URLs in the first place ?
It's because you can potentially reach a product from different menu items and thus different links (because the menu items would have different aliases, and might be configured differently). Having a canonical URL allows you to tell search engines which is the main URL of the product and also to not flag the other ones as duplicate content. That's it.
We've extended that system in 2 ways:
1. We've allowed you to have the canonical URLs used directly in the listings so that you'll only get that one same link going to the product (it can be handy for modules assignment, template assignment, etc) so that the customer always see the product with the same layout.
2. We've added the possibility to let the system generate automatically the canonical URLs for you so that when the canonical URL is not provided and the system has to display a link to the product page, it store that link as the new canonical URL of the product.

The thing is that the canonical URLs doing fix the Joomla SEF. If you change the menu item structure, and the URLs of the products are different, the canonical URLs will not work anymore because Joomla's SEF doesn't backtrack the changes to the old URLs. Having the canonical URLs update when you change the menu structure is impossible. For once, Joomla doesn't have the necessary triggers to plug HikaShop at that point. And also, updating several thousand products URLs at that point would probably crash the page processing because of too much resources being used. And finally, calculating the correct URL out of the menu item structure, the SEF settings of Joomla, the SEF settings of HikaShop, the settings of the categories and of the products involved is actually quite complex to do. So we don't have any viable solution to the problem of keeping the canonical URLs working if you change the menu item structure because the SEF system of Joomla isn't meant for that.

Actually, if you have only one way of accessing a product on your website (ie your website is properly configured and not too complex in its structure), you'll have only one link to the product page, and you actually don't even need canonical URLs.

Please remember that HikaShop is an e-commerce extension first, not a SEF extension. The SEF links generation is something that should normally be handled by the SEF system and there are third party SEF extensions who integrate with HikaShop to have adapted links generated automatically with potentially better solutions and more options to have the URLs you want.

The following user(s) said Thank You: Batas, conticreative

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

  • Posts: 198
  • Thank you received: 5
9 years 3 months ago #238604

Thank you for the detailed explanation. It makes a lot of sense and I am kicking myself for not figuring out some of those things on my own.

I am actually pretty happy about the way I set up the links right now, but I figured I may be able to do even better if I move the links to a "hidden" menu where all the categories are top level and place their alias in the Main menu under "products". That way, I may be able to take the menu nale off the URL and finally achieve the ideal structure I am looking for.

Had this been any other component, ZI would have recognized immediately that I was looking at the menu name, but somehow I had a brain freeze in that respect. Convinced Hika was the culprit.

I have also just discovered there has been a pretty profound change in the way the menu and the modules work. I used to make these changes in the modules, but now it tells me I need to do it in the menu as the module interface has been deprecated (even though, changes I make still seem to work.

Anyway, Thank you again for the explanation. Very useful.

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

Time to create page: 0.069 seconds
Powered by Kunena Forum