Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Category Image Not Being Saved After Editing Category Text


stubbsy

Recommended Posts

Posted

Hi there,

 

I have a problem in that if i edit category name etc when I save it the adjustments i have made to any words get saved, but any image which had already bee saved doesn't get saved and i get text at the top saying no file saved.

 

I have replaced my categories.php with a stock one but i still have the same problem

 

Can anyone advise where else to look?

 

Thanks

 

Stubbsy

Posted
Hi there,

 

I have a problem in that if i edit category name etc when I save it the adjustments i have made to any words get saved, but any image which had already bee saved doesn't get saved and i get text at the top saying no file saved.

 

I have replaced my categories.php with a stock one but i still have the same problem

 

Can anyone advise where else to look?

 

Thanks

 

Stubbsy

 

The message always appears when you do not upload an image, so dont worry about it, unless your images are dissappearing, have a look when you do this, are your images still there? Yes - fine the message is just telling you that it did not upload an image. No - ahh then you may have a problem.

Posted

Yes, the image is disappearing. I specify an image and it appears, then if i edit the name of the category and hit save, then the image which was specified disappears.

  • 4 weeks later...
Posted

There seems to be a bug in admin/includes/classes/upload.php. Most likely it is only a problem in php4 (that is what I use).

 

Line #80 of categories.php has:

if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {

 

However, this is always returning an object.

 

On line #30 of admin/includes/classes/upload.php, it has "return false" when it fails to find a file to upload. However, according to the post by "Wolverine" on Feb. 1 2006 on php.net's documentation ("Chapter 18. Classes and Objects (PHP 4)"), this will cause a partial class to be created, instead of the expected failure to create a class. Since an object is created, it does the database update to categories_image in TABLE_CATEGORIES -- with an empty file name.

 

According to Wolverine, the fix is to replace the "return false" on line #30 with:

$this = false;

return;

 

I made that change and verified that it works.

  • 1 month later...
Posted

I also have this problem. Any time I change/edit a category description/name/etc, the image I had uploaded disappears and I have to re-uploaded.

 

I looked in admin/includes/classes .. and there is no upload.php.

 

I installed the cart in December, so it's the latest. PHP is 4.3.11

 

Any ideas? It's not overly important, but just a pain.

Posted

If you indeed have the latest osC that file is there, otherwise you wouldn't be able to upload anything ;). Make sure you're looking in the right place and that you're not using a third-party hacked version of oSC...

 

P.S. This mod worked great for me, too! Thanks!

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

  • 4 weeks later...
Posted

Thanks a lot!

 

This little code change now really keeps my images in the categories when I only update other things and save.

 

abra

The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

  • 5 months later...
Posted
According to Wolverine, the fix is to replace the "return false" on line #30 with:

$this = false;

return;

 

I made that change and verified that it works.

 

I have the same little bug (the images of the categories is deleted if I don't specify it again when editing aa category). Not the end of the world, but would be nice to solve it.

 

I am using php v5.0.4, and the solution of Wolverine doesn't work for me. It gives me this error:

 

Fatal error: Cannot re-assign $this in c:\wamp\www\shop\admin\includes\classes\upload.php on line 30

 

Any idea how could I fix that?

 

Thanks

  • 4 months later...
Posted

Thanks! This bit of code worked perfectly for me.

 

On line #30 of admin/includes/classes/upload.php 

replace
return false;

with:
$this = false;
return;

 

Took me a while to find the post but will save me much time in re-adding the images in categories and manufacturers every time I make a change - that was SO doing my head in!

 

THANK YOU!!! :thumbsup:

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

------------------------------------------------

PM me? - I'm not for hire

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...