Link to subcategories in listing_img_title - Done

  • Posts: 410
  • Thank you received: 15
6 years 2 months ago #287208

Hi, I'm trying to show categories from several parent categories. But the code I use in show_default is not working.
This is the code I use

foreach($this->categories as $category){
$categoryClass = hikashop_get('class.category');
$categoryClass->addAlias($category);
if($category->category_parent_id == '14')
$subcategory .= '<a href="'.hikashop_contentLink('category&task=listing&cid='.$category->category_id.'&name='.$category->alias,$category).'">'.($category->category_name).'</a>';}
Now the goal is to get him to work in listing_img_title.
How can I do it?

Last edit: 6 years 2 months ago by neo191987.

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

  • Posts: 410
  • Thank you received: 15
6 years 2 months ago #287234

<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = 'SELECT c.* '.
	' FROM ' . hikashop_table('product_category').' as pc '.
	' INNER JOIN '.hikashop_table('category').' AS c ON pc.category_id = c.category_id '.
	' WHERE pc.product_id = '.$this->row->product_id;
$db->setQuery($query);
$category = $db->loadObjectList();
?>

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

Time to create page: 0.060 seconds
Powered by Kunena Forum