Display category (and link) in cart

  • Posts: 59
  • Thank you received: 0
8 years 11 months ago #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.

<?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.

  • Posts: 26008
  • Thank you received: 4004
  • MODERATOR
8 years 11 months ago #202632

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: simonev

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

  • Posts: 59
  • Thank you received: 0
8 years 10 months ago #203120

Ok thank you!

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

Time to create page: 0.038 seconds
Powered by Kunena Forum