[SOLVED] Display categories in product layout

  • Posts: 36
  • Thank you received: 6
11 years 11 months ago #79504

I have some product info that I would like to manage as categories for two reasons
- enable filtering
- too many values to manage as custom field

I would like to be able to show these categories similar to custom fields (specification on product layout).

In digging the code, it appears I can find these in the database directly

$query = 'SELECT b.* FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('category').' AS b ON a.category_id=b.category_id WHERE a.product_id = '.$product_id.' ORDER BY a.product_category_id';
$database->setQuery($query);
$element->categories = $database->loadObjectList();

Doing it this way, I will have to search through the categories, get the category parents, and use the parents to decide if it is something I want to display.

Is there are more elegant way to go about this from the product layout?

If you can give me some pointers, I would really appreciate it and will post solution for others when done ;-)

Thanks!

Last edit: 11 years 11 months ago by mtense.

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

  • Posts: 36
  • Thank you received: 6
11 years 11 months ago #79508

I should have done a better job searching. Looks like this might be what I need.

www.hikashop.com/en/forum/4-how-to/75787...duct-page.html#78443

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

  • Posts: 36
  • Thank you received: 6
11 years 11 months ago #79515

Yep. That worked. It should be added as an FAQ!

The following user(s) said Thank You: Jerome

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

Time to create page: 0.063 seconds
Powered by Kunena Forum