badcape Posted March 14, 2015 Posted March 14, 2015 Hi ! i installed Select Product Image Directory on local 2.3.1 oscommerce french version. Saw a few posts about it but only about installation on ms2.2. Everithing runs quite well except when i go back to a product'page (in admin) to modify few items and when i save it: the diferent images files were created before and are ok but even if i don't change the images and save my other changes i've got this error message "Fatal error: Call to a member function set_destination() on a non-object in...". This part of the code added is concerned /* BOF Select Product Image Directory */ $t->set_destination($root_images_dir . $dir); /* EOF Select Product Image Directory */ if ($t->parse() && $t->save()) { $pi_sort_order++; /* BOF Select Product Image Directory */ $sql_data_array['image'] = $dir . tep_db_prepare_input($t->filename); /* EOF Select Product Image Directory */ i've re-installed twice the add-on without succes, checking whether some code are missing, but not! This function must be define somewhere but i'm not good enought at coding to do it. 'need a thread and i deal with it! Thanks, Thierry. Quote Thanks to the whole osCommerce Community. Prod Server: Percona Server via UNIX socket Percona Server version: 5.5.40-36.1-log - Percona Server (GPL), Release 36.1, Revision 707 phpMyAdmin 3.5.8.2 Database version: libmysql - 5.0.96 PHP extension: mysqliversion Oscommerce-RC2A php 5.3 with many add-ons/up-dates ...... and liters of coffee !Local dev: EasyPHP DevServer 14.1 VC9 "Minakami" avec oscom 2.3.1 + Them switcher, Grid system et css 24 col 1280 px width, KissIT_image thumbnailer, lightbox, Invoice editor, Superfish horizontal navbar, Quick inventory, margin report, PWA (purshase without account), Products field groups, Products Extra fields Footer boxes... modified to my personnal needs....
Bob Terveuren Posted March 14, 2015 Posted March 14, 2015 Hi $t is not setup so you get the error - you should have a line of code someplace that looks like $t = new upload($key); or $t = new classname(); Quote
MrPhil Posted March 14, 2015 Posted March 14, 2015 It's telling you that the "object" (named $t) either doesn't exist, or is a simple variable (i.e., not an object). The problem is that $t is not properly set somewhere before the code segment you show. There should be a "class" defined somewhere that includes the set_destination(), parse(), save(), and probably other methods. Did you forget to code "include something-or-other-class file;" in this routine? I hope that will help you track down the problem. Quote
badcape Posted March 15, 2015 Author Posted March 15, 2015 Hi Phil and Bob! well, sometimes you try to find a solution and you spend too many hours that you can't see the "evidence" anymore! you're right $t = new upload($key); were missing !!!!! there're two changes to be made in two dif places in category.php, same code to be added, and i forgot that part on the top of the first one.... sometime i feel.... thanks a lot anyway, everything runs ok now. 'have a nice week-end, Thierry. Quote Thanks to the whole osCommerce Community. Prod Server: Percona Server via UNIX socket Percona Server version: 5.5.40-36.1-log - Percona Server (GPL), Release 36.1, Revision 707 phpMyAdmin 3.5.8.2 Database version: libmysql - 5.0.96 PHP extension: mysqliversion Oscommerce-RC2A php 5.3 with many add-ons/up-dates ...... and liters of coffee !Local dev: EasyPHP DevServer 14.1 VC9 "Minakami" avec oscom 2.3.1 + Them switcher, Grid system et css 24 col 1280 px width, KissIT_image thumbnailer, lightbox, Invoice editor, Superfish horizontal navbar, Quick inventory, margin report, PWA (purshase without account), Products field groups, Products Extra fields Footer boxes... modified to my personnal needs....
ce7 Posted June 8, 2018 Posted June 8, 2018 @SpicyGirl Thanks for the addon! @MrPhil @Bob Terveuren @badcape It has not been post since 2015, but hopefully this post still have someone reply later. I had installed this addon on the BS version. It works ok, I just wonder, i can add the folder, what if i want to be able to 1. have the selected folder to have a drop down list of all images in that folder. 2. have the ability to select image from the drop down list to delete 3. have the ability to decide which image folder / image sub-folder to delete Not a php programmer, so no idea how to write the proper code to achieve the above mentioned 3 enables.... thanks! Quote
MrPhil Posted June 8, 2018 Posted June 8, 2018 With enough work, I'm sure it could be done. However, is it worth it? Something to keep in mind if you're deleting files or folders is that you want to detect if a product is still using an image, and forbid the deletion while the product is still there. Can an image be referenced by multiple products? Ditto for moving or renaming an image file. Also, showing the image itself in the list (in addition to its name), is fairly complicated coding. Something like Windows Explorer does this, but most control panel file managers are file name only. A better solution would probably be to automatically delete an image when you delete a product, after checking that no other product is still using that image (a reference count?). That's the only way that I could think of that a bunch of zombie images would build up. If you plan to reuse that image for another product, is it even possible to give a name and location for an existing file? Certainly the code would be cleaner to simply delete, and upload again if you want to reuse it. In the meantime, if you have accumulated a bunch of zombie unused images, you would first have to go through the database to confirm that no one is using them, and then delete them through your hosting File Manager. Perhaps automating that process (build list of in-use images, build list of image files, compare, delete unused images) might be a better and easier route. You might also be given a list of image files to be deleted, in case you want to download and preserve them. Quote
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.
Note: Your post will require moderator approval before it will be visible.