- Posts: 431
- Thank you received: 19
Link to subcategories in listing_img_title - Done
8 years 8 months ago - 8 years 8 months ago #287208
by neo191987
Link to subcategories in listing_img_title - Done was created by neo191987
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
Now the goal is to get him to work in listing_img_title.
How can I do it?
This is the code I use
Code:
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>';}
How can I do it?
Last edit: 8 years 8 months ago by neo191987.
Please Log in or Create an account to join the conversation.
8 years 8 months ago #287234
by neo191987
Replied by neo191987 on topic Link to subcategories in listing_img_title -Done
Code:
<?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.161 seconds