Home > open source, oscommerce > OsCommerce Category Image Problem: ‘IMAGE DOES NOT EXIST’

OsCommerce Category Image Problem: ‘IMAGE DOES NOT EXIST’

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.

Similar Posts:

Categories: open source, oscommerce Tags:
  1. marissa
    March 24th, 2009 at 19:35 | #1

    Thanks! This made a difference for me :)

  2. February 24th, 2011 at 10:58 | #2

    Didn’t work for me… what I’m trying to do is add in a Coming Soon image to the blank categories I’ve created. I’ve uploaded the image after creating the new category in the admin section. I see the image there but not in the actual store. Not sure what I’m doing wrong… help please.

  3. March 1st, 2011 at 09:30 | #3

    If you can see the image in the administration but not in the live shop, it might be an issue with the paths defined in the configuration files. There is a separate file for the live shop and the admin section. I would double check your image paths in both config files to make sure the one for the live site is correct.

    The solution mentioned in this post is for the circumstance where you edit a category, and the image that was previously associated with it is lost in both admin and the live site, so this fix is probably not appropriate based on what you are describing.

  4. hk
    August 3rd, 2011 at 20:58 | #4

    hi..

    I installed the latest version of OsCommerce that had those replacement, but how come it still came up with “IMAGE DOES NOT EXIST”? This is so frustrating.. U_U

  5. August 18th, 2011 at 21:14 | #5

    Can you give more details? Are you able to see the image initially when you add it to the category, or not at all?

  6. Joost
    September 22nd, 2011 at 10:24 | #6

    Got the same problem as hk. Really frustrating indeed, tried everything! Map permissions, (admin)configure files checked, even reïnstalled part of the shop, tried an immage contribution from the osCommerce site, no effect, on the server changed settings of Safe-mode and Register Globals. Everything works except the image uploading. Is there a way for manually change php-files?

    Thanks!

  7. September 26th, 2011 at 20:40 | #7

    Hi Joost. If your config files have the right paths, you’ve double-checked your permissions and the fix described in this article is already applied, I’m not sure what else it could be.

  1. No trackbacks yet.