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

#   Display category (and link) in cart

##

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

Less More

- Posts: 59
- Thank you received: 0
-
-

11 years 6 months ago [\#202591](#202591) by [simonev](/forum/user/30589-simonev "View simonev's Profile")  *[Display category (and link) in cart](/forum/27-checkout/877124-display-category-and-link-in-cart#202591 "-- HikaShop version -- : 2.4.0 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.5  Hi,  I'm trying to show categories for each product in cart. I'm editing this view: checkout / cart.php. I tried to use this code which works well in product page but in cart it shows nothing.  How can I show categories for each product? Thank you so much.")* was created by *[simonev](/forum/user/30589-simonev "View simonev's Profile")*

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.5

Hi,

I'm trying to show categories for each product in cart.
I'm editing this view: checkout / cart.php.
I tried to use this code which works well in product page but in cart it shows nothing.
Code:

&lt;?php foreach($this-&gt;categories as $category){ $categoryClass = hikashop_get('class.category'); $categoryClass-&gt;addAlias($category); echo '&lt;a href="'.hikashop_contentLink('category&amp;task=listing&amp;cid='.$category-&gt;category_id.'&amp;name='.$category-&gt;alias,$category).'"&gt;'.($category-&gt;category_name).'&lt;/a&gt;'; } ?&gt;

How can I show categories for each product?
Thank you so much.

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

11 years 6 months ago [\#202632](#202632) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Display category (and link) in cart](/forum/27-checkout/877124-display-category-and-link-in-cart#202632 "-- HikaShop version -- : 2.4.0 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.5  Hi,  I'm trying to show categories for each product in cart. I'm editing this view: checkout / cart.php. I tried to use this code which works well in product page but in cart it shows nothing.  How can I show categories for each product? Thank you so much.")*

Hi,

Showing the product categories in the cart is quite more complex.
The code you're referring to is from a total different context and it won't work for sure ; mostly because you do not have the categories loaded (and also because the context is the right one).

When you're in the cart, you have several products and each product can have several categories.
You will find some useful information in that thread :
[ www.hikashop.com/forum/checkout/874364-c...-entry-products.html](http://www.hikashop.com/forum/checkout/874364-checkout-get-category-data-of-the-entry-products.html)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

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

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

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

Less More

- Posts: 59
- Thank you received: 0
-
-

11 years 6 months ago [\#203120](#203120) by [simonev](/forum/user/30589-simonev "View simonev's Profile")  Replied by *[simonev](/forum/user/30589-simonev "View simonev's Profile")* on topic *[Display category (and link) in cart](/forum/27-checkout/877124-display-category-and-link-in-cart#203120 "-- HikaShop version -- : 2.4.0 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.5  Hi,  I'm trying to show categories for each product in cart. I'm editing this view: checkout / cart.php. I tried to use this code which works well in product page but in cart it shows nothing.  How can I show categories for each product? Thank you so much.")*

Ok thank you!

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

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