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

#   Showing a category list on a product page

##

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

Less More

- Posts: 25
- Thank you received: 1
-
-

13 years 2 months ago [\#119274](#119274) by [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")  *[Showing a category list on a product page](/forum/31-development/861171-showing-a-category-list-on-a-product-page#119274 "-- HikaShop version -- : 2.1.3 -- Joomla version -- : 3.1.5 -- PHP version -- : 5.4.10 -- Browser(s) name and version -- : Chrome 28  Hi, I want to display a category menu on a sidebar for the product page. I'm running an antiques website and the categories of the products are like: Textiles - Bags - - Subcat #XXX - - - Product from subcat #XXX - - Product from Bags... - Shawls - Ponchos Masks - Subcategory...  I'm building custom joomla templates for all these. I want to display a sidebar on the left for every product page. The issue is that I want this sidebar categories always from the categories at level 2. For example, if I'm on the page of the &quot;Product from Bags&quot;, I want to display the menu as Bags Shawls Ponchos  And so if I'm in &quot;Product from Subcat #XXX&quot;. I managed to do it easily in &quot;Bags&quot;, by using the JDocumentRenderer to render a module position as &quot;sidebar-product-&quot;+$product-&gt;parent&#95;category&#95;id (pseudocode), and generating a content module for each parent category (Textiles, Masks, and so on). The issue here is with categories deeper (like &quot;Subcategory #XXX&quot;), and product pages. So how can I retrieve the parent category ID at level #2 for categories as well as products?")* was created by *[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")*

-- HikaShop version -- : 2.1.3
-- Joomla version -- : 3.1.5
-- PHP version -- : 5.4.10
-- Browser(s) name and version -- : Chrome 28

Hi, I want to display a category menu on a sidebar for the product page. I'm running an antiques website and the categories of the products are like:
Textiles
- Bags
- - Subcat #XXX
- - - Product from subcat #XXX
- - Product from Bags...
- Shawls
- Ponchos
Masks
- Subcategory...

I'm building custom joomla templates for all these. I want to display a sidebar on the left for every product page. The issue is that I want this sidebar categories always from the categories at level 2. For example, if I'm on the page of the "Product from Bags", I want to display the menu as
Bags
Shawls
Ponchos

And so if I'm in "Product from Subcat #XXX". I managed to do it easily in "Bags", by using the JDocumentRenderer to render a module position as "sidebar-product-"+$product-&gt;parent_category_id (pseudocode), and generating a content module for each parent category (Textiles, Masks, and so on). The issue here is with categories deeper (like "Subcategory #XXX"), and product pages. So how can I retrieve the parent category ID at level #2 for categories as well as products?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MTE3MS1zaG93aW5nLWEtY2F0ZWdvcnktbGlzdC1vbi1hLXByb2R1Y3QtcGFnZT90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

13 years 2 months ago [\#119427](#119427) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Showing a category list on a product page](/forum/31-development/861171-showing-a-category-list-on-a-product-page#119427 "-- HikaShop version -- : 2.1.3 -- Joomla version -- : 3.1.5 -- PHP version -- : 5.4.10 -- Browser(s) name and version -- : Chrome 28  Hi, I want to display a category menu on a sidebar for the product page. I'm running an antiques website and the categories of the products are like: Textiles - Bags - - Subcat #XXX - - - Product from subcat #XXX - - Product from Bags... - Shawls - Ponchos Masks - Subcategory...  I'm building custom joomla templates for all these. I want to display a sidebar on the left for every product page. The issue is that I want this sidebar categories always from the categories at level 2. For example, if I'm on the page of the &quot;Product from Bags&quot;, I want to display the menu as Bags Shawls Ponchos  And so if I'm in &quot;Product from Subcat #XXX&quot;. I managed to do it easily in &quot;Bags&quot;, by using the JDocumentRenderer to render a module position as &quot;sidebar-product-&quot;+$product-&gt;parent&#95;category&#95;id (pseudocode), and generating a content module for each parent category (Textiles, Masks, and so on). The issue here is with categories deeper (like &quot;Subcategory #XXX&quot;), and product pages. So how can I retrieve the parent category ID at level #2 for categories as well as products?")*

Hi,

The current product/category id is stored in the cid parameter of the URL.
Once you retrieve it, you can load the categories of the product via a query to the hikashop_product_category table, and for the parents of categories, you can look in the hikashop_category table.

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

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

Less More

- Posts: 25
- Thank you received: 1
-
-

13 years 2 months ago [\#119578](#119578) by [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")  Replied by *[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")* on topic *[Showing a category list on a product page](/forum/31-development/861171-showing-a-category-list-on-a-product-page#119578 "-- HikaShop version -- : 2.1.3 -- Joomla version -- : 3.1.5 -- PHP version -- : 5.4.10 -- Browser(s) name and version -- : Chrome 28  Hi, I want to display a category menu on a sidebar for the product page. I'm running an antiques website and the categories of the products are like: Textiles - Bags - - Subcat #XXX - - - Product from subcat #XXX - - Product from Bags... - Shawls - Ponchos Masks - Subcategory...  I'm building custom joomla templates for all these. I want to display a sidebar on the left for every product page. The issue is that I want this sidebar categories always from the categories at level 2. For example, if I'm on the page of the &quot;Product from Bags&quot;, I want to display the menu as Bags Shawls Ponchos  And so if I'm in &quot;Product from Subcat #XXX&quot;. I managed to do it easily in &quot;Bags&quot;, by using the JDocumentRenderer to render a module position as &quot;sidebar-product-&quot;+$product-&gt;parent&#95;category&#95;id (pseudocode), and generating a content module for each parent category (Textiles, Masks, and so on). The issue here is with categories deeper (like &quot;Subcategory #XXX&quot;), and product pages. So how can I retrieve the parent category ID at level #2 for categories as well as products?")*

Thanks, I'll try that

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MTE3MS1zaG93aW5nLWEtY2F0ZWdvcnktbGlzdC1vbi1hLXByb2R1Y3QtcGFnZT90bXBsPW1hcmtkb3du) 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.048 seconds

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