spooks 79 Posted October 25, 2009 (edited) Select Product Image Directory & Instant Update For Products This simple contribution does three things. A drop down is added to the product edit page of sub-folders of the images folder to allow you to select where the product image is to be stored. A field is added to allow you to create a new sub-folder of images to store your images in. A function is added in the product edit page to give a instant update option.Some folders within the images directory can be excluded from the drop down list through an exclude list. Only one file to edit (categories.php) and only five edits to that!! Tested on PHP 4 & 5, SQL 4 & 5, osC 2.2 ms2, rc1 & rc2a and is register_globals off compatible. Contribution is found at http://addons.oscommerce.com/info/7088 Edited October 25, 2009 by spooks Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
spooks 79 Posted October 27, 2009 I`ve spotted that Gustavo has updated this already by making it multilingual , welll done Gustavo, thats an area I`m always lax on. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
spooks 79 Posted October 29, 2009 Uploaded new version 1.15 Corrected errors in the language files. Added directory sort Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
PennyP 0 Posted November 3, 2009 Hi, I'm hoping Spooks will see this and lend me a hand. I got to the last update of his "Select Product Image Directory & Instant Update For Products" and found that I'm missing the following line of code in Admin/includes/languages/english/categories.php: define('TEXT_PRODUCTS_MODEL', 'Model:'); I do have a define line that reads: define('TEXT_PRODUCTS_MODEL', 'Products Model:'); I tried inserting the code as instructed below the line as is and got error on that line from osC Admin, then I tried changing define by deleting the 2nd "Products" so it reads as instructed...got same error in line #. Can someone (helllooooo SAM) help me??!!?? I would really like for this add-on to work. Ciao :blink: Live simply, love generously, care deeply, and speak kindly... Share this post Link to post Share on other sites
spooks 79 Posted November 3, 2009 If u download my latest upload (v1.15) you will see i`ve changed the code insertion points to a more logical point (your existing code don`t matter) and fixed the errors in the previous that were causing your problem. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
PennyP 0 Posted November 3, 2009 If u download my latest upload (v1.15) you will see i`ve changed the code insertion points to a more logical point (your existing code don`t matter) and fixed the errors in the previous that were causing your problem. Live simply, love generously, care deeply, and speak kindly... Share this post Link to post Share on other sites
PennyP 0 Posted November 3, 2009 Thank you Sam. I had a feeling but didn't want to ASSume! I'll give it a try... :P Live simply, love generously, care deeply, and speak kindly... Share this post Link to post Share on other sites
eva4art 0 Posted November 26, 2009 Hi Sam, Thank you for this very useful contribution. I installed the updated version and it works great. I have multiple subfolders in the image folder. Is it possible to make this work with them? I have folders like this: images/english/holidays/christmas/image.jpg Thank you for your help. Eva Share this post Link to post Share on other sites
spooks 79 Posted November 26, 2009 Hi Sam, Thank you for this very useful contribution. I installed the updated version and it works great. I have multiple subfolders in the image folder. Is it possible to make this work with them? I have folders like this: images/english/holidays/christmas/image.jpg Thank you for your help. Eva I may do an update sometime to allow recursive operation. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
bel 0 Posted December 10, 2009 If u download my latest upload (v1.15) you will see i`ve changed the code insertion points to a more logical point (your existing code don`t matter) and fixed the errors in the previous that were causing your problem. Share this post Link to post Share on other sites
bel 0 Posted December 10, 2009 If u download my latest upload (v1.15) you will see i`ve changed the code insertion points to a more logical point (your existing code don`t matter) and fixed the errors in the previous that were causing your problem. Hi I've tried your add-on which is just what I need i order to get a structure to my images folder. However, I have had many attempts, but it does not work yet. I have copy/pasted all the corrections in the admin/categories.php and the includes/languages/english/categories.php as well as my local language categories.php. Thus no typing errors. When executing, the images folder cannot be found. About line 600 it does not enter the "if ($handle = opendir($root_image_dir)) { ..." but executes the else part. The permissions on the images-folder and sub folders are 777. Among other things I have tried the following code in a separate php-file, and it works, listing the names of folders and files in var/www/catalog/images/. <?php $dir = "/var/www/catalog/images/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; } closedir($dh); } } ?> Thank you for any help. I'm experienced in programming, but new to php and I haven't fully grasped the structure of the osCommerse yet. Share this post Link to post Share on other sites
spooks 79 Posted December 10, 2009 If your having trouble installing the mod, if you download Simple Multi Image Add-on (Un-Limited) with Fancy Popups http://addons.oscommerce.com/info/7008 in that package you will find a categories.php file thats the rc2a version with this added (+ the other) use a file compare tool with that. I can assure you that this will work fine once correctly installed. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
bel 0 Posted December 10, 2009 If your having trouble installing the mod, if you download Simple Multi Image Add-on (Un-Limited) with Fancy Popups http://addons.oscommerce.com/info/7008 in that package you will find a categories.php file thats the rc2a version with this added (+ the other) use a file compare tool with that. I can assure you that this will work fine once correctly installed. Hi Sam Thank you very much. I have made it work now. This is a really super add-on. Share this post Link to post Share on other sites
Juto 8 Posted December 24, 2009 Dear Sam, thank you so much for a very useful contribution. I have installed it today (what a Christmas eve!). A short question only: I would like to have a structure like this, as an example: public_html/suppliers/HP/products The folder HP have one image: the logo.png the folder have the product images, like so: article_number.jpg Later on I would like to have the product descriptions there as well, like so: language_article_number.html Where language would be (in my case): english, german, spanish and swedish Using the html file format would make it so easy to have a very nice product description, in the most advance case, incorporating a css file for each product, like so: article_number.css or have a general css files like so: main_category.css where main_category could be for example hardware or software or DVD... (Refering to a fresh install). Merry Christmas! Sara Contributions: http://addons.oscommerce.com/info/8010 http://addons.oscommerce.com/info/8204 http://addons.oscommerce.com/info/8681 Share this post Link to post Share on other sites
spooks 79 Posted December 24, 2009 You cannot mix static html pages within your osC site, http://forums.oscommerce.com/index.php?showtopic=330479&hl You can make your product description full html, then you can have any layout & imagess within the description you want. Just add a wysiwyg editor like FCKeditor for Product Descriptions etc http://addons.oscommerce.com/info/2900 its an easy install. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
06voip 0 Posted December 24, 2009 Hi Sam, is possible to work with More Pics 6 ? Thanks 06voip Share this post Link to post Share on other sites
spooks 79 Posted December 24, 2009 Hi Sam, is possible to work with More Pics 6 ? Thanks 06voip I sorry, I don't like that one and I made Simple Multi Image Add-on (Un-Limited) with Fancy Popups http://addons.oscommerce.com/info/7008 which includes this. So u need to ask elsewhere if you want that to work. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
06voip 0 Posted December 25, 2009 Hi Sam, Thanks for your response and I apologize for my English :blush: I feel it Merry Christmas! ;) 06voip Share this post Link to post Share on other sites
♥Dan Cole 546 Posted February 14, 2010 I'm having trouble getting this routine to recognize a directory to save images to other then the default image directory. I want to put my product images under a "skus" directory and then in various sub-directories instead of under the standard "images" directory. I can see where I should be able to specify the new directory by setting the variable $images_dir but for some reason the routine that saves the images seems to ignore the new directory when it saves the image...when I echo the variables $images_dir and $root_images_dir to the screen they show the directory structure I want to use but the image is still being saved to the default image directory. Anyone know if there is something else that I need to change? I can't seem to find the routine that actually saves the image so I can see what is happening. Any idea? Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Share this post Link to post Share on other sites
spooks 79 Posted February 14, 2010 If things don't work as advertised u can be 99% sure its smthg u missed or did wrong, triple check it all again. The update section is: // image directory $images_dir = DIR_WS_IMAGES; // default catalog images folder; $exclude_folders = array("banners","default","icons","mail","infobox","js"); // folders to exclude from adding new images $root_images_dir = DIR_FS_CATALOG . $images_dir; $new_dir = preg_replace('/[^a-zA-Z0-9_.-]/i', '_',$_POST['new_directory']); $dir = (tep_not_null($new_dir) ? $new_dir : $_POST['directory']); // instant update if ($action == 'new_product_preview') { // copy image only if modified if ($dir && !is_dir(DIR_FS_CATALOG_IMAGES . $dir)) { if (mkdir(DIR_FS_CATALOG_IMAGES . $dir)) $messageStack->add('Folder ' . $dir . ' created in '. $images_dir . '.', 'success'); } $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . ($dir ? $dir .'/' : '')); if ($products_image->parse() && $products_image->save()) { $products_image_name = ($dir ? $dir . '\/' : '') . $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } if ($_POST['instant_update'] == 'on') { $_POST['products_image'] = stripslashes($products_image_name); $action = (isset($_GET['pID']) ? 'update_product' : 'insert_product'); } } // EOF instant update & image directory but if you missed later edits then that could also cause failure!! Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
♥Dan Cole 546 Posted February 15, 2010 If things don't work as advertised u can be 99% sure its smthg u missed or did wrong, triple check it all again. Thanks for the quick reply Sam. You gave me an idea. I know your Simple Muliple Images has this functionality as well so I downloaded it...took the categories.php file and made the change to the $images_dir variable. It's a no go there too. I must have really messed something up! Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Share this post Link to post Share on other sites
spooks 79 Posted February 15, 2010 You could try using that file, or use a file compare tool. Perhaps u forgot to remove the section of code it says to! Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites
♥Dan Cole 546 Posted February 15, 2010 You could try using that file, or use a file compare tool. Perhaps u forgot to remove the section of code it says to! Sorry Sam I guess I wasn't very clear. I tried using the categories.php file from your Simple Multiple Images contribution and that file doesn't work for me either. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Share this post Link to post Share on other sites
♥Dan Cole 546 Posted February 15, 2010 Sorry Sam I guess I wasn't very clear. I tried using the categories.php file from your Simple Multiple Images contribution and that file doesn't work for me either. Dan Sam in the routine that saves the image I replaced the DIR_FS_CATALOG_IMAGES variable with the $root_images_dir variable and that seems to have solved the problem. I don't know if that is the best way to fix it or if it'll create other problems but the image is now being saved to the correct location. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Share this post Link to post Share on other sites
spooks 79 Posted February 15, 2010 Sam in the routine that saves the image I replaced the DIR_FS_CATALOG_IMAGES variable with the $root_images_dir variable and that seems to have solved the problem. I don't know if that is the best way to fix it or if it'll create other problems but the image is now being saved to the correct location. Dan Yes, I was going to say that, but I`ve been busy so u beat me to it, I re-read your 1st post & realised I had mistaken your needs, soory. However, that will place the images in your new dir, but osc refers to all images relative to DIR_WS_IMAGES you may have issues with images not appearing. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Share this post Link to post Share on other sites