Skip to main content

Display categories in product page

More
12 years 10 months ago #134222 by wideservices
Hi,
I recently bought hikashop business and i have one question .
I want to display product categories in the product page. I managed to do that with $this->categories where i can get the name of the categories. But how can i get the url to each category and the photo of each category? Thank you in advance

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

More
12 years 10 months ago #134299 by Xavier
Hi,

You can ue that coed in the "product / show_default" view to have all the categories informations:
Code:
$productClass = hikashop_get('class.product'); $categoryIds = $productClass->getCategories($this->element->product_id); $db = JFactory::getDBO(); $categories = array(); foreach($categoryIds as $k => $category){ $categories[$category] = new stdClass(); $db->setQuery('SELECT * FROM '.hikashop_table('category').' WHERE `category_id` = '.$category); $categories[$category] = $db->loadObject(); $db->setQuery('SELECT * FROM '.hikashop_table('file').' WHERE `file_ref_id` = '.$category); $categories[$category]->image = $db->loadObject(); }
All is in the var $categories.

Regarding the url to each category, there is no default url, you have to create a menu listing the categories.
Then create dynamically the urls depending on the previously created menu.

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

Time to create page: 0.200 seconds
Powered by Kunena Forum