SEF url's in Maximenu

  • Posts: 290
  • Thank you received: 22
7 years 4 months ago #257956

-- HikaShop version -- : 3.6.4
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.0.13

Hi,
I have a question about the generation of SEF url's.
There is a different result between a Hikashop categorie list and the Megamenu CK.

My situation is :
For all categorie listings I manually made a menu-item for having nicer SEF url's. When I click on a menu-item that is a categorielisting I get all the sub-categories (all is fine). When I hover over a sub-categorie I see the nice SEF url without the word "category" in the url.
When I unpublish the menu-item of the sub-categorie the url of the sub-categorie has the word "category" back into the url.

Now I'm using Maximenu to create a menu showing all the categories in 1 big list and it works fine.
The only thing that is different is that no matter if I publish or unpublish the menu-items for sub-categories, I allways get the word "category" in the url.

For example :
Normal Hikashop url : www.website.nl/webshop/opbergen
Url with Maximenu : www.website.nl/webshop/ categorie/opbergen

Can anybody explain this ?

Thanks !

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

  • Posts: 73
  • Thank you received: 3
7 years 4 months ago #257979

Hi
@Nicolas @Jerome
nico is using the latest version of Maximenu CK- Hikashop with the native integration

By my side in the code the url is generated like this

JRoute::_('index.php?option=com_hikashop&ctrl=category&task=listing&cid=' . $item->id . '&name=' . $itemalias . $itemid);

the $itemid is
'&Itemid=' . $hikashopitemid
which is an option where the user (nico) selects the menu item that points to a "categories listing" item

Let me know if there is anything to fix in the code of the plugin to be in accordance with the url management in Hikashop
CEd

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
7 years 4 months ago #257993

Hi,

That's normal then.
The code @ced1870 is using in maximenu will generate a URL based on the SEF settings on your HikaShop.
The "category" part comes from the setting "Category SEF name". So when the router system of HikaShop converts the non-SEF URL into a SEF URL it uses that setting to add it to the SEFed URL.
If you don't see it when HikaShop gives the URL but you do with something else, it means that the URL given by HikaShop is not generated, it's the canonical URL of the element.
And it corresponds to the code @ced1870 is using, which doesn't take into account the canonical URL of the elements.

Instead of your code, you could use that code:
hikashop_contentLink('category&task=listing&cid='.$item->id.'&name='.$itemalias.$itemid,$item);

Provided that $item->category_canonical contains the category_canonical value of the category, HikaShop will automatically either use the canonical URL of the category or generate the URL (and fill the canonical URL if necessary based on the settings of the HikaShop configuration).

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

  • Posts: 73
  • Thank you received: 3
7 years 4 months ago #258039

Thanks Nicolas
I have sent a new version to Nico of my code using hikashop_contentLink() and it seems to work
Great news !

The following user(s) said Thank You: Jerome

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

Time to create page: 0.072 seconds
Powered by Kunena Forum