Skip to main content

How to display subcategory images on category page

More
11 years 4 weeks ago #213607 by spavanes
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.4.41

I tried to edit the category listing_div.php to add subcategory images instead of the subcategory name below the current category. But I can't figure out how to get there.

This is what I already have, but I can't get the image of the subcategory:
Code:
<?php $image_options = array('default' => true,'forcesize' => $this->config->get('image_force_size', true),'scale' => $this->config->get('image_scale_mode', 'inside')); $img = $this->image->getThumbnail(@$this->row->file_path, array('width' => $this->image->main_thumbnail_x, 'height' => $this->image->main_thumbnail_y), $image_options); if($img->success) { echo '<img class="hikashop_product_listing_image" title="'.$this->escape(@$this->row->file_name).'" alt="'.$this->escape(@$this->row->file_name).'" src="'.$img->url.'" width="60px" height="35px" />'; } /* echo $child->category_name; if($this->params->get('number_of_products',0)) { echo ' ('.$child->number_of_products.')'; } */ ?>

Can someone please help me with this?

Thank you very much!

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

More
11 years 4 weeks ago #213615 by Jerome
Hi,

You can just use a more appropriated layout for the category listing ; like the "img title" one which display the category images directly.
www.hikashop.com/support/documentation/i...-menus-form.html#div

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
11 years 3 weeks ago #213693 by spavanes
Thank you Jerome for the quick response on this.

But configure the category listing, I get the subcategories below all main categories. I like to get the subcategory images below each main categorie, illustrated in the attachment. I think it must be possible because hikashop is such a flexible system, but I can not figure out how.

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

More
11 years 3 weeks ago #213718 by nicolas
Hi,

It's indeed the listing_div file of the category view that you want to edit.
There you will have first to load the images of the sub categories from your MySQL database with a MySQL query on the hikashop_file table. Then, you'll be able to use PHP code similar to what you have on your first post to display the images instead of their name.
The following user(s) said Thank You: spavanes

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

Time to create page: 0.189 seconds
Powered by Kunena Forum