lildog Posted September 1, 2008 Share Posted September 1, 2008 Categories and Products Images Folder Tree V 1.3 written by GottaLoveIT (joseph@xtremecorponline.com) for osCommerce 2.2MS2 (see included GPL license) This contribution will automatically make folders under the /catalog/images folder that will match the categories tree when you create categories and it will place the products image in the correct folder. This helps keep your products and categories images separated based on category. Quote Link to comment Share on other sites More sharing options...
xciso Posted September 3, 2008 Share Posted September 3, 2008 Hi. In the readme it look like this: ***FIND: $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']); ***CHANGE TO:(Earlier versions than oscommerce-2.2rc2a) // BOF Categories and Products Images Folder Tree $sql_data_array['products_image'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image']); // EOF Categories and Products Images Folder Tree I Have 2.2rc2a. Does I need to edit this section? Quote Link to comment Share on other sites More sharing options...
xciso Posted September 3, 2008 Share Posted September 3, 2008 (edited) When i try to insert new categories i get this message. Warning: mkdir() [function.mkdir]: Permission denied in /home/w11001/domains/bjarud.se/public_html/admin/categories.php on line 90 Warning: chmod() [function.chmod]: No such file or directory in /home/w11001/domains/bjarud.se/public_html/admin/categories.php on line 91 Warning: Cannot modify header information - headers already sent by (output started at /home/w11001/domains/bjarud.se/public_html/admin/categories.php:90) in /home/w11001/domains/bjarud.se/public_html/admin/includes/functions/general.php on line 22 I FORGOT TO MAKE THE IMAGES CATALOG WRITEABLE :) NOW IT WORKS! Edited September 3, 2008 by xciso Quote Link to comment Share on other sites More sharing options...
lildog Posted September 3, 2008 Author Share Posted September 3, 2008 No, you don't need to do it. lildog Hi.In the readme it look like this: ***FIND: $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']); ***CHANGE TO:(Earlier versions than oscommerce-2.2rc2a) // BOF Categories and Products Images Folder Tree $sql_data_array['products_image'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image']); // EOF Categories and Products Images Folder Tree I Have 2.2rc2a. Does I need to edit this section? Quote Link to comment Share on other sites More sharing options...
xciso Posted September 6, 2008 Share Posted September 6, 2008 Hi. When I add a product and a image in the admin I can see it, but when I have done that I cant see the image in the store or in the admin. I can just see the image when i preview the product. I have RC2a. Quote Link to comment Share on other sites More sharing options...
lildog Posted September 8, 2008 Author Share Posted September 8, 2008 The setup is real funky...I didn't have time to fix it. Make sure all the images are in the correct folders and check your coding in product_info.php. And make sure you are using the latest version. When you are in admin is the path correct there? lildog Quote Link to comment Share on other sites More sharing options...
wafung Posted September 10, 2008 Share Posted September 10, 2008 Hi, your contribution is great, but we use Chinese UTF-8 as default language , when creating the directory, it represent as /_/ how to make UTF_8 character known to the program ? Thanks a lot Quote Link to comment Share on other sites More sharing options...
Guest Posted September 11, 2008 Share Posted September 11, 2008 hi, i edited, but display: Fatal error: Call to undefined function: tep_output_generated_category_path_fs() in /mounted-storage/home5/sub002/sc11209-JGHN/specslinkshop.com/admin/categories.php on line 232 so, anyone could help pls Quote Link to comment Share on other sites More sharing options...
ncis Posted September 12, 2008 Share Posted September 12, 2008 (edited) hi there, i installed this contrib this morning ... at first glance, it's working perfectly : my 1000+ images are eventually sorted in sub-directories ... but as wafung mentioned it, it doesn't take in account special characters such as # & - and other foreign languages / encodage - commonly used in categories' names <_< (well, there are also some forbidden characters \ / : * ? " < > in directories' names) ... Edited September 12, 2008 by ncis Quote Link to comment Share on other sites More sharing options...
Guest Posted September 12, 2008 Share Posted September 12, 2008 (edited) Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid/gid is 2177/0 is not allowed to access /mounted-storage/home5/sub002/******/images/111222 owned by uid/gid 99/99 in /mounted-storage/home5/sub002/s*****/admin/includes/classes/upload.php on line 86 any idea? Edited September 12, 2008 by SLS Quote Link to comment Share on other sites More sharing options...
ncis Posted September 13, 2008 Share Posted September 13, 2008 hi there,i installed this contrib this morning ... at first glance, it's working perfectly : my 1000+ images are eventually sorted in sub-directories ... but as wafung mentioned it, it doesn't take in account special characters such as # & - and other foreign languages / encodage - commonly used in categories' names <_< (well, there are also some forbidden characters \ / : * ? " < > in directories' names) ... an easy solution consists in adding the needed characters in the definition of the function tep_output_generated_category_path_fs() ... edit the general.php file in your admin directory and make the suitable changes ... for instance, i was able to add the following special characters @ ! ' - é è & # by modifying the $dir_path variable into : $dir_path = ereg_replace("[^a-z0-9._@!'-éè]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($calculated_category_path[$ii][$jj]['text'])))); Quote Link to comment Share on other sites More sharing options...
ncis Posted September 13, 2008 Share Posted September 13, 2008 an easy solution consists in adding the needed characters in the definition of the function tep_output_generated_category_path_fs() ... edit the general.php file in your admin directory and make the suitable changes ... for instance, i was able to add the following special characters @ ! ' - é è & # by modifying the $dir_path variable into :$dir_path = ereg_replace("[^a-z0-9._@!'-éè]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($calculated_category_path[$ii][$jj]['text'])))); don't do this !!! it's not a good idea 'cos you'll get directories / files with funny characters and your ftp client will be unable to delete them ... i'm having some hard time to do so (with additional php code) ... Quote Link to comment Share on other sites More sharing options...
ncis Posted September 13, 2008 Share Posted September 13, 2008 don't do this !!! it's not a good idea 'cos you'll get directories / files with funny characters and your ftp client will be unable to delete them ... i'm having some hard time to do so (with additional php code) ... i figure out another way for deleting such directories / files by changing the characters encoding ... in the ftp manager : go to account manager -> advanced -> server encoding and when trying my region encoding (i.e. west european iso-8859-1), it works perfectly ... hence, the change in the general.php file is valid ... Quote Link to comment Share on other sites More sharing options...
dennis@dhlhomefurnishings. Posted September 15, 2008 Share Posted September 15, 2008 Hello I cannot see any of the product images. Got these warnings when I pressed "Keep Images" Warning: copy(W:/www/oscommerce/images/chess_boards/graphics_cards/matrox/mg200mms.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/chess_boards/graphics_cards/matrox/mg400-32mb.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/chess_boards/mice/microsoft/msimpro.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/replacement_killers.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/science_fiction/dvd/blade_runner.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/the_matrix.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/comedy/dvd/youve_got_mail.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/cartoons/dvd/a_bugs_life.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/under_siege.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/under_siege2.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/fire_down_below.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/die_hard_3.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/lethal_weapon.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/drama/dvd/red_corner.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/thriller/dvd/frantic.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/drama/dvd/courage_under_fire.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/speed.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/action/dvd/speed_2.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/comedy/dvd/theres_something_about_mary.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/travel_chess_sets/drama/dvd/beloved.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/decorated_chess_sets/simulation/sierra/swat_3.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/decorated_chess_sets/painted_design/gt_interactive/unreal_tournament.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/decorated_chess_sets/strategy/gt_interactive/wheel_of_time.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/decorated_chess_sets/strategy/gt_interactive/disciples.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/chess_boards/keyboards/microsoft/intkeyboardps2.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/chess_boards/mice/microsoft/imexplorer.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: copy(W:/www/oscommerce/images/chess_boards/printers/hewlett_packard/lj1100xi.gif) [function.copy]: failed to open stream: No such file or directory in W:\www\oscommerce\security_panel\catimagessetup.php on line 230 Warning: Cannot modify header information - headers already sent by (output started at W:\www\oscommerce\security_panel\catimagessetup.php:230) in W:\www\oscommerce\security_panel\includes\functions\general.php on line 22 Any idea what I might have done wrong? Thanks ... Dennis Quote Link to comment Share on other sites More sharing options...
lildog Posted September 15, 2008 Author Share Posted September 15, 2008 Dennis, The setup script is not right and I don't have time to fix it. The contrib probably fixed your paths but didn't move the pictures into the correct folders on your server. This is a one time deal, move the pics to their correct folders and all should be well again. lildog Quote Link to comment Share on other sites More sharing options...
dennis@dhlhomefurnishings. Posted September 16, 2008 Share Posted September 16, 2008 Thank you for your reply Quote Link to comment Share on other sites More sharing options...
lildog Posted September 16, 2008 Author Share Posted September 16, 2008 Did it work? lildog Thank you for your reply Quote Link to comment Share on other sites More sharing options...
xispita10 Posted September 17, 2008 Share Posted September 17, 2008 When I add a product and a image in the admin I can see it, but when I have done that I cant see the image in the store or in the admin. I can just see the image when i preview the product.I have RC2a. The same thing happens to me. does not save the path of the images in the database. Help Quote Link to comment Share on other sites More sharing options...
xispita10 Posted September 17, 2008 Share Posted September 17, 2008 If I modify the category then saves the path in the database! solution? i dont know Quote Link to comment Share on other sites More sharing options...
xispita10 Posted September 17, 2008 Share Posted September 17, 2008 Hi.When I add a product and a image in the admin I can see it, but when I have done that I cant see the image in the store or in the admin. I can just see the image when i preview the product. I have RC2a. I'm working to find the solution, For fix it to the categories: **IN admin/categories.php FIND: tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'"); **CHANGE TO: tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $categories_name_array[$language_id] . "/" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'"); When I find the solution to the products I report it ;) Quote Link to comment Share on other sites More sharing options...
xispita10 Posted September 17, 2008 Share Posted September 17, 2008 Hi.When I add a product and a image in the admin I can see it, but when I have done that I cant see the image in the store or in the admin. I can just see the image when i preview the product. I have RC2a. The solution: //IN admin/categories.php **FIND: tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'"); **CHANGE TO: tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $categories_name_array[$language_id] . "/" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'"); **FIND all $products_image_name2 **CHANGE TO: $products_image_name This solution works on my osCommerce. I hope to this help someone ;) Quote Link to comment Share on other sites More sharing options...
lildog Posted September 22, 2008 Author Share Posted September 22, 2008 Is anyone else having this problem? I am using RC2a also but do not have this problem. But I would like to integrate it in for others if need be. lildog Hi.When I add a product and a image in the admin I can see it, but when I have done that I cant see the image in the store or in the admin. I can just see the image when i preview the product. I have RC2a. Quote Link to comment Share on other sites More sharing options...
xispita10 Posted September 25, 2008 Share Posted September 25, 2008 I have this problem using RC2a, but i found a solution [see up] Quote Link to comment Share on other sites More sharing options...
matta Posted October 3, 2008 Share Posted October 3, 2008 (edited) Hi.When I add a product and a image in the admin I can see it, but when I have done that I cant see the image in the store or in the admin. I can just see the image when i preview the product. I have RC2a. I've got this same problem on RC2a, even after implementing xispita10's mod: 1) Add a new product and choose an image. 2) When I click "Preview", the image appears fine. 3) When I click "Insert", then check the Admin page or the Product page, the image is gone. 4) Image is in the proper subfolder. Why aren't the admin and product pages finding the image? Seems the location is not being written to the database. Why? Thanks for your help Edited October 3, 2008 by matta Quote Link to comment Share on other sites More sharing options...
matta Posted October 3, 2008 Share Posted October 3, 2008 I've got this same problem on RC2a, even after implementing xispita10's mod: 1) Add a new product and choose an image. 2) When I click "Preview", the image appears fine. 3) When I click "Insert", then check the Admin page or the Product page, the image is gone. 4) Image is in the proper subfolder. Why aren't the admin and product pages finding the image? Seems the location is not being written to the database. Why? Thanks for your help OK, here's what I've determined: There are 2 issues going on with xispita10's mod: 1) The folders create names from the Category name, but replace spaces with underscores (I assume this was done to accomodate web servers that don't like spaces in filenames). So, a category name of "Bells and Whistles" becomes a folder name of "bells_and_whistles". Using $categories_name_array[$language_id] to grab the category name still includes spaces and won't resolve to the proper folder. Solution: Replace xispita10's code: tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $categories_name_array[$language_id] . "/" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'"); With: tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_output_generated_category_path_fs($categories_id) . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'"); 2) The $language_id is wrong: Previously in the admin/categories.php, the code loops through $language_id['id'] and sets the values for each language (English, German, Spanish are the 3 defaults). When it ends, it leaves $language_id as the last value (3 in this example, or Spanish). If you're lazy like me and haven't filled in any of the fields other than English, the value will be blank. So, when it tries to find $categories_name_array[$language_id] (which would be the blank Spanish value), it returns nothing, resulting in a missing directory. Solution: Though maybe inelegent, I'd recommend hardcoding the $language_id to the number 1. This will force the category name to be (presumably) in the store owner's first language choice. Any additional thoughts to make this better? Quote 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.