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
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.
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.
$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.
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.
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) . "'");
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.
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
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
I don;t think its the sql code.
maybe this:
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.
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];
}
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.
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.
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.
I was not asking you I was talking to Stuardo.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 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.
Who is online
Users browsing this forum: No registered users and 100 guests