Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

lets see what we have here? help


Guest

Recommended Posts

Posted

Can anyone offer me a more 'elegant' solution to putting the category picture along with the subcategory picture at the 'product' level of nesting.

 

What I have come up with works, but I suspect ;) that there is a better way. MS2 index.php Starting around '// Get the right image for the top-right'...

 

} elseif ($current_category_id) {

     $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

     $image = tep_db_fetch_array($image);

     $image = $image['categories_image'];

  $image2 = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

     $image2 = tep_db_fetch_array($image2);

     $image2 = $image2['parent_id'];

  $image3 = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . $image2 . "'");

     $image3 = tep_db_fetch_array($image3);

     $image3 = $image3['categories_image'];

}

 

Any help would be appreciated, Thanks

Posted

Something like this?

} elseif ($current_category_id) {

     $category_query = tep_db_query("select categories_image, parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

     $category = tep_db_fetch_array($category_query);

     $category_image = $category['categories_image'];

     $parent_image_query = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . $category['parent_id'] . "'");

     $image_row = tep_db_fetch_array($image_query);

     $parent_image = $image_row['categories_image'];

}

You also have to replace outside uses of $image and $image3 with $category_image and $parent_image. I changed the names, because it made it easier for me to understand what I was editing.

 

Good luck,

Matt

Archived

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

×
×
  • Create New...