Author Topic: Wrong category URL and SEF  (Read 629 times)

nebojsa

  • Beginner
  • *
  • Posts: 34
Wrong category URL and SEF
« on: August 14, 2020, 18:59:26 pm »
Joomla 3.9.20
VirtueMart 3.8.4 10335

I am creating multilanguage website with a commercial template and have been struggling for 3 days with bad routing and SEF. The problem was that when SEF was enabled and when you click any category it was showing wrong category URL names, wrong breadcrumbs, messing up the module positions etc.
I have searched all related topics on this forum and didn't find any solution.
So, after 3 days of struggling and not having sleep I found a solution which someone would probably find useful.
Template that I used had separate Joomla menu for showing categories. Something like side menu with categories list so visitors can find category they want easier.
That menu was created manually by adding one by one virtuemart category.
This is what caused troubles - Joomla was using SEF allias from menu, not from virtuemart, thus displaying wrong category names in urls, breadcrumbs and the most interesting-messing up module positions.
So the Joomla default behaviour is to use SEF names from menus first, then from Virtuemart.
The solution was to rename each category in joomla menu.
Remember - the alias that you give by Joomla menu will show as URL.

There, I hope I helped someone with the same problem.

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 744
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Wrong category URL and SEF
« Reply #1 on: August 14, 2020, 21:07:41 pm »
3 days? :)

After instal Artio SEF, then after 1 hour I have corectlly all URL's.
And if I use ouwn plugin Rich Snippets for Virtuemart, then breadcrumbs is corectlly in first time.

Thanks for your time and help.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3280
  • VirtueMart Version: 3.8.4
Re: Wrong category URL and SEF
« Reply #2 on: August 15, 2020, 11:43:48 am »
Quote
So the Joomla default behaviour is to use SEF names from menus first, then from VirtueMart.
The solution was to rename each category in joomla menu.

Yes very much what some people do to avoid the following "traps":

1: Dependency on VM category name - which may be better for admin use than Front end URL use
2: Dependency on VM category sequencing/hierarchy - for long tail urls - where you may want no subcategory in the url
3: Flexibility for menu creation that ignores the VM and Joomla hierarchy
4: Better breadcrumbs

You don't need and should not depend on any third party SEF tool - they just add more stuff to understand and manage and increase bloated third party reliance.


Joomla and VM SEF on with "Use full category tree for product links" enabled

This approach requires dedication as you need to create at least 2 Joomla menu items for every VM category - to reap the rewards.

Create a non displayed Joomla menu
For every VM category you want to show create a menu entry as a root entry of type VirtueMart category
  Set a name (this does not matter much - you will see why in the next step) and the alias for the URL element
       e.g. Mens clothes (Alias: clothing-mens)

You now have every category as a root which means you can move them around in VM and not have your product urls messed up - you can also change the category names in VM (maybe to allow for better admin handling) and this will not affect category "name" in your product urls

So now you need to display your categories to the shoppers

Create a "Shopfront menu"

Add whatever you like into this new displayed menu.
Whenever you want to display a VM category - set the menu as a "pointer" to the hidden category - this is known as a Joomla menu item alias 

When setting the displayed menu item you can set whatever you like for display to the shopper - the url is affected by the hidden menu alias you are pointing this menu entry at.

The advantages of doing "aliases" is that you can setup whatever hierarchy you want to display AND you can display the same category in multiple places in your shop menu structure - with no impact to the URL - you can also tweak the displayed name at any time or create slightly different display names if the item is displayed multiple times.

It can also free your VM structure up too - as you don't have to create lots of "nested" categories

So you have:
  • VM category - products are allocated to this and will be displayed when this category is "browsed"
  • Joomla hidden menu - A link to display a VM category - root menu item - Alias will be used in the product url
  • Shopfront menu - A pointer (menu item alias) to the Joomla hidden menu - The name here is what the user sees - the url component is taken from the joomla hidden menu item

If you use a Drop menu on your shop - your shopfront menu can have whatever structure you want - plus you can move items around in this menu and/or show the same "category" in multiple places all using aliases.


Dont make the "heading of a menu" an actual Joomla menu item - otherwise anything that sits below this becomes part of a Joomla hierarchy and adds to URLS and breadcrumbs! - Plus on mobile you end up clicking this

Clothing (separator)   Shoes(separator)     Women(separator)     Information(separator)
Mens(alias to A)Mens Shoes(alias to C)Clothes(alias to B)Conact us(alias to K)
Womens(alias to B)Womens shoes(alias to D)Shoes(alias to D)Shipping options(alias to L)


You can use this same approach for other Joomla menu items

  • Create an link for the contact page in a non displayed menu
  • To display, create alias links to this in any menus you have Header/Footer/Shopfront etc.
regards
A

Joomla 3.9.20
php 7.3

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 744
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Wrong category URL and SEF
« Reply #3 on: August 15, 2020, 12:39:25 pm »
Thanks AH for your info.

But there is big mistake in mind for ecommerce again and again :)
Your solutions is ok for a cup of category in eshop, but not ok for big eshop (etc. amazon.com, by czech republic - alza.cz).

Why?

Because this - "Use full category tree for product links" is big mistake for SEO.
URL for product must be short (eshop/NAME_OF_PRODUCT or eshop/CATEGORY1/NAME_OF_PRODUCT) and not long (eshop/CATEGORY1/CATEGORY2/CATEGORYX/NAME_OF_PRODUCT)

I don't like use 3d party SEF app, because increases the time of retrieving information and is the other side of the sword blade, but I must choose - automatic generating right URL and long time for loading (you have to take into account that we have thousands of categories and subcategories, for example) or manually generating URL and short time loading.

If I create eshop, than first I thinking about right structure and right method for building and then I choose.
I simply have several options to choose from and it is up to me as a speshitpillt to choose the right one for the current situation.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3280
  • VirtueMart Version: 3.8.4
Re: Wrong category URL and SEF
« Reply #4 on: August 15, 2020, 13:32:34 pm »
Quote
But there is big mistake in mind for ecommerce again and again :)
Your solutions is ok for a cup of category in eshop, but not ok for big eshop (etc. amazon.com, by czech republic - alza.cz).

Firstly - "big mistake again and again" - Please dismount your high horse and adjust your responses to reflect that you may not be the World authority on all matters.

When Amazon want to use VM - I will happily take the lead on managing the deal, until the it should be noted that I never proposed that my suggestion was the best or the only approach.

If the bulk of your customer interactions (using open source Free software) are of huge complexity and size, then you will have far more to consider than just a menu :-)

I am aiming to offer up options based on an average VM user that may have only hundreds of categories - and seek more flexibility in their operation without recourse to additional components/plugins etc.

I trust you do not think that this is simply me "proposing a theory" and that this is not deployed in a real store with many hundreds of VM categories (that have been carefully considered).

Quote
URL for product must be short (eshop/NAME_OF_PRODUCT or eshop/CATEGORY1/NAME_OF_PRODUCT) and not long (eshop/CATEGORY1/CATEGORY2/CATEGORYX/NAME_OF_PRODUCT)

Yes - we can all state the blindingly obvious. You should maybe try and understand my proposition - "It can also free your VM structure up too - as you don't have to create lots of "nested" categories "

"For every VM category you want to show create a menu entry as a root entry of type VirtueMart category"
I may not have been clear but - URLs will be short tailed:- category1/product      (that is why I went down this path in the first instance!)


Quote
After instal Artio SEF, then after 1 hour I have corectlly all URL's.
Quote
I don't like use 3d party SEF app

As you noted in your second post - For some stores that SEF option is the wrong choice and for others it may be the correct choice,  It should be judged on a case by case basis.

I simply put an expanded option in support of the original post rather than post a smile (at the time expended) and propose that I know much better what will work for their situation.

regards
A

Joomla 3.9.20
php 7.3