Here is the solution to a minor, but annoying problem I was having with some installations of OsCommerce. When saving an edit for a category, which already had an image file in the database, the image association would be lost and the error ‘IMAGE DOES NOT EXIST’ would be displayed. The workaround was to use the browse field to populate the image field each time you edited a record.
I had searched for the solution a number of times, but came up dry. Recently, however, when researching a contribution that added a text description for a category, I found the solution in the readme file (not available to search engines):
CHANGES TO admin/categories.php
CAREFUL: These are not trivial changes. There is a lot of code here.
1) Locate the following line (approximately line 80) (image update bug repair provided in the bugs section on oscommerce.com):
if ($categories_image = new upload(’categories_image’, DIR_FS_CATALOG_IMAGES)) {
tep_db_query(”update ” . TABLE_CATEGORIES . ” set categories_image = ‘” . tep_db_input($categories_image->filename) . “‘ where categories_id = ‘” . (int)$categories_id . “‘”);
}REPLACE those 3 lines with the following 5 lines:
$categories_image = new upload(’categories_image’);
$categories_image->set_destination(DIR_FS_CATALOG_IMAGES);
if ($categories_image->parse() && $categories_image->save()) {
tep_db_query(”update ” . TABLE_CATEGORIES . ” set categories_image = ‘” . tep_db_input($categories_image->filename) . “‘ where categories_id = ‘” . (int)$categories_id . “‘”);
}
The comment says “image update bug repair provided in the bugs section on oscommerce.com,” which I was never able to find.



#1 by marissa - March 24th, 2009 at 19:35
Thanks! This made a difference for me