[Skip to main content](#vessel-content)

#   Create category link with content Menu alias only

##

- **[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")**
- [![pipedream's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/22364-pipedream "View pipedream's Profile") Topic Author
- [ Offline](/forum/user/22364-pipedream)

Less More

- Posts: 8
- Thank you received: 1
-
-

13 years 4 months ago -  13 years 4 months ago [\#109979](#109979) by [pipedream](/forum/user/22364-pipedream "View pipedream's Profile")  *[Create category link with content Menu alias only](/forum/4-how-to/83934-create-category-link-with-content-menu-alias-only#109979 "I am adding a link to the product category in the view product / show.php .  This link is a Menu item of the type Products listing, so it is also present in Hikashop Content menus:  Alias  Type  Link  example  product  index.php?option=com&#95;hikashop&amp;view=product&amp;layout=listing  So, in the view I was expecting this code to work:  But this returns:  /example/product/listing  Should it return the &quot;/product/listing&quot;, since it is unecessary? Is there a better way of getting only &quot;/example&quot; than doing something like this?  Thanks!")* was created by *[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")*

I am adding a link to the product category in the view **product / show.php** .

This link is a **Menu item** of the type **Products listing**, so it is also present in Hikashop **Content menus**:

| Alias | Type | Link |
|---|---|---|
| example | product | index.php?option=com\_hikashop&amp;view=product&amp;layout=listing |

So, in the view I was expecting this code to work:

Code:

JRoute::_('index.php?option=com_hikashop&amp;view=product&amp;layout=listing'.$url_itemid.$lang);

But this returns:

**/example/product/listing**

Should it return the "/product/listing", since it is unecessary?
Is there a better way of getting only "/example" than doing something like this?

Code:

preg_replace('/\/product\/listing$/', '', JRoute::_('index.php?option=com_hikashop&amp;view=product&amp;layout=listing'.$url_itemid.$lang));

Thanks!

Last edit: 13 years 4 months ago by [pipedream](/forum/user/22364-pipedream "View pipedream's Profile"). Reason: formatting

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzgzOTM0LWNyZWF0ZS1jYXRlZ29yeS1saW5rLXdpdGgtY29udGVudC1tZW51LWFsaWFzLW9ubHk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14276
-
-

13 years 4 months ago [\#110051](#110051) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Create category link with content Menu alias only](/forum/4-how-to/83934-create-category-link-with-content-menu-alias-only#110051 "I am adding a link to the product category in the view product / show.php .  This link is a Menu item of the type Products listing, so it is also present in Hikashop Content menus:  Alias  Type  Link  example  product  index.php?option=com&#95;hikashop&amp;view=product&amp;layout=listing  So, in the view I was expecting this code to work:  But this returns:  /example/product/listing  Should it return the &quot;/product/listing&quot;, since it is unecessary? Is there a better way of getting only &quot;/example&quot; than doing something like this?  Thanks!")*

Hi,

That should indeed be the case if the option "Activate smaller url" of the configuration is turned on.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzgzOTM0LWNyZWF0ZS1jYXRlZ29yeS1saW5rLXdpdGgtY29udGVudC1tZW51LWFsaWFzLW9ubHk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")**
- [![pipedream's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/22364-pipedream "View pipedream's Profile") Topic Author
- [ Offline](/forum/user/22364-pipedream)

Less More

- Posts: 8
- Thank you received: 1
-
-

13 years 4 months ago -  13 years 4 months ago [\#110118](#110118) by [pipedream](/forum/user/22364-pipedream "View pipedream's Profile")  Replied by *[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")* on topic *[Create category link with content Menu alias only](/forum/4-how-to/83934-create-category-link-with-content-menu-alias-only#110118 "I am adding a link to the product category in the view product / show.php .  This link is a Menu item of the type Products listing, so it is also present in Hikashop Content menus:  Alias  Type  Link  example  product  index.php?option=com&#95;hikashop&amp;view=product&amp;layout=listing  So, in the view I was expecting this code to work:  But this returns:  /example/product/listing  Should it return the &quot;/product/listing&quot;, since it is unecessary? Is there a better way of getting only &quot;/example&quot; than doing something like this?  Thanks!")*

It is.

**SEF url options**Code:

Simplified breadcrumbs: Yes Activate smaller url..: Yes Category SEF name.....: categoria Product SEF name......: (I left this empty)

Last edit: 13 years 4 months ago by [pipedream](/forum/user/22364-pipedream "View pipedream's Profile"). Reason: formatting

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzgzOTM0LWNyZWF0ZS1jYXRlZ29yeS1saW5rLXdpdGgtY29udGVudC1tZW51LWFsaWFzLW9ubHk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14276
-
-

13 years 4 months ago [\#110134](#110134) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Create category link with content Menu alias only](/forum/4-how-to/83934-create-category-link-with-content-menu-alias-only#110134 "I am adding a link to the product category in the view product / show.php .  This link is a Menu item of the type Products listing, so it is also present in Hikashop Content menus:  Alias  Type  Link  example  product  index.php?option=com&#95;hikashop&amp;view=product&amp;layout=listing  So, in the view I was expecting this code to work:  But this returns:  /example/product/listing  Should it return the &quot;/product/listing&quot;, since it is unecessary? Is there a better way of getting only &quot;/example&quot; than doing something like this?  Thanks!")*

Maybe you can try with ctrl instead of view and task instead of layout as that's what we're normally using inside hikashop but normally it should also work with view and layout.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzgzOTM0LWNyZWF0ZS1jYXRlZ29yeS1saW5rLXdpdGgtY29udGVudC1tZW51LWFsaWFzLW9ubHk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")**
- [![pipedream's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/22364-pipedream "View pipedream's Profile") Topic Author
- [ Offline](/forum/user/22364-pipedream)

Less More

- Posts: 8
- Thank you received: 1
-
-

13 years 4 months ago -  13 years 4 months ago [\#110161](#110161) by [pipedream](/forum/user/22364-pipedream "View pipedream's Profile")  Replied by *[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")* on topic *[Create category link with content Menu alias only](/forum/4-how-to/83934-create-category-link-with-content-menu-alias-only#110161 "I am adding a link to the product category in the view product / show.php .  This link is a Menu item of the type Products listing, so it is also present in Hikashop Content menus:  Alias  Type  Link  example  product  index.php?option=com&#95;hikashop&amp;view=product&amp;layout=listing  So, in the view I was expecting this code to work:  But this returns:  /example/product/listing  Should it return the &quot;/product/listing&quot;, since it is unecessary? Is there a better way of getting only &quot;/example&quot; than doing something like this?  Thanks!")*

Code:

JRoute::_('index.php?option=com_hikashop&amp;ctrl=product&amp;task=listing'.$url_itemid.$lang);

gives the same result:

**/example/product/listing**

Took a quick look at /components/com_hikashop/router.php and it seems that the only menu types where the crtl/task or layout/view pairs are being unset are the **category listing** and **product show**.

So, the "**/product/listing**" part can only be avoided by adding:

Code:

else if($query['view']=='product' &amp;&amp; $query['layout']=='listing'){ unset( $query['layout'] ); unset( $query['view'] ); }

which I won't add, at least until I further understand if I'm not ruining anything else.

Should HikaShop router better understand which menus correspond to its builded links, thus avoiding unecessary added segments?

Last edit: 13 years 4 months ago by [pipedream](/forum/user/22364-pipedream "View pipedream's Profile"). Reason: formatting

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzgzOTM0LWNyZWF0ZS1jYXRlZ29yeS1saW5rLXdpdGgtY29udGVudC1tZW51LWFsaWFzLW9ubHk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14276
-
-

13 years 4 months ago [\#110240](#110240) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Create category link with content Menu alias only](/forum/4-how-to/83934-create-category-link-with-content-menu-alias-only#110240 "I am adding a link to the product category in the view product / show.php .  This link is a Menu item of the type Products listing, so it is also present in Hikashop Content menus:  Alias  Type  Link  example  product  index.php?option=com&#95;hikashop&amp;view=product&amp;layout=listing  So, in the view I was expecting this code to work:  But this returns:  /example/product/listing  Should it return the &quot;/product/listing&quot;, since it is unecessary? Is there a better way of getting only &quot;/example&quot; than doing something like this?  Thanks!")*

Ok I see what you mean.

But no, if you want to have only the menu alias you should give only the menu itemid.
So I think that what you want actually is to use the code: Code:

JRoute::_('index.php?option=com_hikashop'.$url_itemid.$lang);

Because joomla already knows that you want a products listing using the type of the menu of the itemid of the URL.

That's why the URLs of products listings don't have the product/listing part.

The following user(s) said Thank You: [pipedream](/forum/user/22364-pipedream "View pipedream's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzgzOTM0LWNyZWF0ZS1jYXRlZ29yeS1saW5rLXdpdGgtY29udGVudC1tZW51LWFsaWFzLW9ubHk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")**
- [![pipedream's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/22364-pipedream "View pipedream's Profile") Topic Author
- [ Offline](/forum/user/22364-pipedream)

Less More

- Posts: 8
- Thank you received: 1
-
-

13 years 4 months ago [\#110257](#110257) by [pipedream](/forum/user/22364-pipedream "View pipedream's Profile")  Replied by *[pipedream](/forum/user/22364-pipedream "View pipedream's Profile")* on topic *[Create category link with content Menu alias only](/forum/4-how-to/83934-create-category-link-with-content-menu-alias-only#110257 "I am adding a link to the product category in the view product / show.php .  This link is a Menu item of the type Products listing, so it is also present in Hikashop Content menus:  Alias  Type  Link  example  product  index.php?option=com&#95;hikashop&amp;view=product&amp;layout=listing  So, in the view I was expecting this code to work:  But this returns:  /example/product/listing  Should it return the &quot;/product/listing&quot;, since it is unecessary? Is there a better way of getting only &quot;/example&quot; than doing something like this?  Thanks!")*

Perfect solution, merci!!!

For some mysterious reason I thought JRoute also needed the ctrl/task or view/layout pair...

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzgzOTM0LWNyZWF0ZS1jYXRlZ29yeS1saW5rLXdpdGgtY29udGVudC1tZW51LWFsaWFzLW9ubHk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.080 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
