Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Select Product Image Directory


badcape

Recommended Posts

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.

 

 


 

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: mysqli
version 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....

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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: mysqli
version 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....

Link to comment
Share on other sites

  • 3 years later...

@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!

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...