Post by Daniel » Tue Aug 25, 2009 4:23 am

download the latest again.

its a 100% fix.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Tue Aug 25, 2009 4:44 am

thanks for the prompt response, i've tested it once again and it doesn't work, i've diff'd it, entered it manually, overwrote controller and the view file, extracted it to a new database, installed and uploaded, it's doing the same thing.. i've also verified the right code

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by Daniel » Tue Aug 25, 2009 4:46 am

hmm.

what exactly is happening?

the images are going missing or not uploading?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Tue Aug 25, 2009 5:06 am

it uploads the file, the old file is still there but all the query does is send the new file name, it doesn't add it.

432015 Query DELETE FROM product_image WHERE product_id = '42'
432015 Query INSERT INTO product_image SET product_id = '42', image = 'Winter.jpg'

i just think that's the problem, it's deleting product_image id 42, then inserting the file name, rather than adding a new row with the file name.

for example:

432081 Query INSERT INTO `mysite3`.`product_image` (`product_image_id`, `product_id`, `image`) VALUES ('900', '42', '1.jpg')

i just added that via phpmyadmin and it shows 1.jpg.

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by smallpox » Tue Aug 25, 2009 5:19 am

$this->db->query("DELETE FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");

i commented that out, line 141 from admin/model/catalog/product.php

added a picture and it worked but now i'm not able to remove... i know that breaks things because i also tried it on line 90, it said duplicate key or something.. either way, the point is that when you add an image and click save, it's deleteing everything under product_image for that specific product id and it's not sending the original filenames when you click save.

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by Daniel » Tue Aug 25, 2009 5:49 am

it might be the image filename.

have you tried one that is longer than 1 character?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Tue Aug 25, 2009 5:56 am

i tried with different file names. same thing.

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by smallpox » Tue Aug 25, 2009 6:05 am

in your opinion, it can't be the sql query ?

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by Daniel » Tue Aug 25, 2009 7:04 am

it might be.

this should not be there;

INSERT INTO `mysite3`.`product_image` (`product_image_id`, `product_id`, `image`) VALUES ('900', '42', '1.jpg')

where did product_image_id come from?

this is the query:

$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($image) . "'");

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Tue Aug 25, 2009 7:17 am

oh, no.. the query i showed you last, the one you're referring to is me inserting it manually into mysql via phpmyadmin to see if it would show both pictures and it did.

i think the more important part is when i go into item 42, i go to image and i see lets say 1.jpg is the only picture there, i click add image and i add Winter.jpg and click save, check out what happens below, what it does .. it deletes the row in mysql that has 1.jpg and it inserts Winter.jpg, so what it does is it deletes the reference to 1.jpg inside the database and inserts Winter.jpg, rather than what i tested in 1.2.8 in the second post at http://forum.opencart.com/viewtopic.php?f=20&t=5793

1.2.8 does this:

i add Copy (2) of 1.jpg, click save..

432576 Query DELETE FROM product_image WHERE product_id = '42'
432576 Query INSERT INTO product_image SET product_id = '42', image = 'Copy (2) of 1.jpg'

i exit out of that, go back to the product, the image is there, i then click add image and upload Copy of 1.jpg, click save and it shows both

432580 Query DELETE FROM product_image WHERE product_id = '42'
432580 Query INSERT INTO product_image SET product_id = '42', image = 'Copy (2) of 1.jpg'
432580 Query INSERT INTO product_image SET product_id = '42', image = 'Copy of 1.jpg'

1.3.2:

432015 Query DELETE FROM product_image WHERE product_id = '42'
432015 Query INSERT INTO product_image SET product_id = '42', image = 'Winter.jpg'

...

so what i think is happening is that if DELETE FROM is correct then it's probably not passing to sql the fact that there was an existing image.

1.3.2 is not passing previously loaded pictures to sql to re-insert it.

am i making myself clear? cause i know i have a VERY hard time explaining things to people, i wish i could change that.. if i'm not, let me know i'll try to explain it otherwise..

thanks daniel

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by Daniel » Tue Aug 25, 2009 8:10 am

I don;t think its the sql code.

maybe this:

Code: Select all


						move_uploaded_file($this->request->files['product_image']['tmp_name'][$key], DIR_IMAGE . $this->request->files['product_image']['name'][$key]);
						
						if (file_exists(DIR_IMAGE . $this->request->files['product_image']['name'][$key])) {
							$data['product_image'][] = $this->request->files['product_image']['name'][$key];
						}
What about if you insert a product? does that work?


if (file_exists(DIR_IMAGE . $this->request->files['product_image']['name'][$key])) {

if the dir is not correct it won;t find the new filename and add the name to the data that gets added to the db.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Tue Aug 25, 2009 8:29 am

i'm sorry i dont understand your last post.

if i insert a new product, even with original 1.3.2, if i add multiple pictures at once, it will work.. if i go back and try to add a 3rd or 4th image.. that's what it does, it doesn't pass the previous filename into sql after it deletes product_image's contents.

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by smallpox » Sat Aug 29, 2009 12:51 pm

Daniel, any luck ?

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by Stuardo » Sun Aug 30, 2009 4:06 am

Hi all..

Has anyone made any progress with this? It is becoming a major problem for us.

Is there a patch or a bug fix?

Regards
Stu

Newbie

Posts

Joined
Wed Aug 19, 2009 7:56 am

Post by Daniel » Sun Aug 30, 2009 10:21 am

as far as I know its working. when did yoou last download the lastest version?

why what is happening with yours?

does it upload? if not its permission problem.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Sun Aug 30, 2009 3:10 pm

daniel, i promise you, the last time you asked me to download it.. i did a new install and it's still not working

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by Daniel » Sun Aug 30, 2009 8:02 pm

smallpox wrote:daniel, i promise you, the last time you asked me to download it.. i did a new install and it's still not working
I was not asking you I was talking to Stuardo.

I think think your problem is somethign you have done.

why is it just you 2 and no-one else have this problem?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Sun Aug 30, 2009 11:32 pm

i will try again with a fresh install on a different server.

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm

Post by Daniel » Sun Aug 30, 2009 11:44 pm

also smallpoax did you try with different size image names?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by smallpox » Mon Aug 31, 2009 2:49 pm

well, i tried on debian and another freebsd server and it works..

do you have any suggestions on why it could be broke on my current install ?

New member

Posts

Joined
Sun Mar 29, 2009 2:12 pm
Who is online

Users browsing this forum: No registered users and 100 guests