Skip to main content

Display category (and link) in cart

11 years 6 months ago #202591 by simonev
-- 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:
<?php foreach($this->categories as $category){ $categoryClass = hikashop_get('class.category'); $categoryClass->addAlias($category); echo '<a href="'.hikashop_contentLink('category&task=listing&cid='.$category->category_id.'&name='.$category->alias,$category).'">'.($category->category_name).'</a>'; } ?>

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

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

11 years 6 months ago #202632 by Jerome
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

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: simonev

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

11 years 6 months ago #203120 by simonev
Ok thank you!

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

Time to create page: 0.063 seconds
Powered by Kunena Forum