Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

category image next to name?


frank grimes

Recommended Posts

  • 2 weeks later...
Posted

I'm interested in doing this also.

 

I have not found any modules to display the category image next to or below the category name in the side box category navigation.

 

 

I'm looking into modifying the $categories_query to get the categories image in addition to the name, id etc. Then I would just have to assign it to a variable and insert it in the correct location, in my case it appears to be within column_left.php.

Posted

Just to post back what I did to get category images listed in the category sidebar.

 

I don't know if this is the best way, also I have not tested it on subcategories yet which may require an additional change.

 

I updated the $categories_query, for me, this code is in the includes/column_left.php file

All that I added was "c.categories_image,"

$categories_query = tep_db_query("select c.categories_id, c.categories_image, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
while ($categories = tep_db_fetch_array($categories_query)) {
$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
'parent' => $categories['parent_id'],
// added to assign the category image to the array
'category_image' => $categories['categories_image'],
'level' => 0,
'path' => $categories['categories_id'],
'next_id' => false);
if (isset($parent_id)) {
$tree[$parent_id]['next_id'] = $categories['categories_id'];
}
$parent_id = $categories['categories_id'];
if (!isset($first_element)) {
$first_element = $categories['categories_id'];
}
}

 

and then added this to show the image, this is in my includes/column_left.php

$categories_string .= '<br /><img src="' . DIR_WS_IMAGES . $tree[$counter]['category_image'] . '" /></a></li>';

 

I still need to style it but the basic functionality is working for me.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...