jhande Posted July 11, 2010 Posted July 11, 2010 I have searched and searched until I am now cross eyed and half blind. I am trying to find out where the image upload directory is defined so that I can change it. NOTE: I have the "Image Subdirectory" contribution added. I have my product images setup like this: images\Images\manufacturer\... When inserting new products I always have to type into the image box: Images\manufacturer\... I would like to have just the product images field to automatically start in the Images directory (so typing this - manufacturer\...). Another similar issue = I'd like to do similar for the categorie images; have them uploaded to the category directory and similar for manufacturers. Has a fix been found for the disappearing category images when editing them? Any help would be appreciated! - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -
lagodilecco Posted July 12, 2010 Posted July 12, 2010 Not sure if any of these points help: 1) There's a define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG.'images/') in /admin/includes/configure.php 2) There's a define('DIR_FS_CATALOG', ...) in admin/includes/configure.php and also in includes/configure.php 3) The file admin/categories.php contains code which places images into the relevant directory 4) The name of each product's image is stored in a database table called 'products" Sorry if it's not what you're after, but hope it helps. DIana
jhande Posted July 12, 2010 Author Posted July 12, 2010 3) The file admin/categories.php contains code which places images into the relevant directory DIana Thanks for helping Diana. Gee I missed this the first few times reading through the code. DUH I "think" this line might have something to do with it (actually a few lines are similar): $products_image->set_destination(DIR_FS_CATALOG_IMAGES . $image_subdirectory ); // ***** append server image subdirectory I'll try changing that line too this and see what happens: $products_image->set_destination(DIR_FS_CATALOG_IMAGES_IMAGES . $image_subdirectory ); // ***** append server image subdirectory Not sure of anywhere else I might need to change it. - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -
lagodilecco Posted July 12, 2010 Posted July 12, 2010 Like you, I've made a change to place product images in a subdirectory based on manufacturer. I only had to change the file /admin/categories.php. So once an image is put into the right location using admin, it seems to be enough. But I don't have to type any extra directory names in admin (the code handles it). It works by doing a database lookup of the manufacturer's name, and including that with the string used in the "set_destination" (that you've listed above). I'm not sure how the "Image Subdirectory" contribution works, but it's probably similiar (I got mine from the David Mercer book). In which case I'm not clear why you need to type in the extra 'Image/Manufacturer' - isn't that the location of the image on your local site? Which might or might not map exactly to the location on your live site? Hope you get it to do what you want! Ciao Diana
jhande Posted July 13, 2010 Author Posted July 13, 2010 Unfortunately the contribution I used, I still have to type the subdirectory in the image folder. Here is a snippet from my admin\categories.php: <!-- Image Subdirectory fields added here --> <tr> <td class="main"><?php echo TEXT_IMAGE_DIRECTORY . '<br><small>' . TEXT_IMAGE_PATH_NOTE . '</small>'; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('image_subdirectory', $image_subdirectory); if (SHOW_DIR_CHECKBOX == 'true') { echo ' ' . TEXT_IMAGE_PATH_CHECKBOX . ' ' . tep_draw_checkbox_field(new_dir , $value = $new_dir, $checked = false, $parameters = '');} ?> </td> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '0'); ?></td> </tr> <!-- Image Subdirectory addition finished --> <tr> <td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td> </tr> Maybe I'll search again for a newer contribution. The one I used is a bit dated - 2005. Cheers, Jim - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -
lagodilecco Posted July 14, 2010 Posted July 14, 2010 I'm out of town at the moment, so don't have access to my stuff. Let me know if you want a copy of my code changes and I'll post when I get back (next week).
jhande Posted July 15, 2010 Author Posted July 15, 2010 Thank you Diana, I would greatly appreciate a copy of the code. I'm in no hurry. - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -
lagodilecco Posted July 19, 2010 Posted July 19, 2010 Here's a copy of the change I made to admin/categories.php. Notes: * It's based on pg 156 "Building Online Stores with osCommerce: Professional Edition (David Mercer) * In the book, it doesn't use $tmpstr, it has the whole SQL command passed via tep_db_query (I broke it up into pieces to find a typo that I'd made, and ended up leaving it like that once it was fixed). * Change occurs around line 314. Hope this helps you. case 'new_product_preview': // copy image only if modified // MODIFICATION: 25/1/2010 DR // This modification allows for the categorised storage and retrieval of images by manufacturer. // See Mercer, pg 156 // Original Code: /* $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $products_image_name = $products_image->filename; */ // New Code: $tmpqry = "select manufacturers_name from "; $tmpqry .= TABLE_MANUFACTURERS; $tmpqry .= " where manufacturers_id = '"; $tmpqry .= $HTTP_POST_VARS['manufacturers_id']; $tmpqry .= "'"; $manufacturers_query = tep_db_query($tmpqry); $manufacturers = tep_db_fetch_array($manufacturers_query); $products_image = new upload('products_image'); $dest = DIR_FS_CATALOG_IMAGES . "$manufacturers[manufacturers_name]/"; $products_image->set_destination($dest); if ($products_image->parse() && $products_image->save()) { $products_image_name = $manufacturers['manufacturers_name'] . "/". $products_image->filename; // End of new Code } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } break;
lagodilecco Posted July 19, 2010 Posted July 19, 2010 I forgot to say that when I have a new manufacturer: * I need to manually create a directory/folder under images with the EXACT same name. Also: * Check the permissions on this new directory - it needs to be writeable (otherwise the image 'fails to upload').
jhande Posted July 19, 2010 Author Posted July 19, 2010 Thank you so much Diana! I will give it a try one of these days soon. Fixing the family cars are next on my list. - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -
Recommended Posts
Archived
This topic is now archived and is closed to further replies.