Guest Posted August 11, 2007 Share Posted August 11, 2007 what on define('DIR_FS_DOCUMENT_ROOT' and define('DIR_WS_CATALOG' I'm only asking because I don't understand why the error message says the directory as: ..//catalog/images/products/ it shouldn't be using ../ and their should be something between the two slashes '/'. define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT); // where your pages are located on the server. if $DOCUMENT_ROOT doesnt suit you, replace with your local path. (eg, /usr/local/apache/htdocs) define('DIR_WS_CATALOG', '/catalog/'); Quote Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 I think I've got it.. try chaging this: define('DIR_WS_CATALOG', '/catalog/'); to this: define('DIR_WS_CATALOG', 'catalog/'); Quote Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 when i do that it makes the little English flag goes a way and it still don't work... same errors  Error: Destination does not exist. Error Error: Catalog products images directory does not exist: ../images/products/ Quote Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 okay.. are you sure you copied the code properly in my fix? // copy image only if modified unset($_SESSION['categoryfile']); $cid = explode('_', $cPath); $categoryfile = ''; foreach($cid as $key => $value){ if($value != '0'){ $cdat = tep_db_query("SELECT `categories_name` FROM `categories_description` WHERE `categories_id` = '" . $value . "' && `language_id` = '1'"); $cat = tep_db_fetch_array($cdat); $categoryfile .= $cat['categories_name'] . "/"; } } $_SESSION['categoryfile'] = $categoryfile; $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } break; } } // check if the catalog image directory exists if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); unset($_SESSION['categoryfile']); } ?> and are you using the drop-down menu to select the categories (shown below)? If you are then that will cause an error. you need to select categories by clicking on it in the main list instead Quote Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 ya, still don't work and I don't use the drop down menu, personal I think its a pain using it and never use it Quote Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 (edited) ya, still don't work and I don't use the drop down menu, personal I think its a pain using it and never use it I checked through all your code and it looks fine. I'm pulling at straws here but try changing the code to this: <?php // copy image only if modified unset($_SESSION['categoryfile']); $cid = explode('_', $cPath); $categoryfile = ''; foreach($cid as $key => $value){ if($value != '0'){ $cdat = tep_db_query("SELECT `categories_name` FROM `categories_description` WHERE `categories_id` = '" . $value . "' && `language_id` = '1'"); $cat = tep_db_fetch_array($cdat); $categoryfile .= $cat['categories_name'] . "/"; } } $_SESSION['categoryfile'] = $categoryfile; $products_image = new upload('products_image'); $products_image->set_destination('..' . DIR_WS_CATALOG . 'images/' . . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } break; } } // check if the catalog image directory exists if (is_dir('..' . DIR_WS_CATALOG . 'images/' . . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) { if (!is_writeable('..' . DIR_WS_CATALOG . 'images/' . . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); unset($_SESSION['categoryfile']); } ?> Â also to get the correct error message if it doesn't work open admin/includes/languages/categories.php: find the line starting: define('ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST', replace with: define('ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST', 'Error: Catalog products images directory does not exist: ' . '..' . DIR_WS_CATALOG . 'images/' . . DIR_FS_PRODUCTS_IMAGES . $_SESSION['categoryfile']); Edited August 11, 2007 by Dragen Quote Link to comment Share on other sites More sharing options...
Guest Posted August 12, 2007 Share Posted August 12, 2007 (edited) when i replace the code the whole oscommerce goes blank.... man I feel bad I am making work so hard on this.... I wish I could understand this code then I could help Edited August 12, 2007 by JS_Supplies Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 ok, is there a way to just make the manufacturers and categories just change directories and the products not since the products don't like to corporate, unless you want to still figure out how to make then work its up do you.. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 hm... I'm not sure what the problem is. If you have the code in admin/categories.php how it is in my original fix that I linked you to.. (before I changed it in my last post) and the same with admin/includes/languages/categories.php.. change this prt back: define('ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST', basically undoing what my last post told you to do. Â Then when you go to upload a product and press submit. When it shows the error message, refresh the page (f5). Sometimes the error message lags, so it may say something different (although I doubt it..) Â then copy out the exact error message.. for me. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 admin/categories.php (line 315) // copy image only if modified unset($_SESSION['categoryfile']); $cid = explode('_', $cPath); $categoryfile = ''; foreach($cid as $key => $value){ if($value != '0'){ $cdat = tep_db_query("SELECT `categories_name` FROM `categories_description` WHERE `categories_id` = '" . $value . "' && `language_id` = '1'"); $cat = tep_db_fetch_array($cdat); $categoryfile .= $cat['categories_name'] . "/"; } } $_SESSION['categoryfile'] = $categoryfile; $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } break; } } // check if the catalog image directory exists if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); unset($_SESSION['categoryfile']); } admin/includes/languages/categories.php (line 96) define('ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST', 'Error: Catalog products images directory does not exist: ' . DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $_SESSION['categoryfile']); Is this right? Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 Yeah, that looks right to me. When you upload a new product and it gives you the error, instead of going back and trying again, refresh the page (press f5). Then what is the exact error message you recieve? If you let me know the exact directory it can't find, after the page refresh. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 Yeah, that looks right to me.When you upload a new product and it gives you the error, instead of going back and trying again, refresh the page (press f5). Then what is the exact error message you recieve? If you let me know the exact directory it can't find, after the page refresh. Before inserting image: Â Before Refreshing: Â After Refreshing: Â After Inserting image: Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 admin/includes/configure.php ( line 37) //sets default image directories define('DIR_FS_MANUFACTURERS_IMAGES', 'manufacturers/'); define('DIR_FS_CATEGORIES_IMAGES', 'categories/'); define('DIR_FS_PRODUCTS_IMAGES', 'products/'); // Â admin/includes/languages/english/categories.php (line 96) define('ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST', 'Error: Catalog products images directory does not exist: ' . DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $_SESSION['categoryfile']); Â admin/categories.php (line 80) $categories_image = new upload('categories_image'); $categories_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_CATEGORIES_IMAGES); if ($categories_image->parse() && $categories_image->save()) { tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . DIR_FS_CATEGORIES_IMAGES . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'"); } Line 315 // copy image only if modified unset($_SESSION['categoryfile']); $cid = explode('_', $cPath); $categoryfile = ''; foreach($cid as $key => $value){ if($value != '0'){ $cdat = tep_db_query("SELECT `categories_name` FROM `categories_description` WHERE `categories_id` = '" . $value . "' && `language_id` = '1'"); $cat = tep_db_fetch_array($cdat); $categoryfile .= $cat['categories_name'] . "/"; } } $_SESSION['categoryfile'] = $categoryfile; $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } break; } } // check if the catalog image directory exists if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)) $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); unset($_SESSION['categoryfile']); } Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 Thanks. From looking at your code I really can't see what's causing the problem. For some reason it seems to be looking in ..//catalog/images/products/ to save the image, but the directory is invalid. You can have ..// I'd have expected the directory to be something like this: /home/fhlinux181/s/catalog/images/products/ Â I tried changing the directory it was looking in for you, but it didn't seem to work. I'm sorry, but I can't seem to figure this one out. Â I'm gonna try one last thing in admin/includes/configure.php what've you got for: define('DIR_FS_CATALOG_IMAGES', Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 Thanks.From looking at your code I really can't see what's causing the problem. For some reason it seems to be looking in ..//catalog/images/products/ to save the image, but the directory is invalid. You can have ..// I'd have expected the directory to be something like this: /home/fhlinux181/s/catalog/images/products/ Â I tried changing the directory it was looking in for you, but it didn't seem to work. I'm sorry, but I can't seem to figure this one out. Â I'm gonna try one last thing in admin/includes/configure.php what've you got for: define('DIR_FS_CATALOG_IMAGES', define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/'); Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 hmm.. that looks fine too. I don't think I can figure out this one. Do you want me to show you how to set it up just for manufacterers and categories? Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 if you wouldn't mind, thank you for trying Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 hey I fix the double // Â it was here: admin/includes/local/configure.php (line 4) define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT . '../'); take out the "/" and the error reads: Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 just out of curiosity, what happens if you change this: define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT . '../'); to this: define('DIR_FS_DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']); Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 Quote Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2007 Share Posted August 13, 2007 define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT . '...'); define('DIR_FS_DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']); Quote Link to comment Share on other sites More sharing options...
Guest Posted August 21, 2007 Share Posted August 21, 2007 Hi! Great contrib for better organizing! Â It works fine, but it saves the images in images/products, not images/products/category/subcategory. Â I'm using the latest versions of both osc and this contrib, so where am I going wrong? Please, help. Â Thank you! Quote Link to comment Share on other sites More sharing options...
Guest Posted August 21, 2007 Share Posted August 21, 2007 Hi! Great contrib for better organizing! It works fine, but it saves the images in images/products, not images/products/category/subcategory.  I'm using the latest versions of both osc and this contrib, so where am I going wrong? Please, help.  Thank you!  What code do you have on admin/categories.php around line 315 through to about line 370? Quote Link to comment Share on other sites More sharing options...
Guest Posted August 26, 2007 Share Posted August 26, 2007 (edited) I guess there's the problem, because I also have Ultra Pics installed.  And now I have another error: I added a few images and everything was ok, but now I get this: catalog/images/produse/////////////////////////////////Thomas_pod_suspendat_TO7 - a lot of slashes... And it worked before, saving the images in images/products and showing the image with the correct path. Now the path is wong when I try to dd an image and the image doesn't show.  And this is the code from admin/categories.php:    case 'new_product_preview': // copy image only if modified    //BOF UltraPics if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) { $products_image = ''; $products_image_name = ''; } else { //EOF UltraPics  // Change default folder for images  $cid = explode('_', $cPath); foreach($cid as $key => $value){ $cdat = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id = '" . $value . "' && language_id = '1'"); $cat = tep_db_fetch_array($cdat); $categoryfile .= $cat[categories_name] . "/"; $_SESSION['categoryfile'] = $categoryfile; }  $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename;  // End Change default folder for images   } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); }   //BOF UltraPics   I really need a solution to this, because I'm supposed to have the shop online tomorrow.... I hope I'll make it! Thank you! Edited August 26, 2007 by roxanacaz Quote Link to comment Share on other sites More sharing options...
MindTwist Posted August 30, 2007 Share Posted August 30, 2007 It is quite strange over here, since every product I add, the image name gets one more / added to the path.  I basically wanted this mod so my /images directory would not get cluttered, and because I already have my product thumbnails stored on another directory. So basically I installed it, used 100x100/ as my DIR_FS_PRODUCTS_IMAGES , and tested it.  I actually do not want subdirs for my store categories so I thought maybe I would have to do some changes, but I tried adding an item and the image ended up on /images/100x100/ instead of /images/100x100/category/ (which I hadn't created, so I thought maybe it would give me an error). That was great, since I actually want all images to end up there, no matter what category the product is created in (I thought about just creating the product on the top category, so the image would end on /images/100x100, and then move the product to the desired category).  But after adding some more test products, for some weird reason with every new product the image name that gets added to the databse is growing as follows:  100x100//a.jpg 100x100///b.jpg 100x100////c.jpg ... 100x100///////aaa.jpg  Every new product I add/every new image I upload, the name will have one more / on the name.  I am quite sure my problem is on the following lines of /admin/categories.php , but my PHP knowledge is not even close to letting me even understand this code (this are the changes done about line 314 on v1.4):  // copy image only if modified $cid = explode('_', $cPath); foreach($cid as $key => $value){ $cdat = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id = '" . $value . "' && language_id = '1'"); $cat = tep_db_fetch_array($cdat); $categoryfile .= $cat[categories_name] . "/"; $_SESSION['categoryfile'] = $categoryfile; } $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } break; } }  Any hints on how to fix this would be greatly appreciated (I would me more than fine removing the part that adds the category subdirs, since I do not want to use them, I want all images stored on /images/100x100)  Thanks! Quote MindTwist of Twisted Reality and Twisted Tienda Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.