Post by xoomit » Tue Aug 21, 2018 10:42 pm

Hej OC-community,

whenever I edit a product in the backend and save it the main image of this product gets deleted from the database. I have had this problem in an OC shop (v 2.3.0.2) for some time now but assumed that this had something to do with putting the images to a subdomain (which I did around the same time the problem started to occur). Now I set up a fresh shop (3.0.2.0) and the problem remains. So I assume this might have something to do with the server / php settings?

I already added "max_input_vars = 10000;" to my php.ini and tried with several images in several directories and with simple names like a.jpg. The problem always remains.

I have found this or similar problems in this forum and on other sites but I never came across a (working) solution. Does anyone have a clue? It's quite annoying since I have to do all the product editing directly in the database now...

All possible solutions or ideas on how to even narrow down this error would be greatly appreciated!

Thanks & best,
Torge

New member

Posts

Joined
Tue Jun 19, 2012 6:09 am

Post by straightlight » Wed Aug 22, 2018 7:37 am

Does anyone have a clue? It's quite annoying since I have to do all the product editing directly in the database now...
As a new forum user, please read the forum rules. No error / server access logs posted. More information is needed regarding those reported events.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by xoomit » Wed Aug 22, 2018 10:56 am

Dear Straightlight,

thanks a lot for getting back to me and sorry for not mentioning it right away, but: both logs (OC log and server log) are not showing any error. They're empty. I actually wish I had more information but I don't. Sorry :(

I am just hoping someone had this problem before and has any idea on how to solve it. In the meantime I am trying to narrow down the problem by changing all possible variables (number of products, images, starting with a blank shop again, ...)

Thanks & best,
Torge

New member

Posts

Joined
Tue Jun 19, 2012 6:09 am

Post by straightlight » Wed Aug 22, 2018 5:38 pm

In admin/controller/catalog/product.php file,

find:

Code: Select all

$this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);
add above:

Code: Select all

echo "<pre />\n";
print_r($this->request->post);
echo "</pre>\n";
exit;
Then, edit the product again. An array should appear once saving the form.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by xoomit » Thu Aug 23, 2018 1:51 am

First off: Thank you very much for taking the time to help me!
I did what you said and the array reads:

Code: Select all

Array
(
    [product_description] => Array
        (
            [2] => Array
                (
                    [name] => Berglauch
                    [description] => <p>Berglauch ist im Kräutergarten eine wahre Zierde. Wird zwar nur 20 Zentimeter hoch, blüht dafür herrlich mit rosafarbenen Blütenköpfen. Sieht einfach toll aus zusammen mit den sattgrünen Stängeln. Wird gern als Hausmittel verwendet, wenn die Verdauung nicht ganz okay oder der Kreislauf etwas down ist. So schön der Berglauch anzusehen ist, so raffiniert ist er in der Küche. Sowohl die kleinen Zwiebelknollen aus dem Boden als auch die Blätter sind essbar. Der Geschmacklich eine Mischung aus Knoblauch und Pfeffer mit süßen Anflügen. Wird auch „deutscher Knoblauch“ genannt.</p>
                    [meta_title] => Berglauch - Kräftige Pflanze Online Kaufen
                    [meta_description] => Berglauch ist im Kräutergarten eine wahre Zierde. Wird zwar nur 20 Zentimeter hoch, blüht dafür herrlich mit rosafarbenen Blütenköpfen. Sieht einfach toll aus zusammen mit den sattgrünen Stängeln.
                    [meta_keyword] => Berglauch, 010-057, Pflanzen
                    [tag] => 
                )

            [1] => Array
                (
                    [name] => iuziuz
                    [description] => 
                    [meta_title] => uizzui
                    [meta_description] => 
                    [meta_keyword] => 
                    [tag] => 
                )

        )

    [model] => 010-057
    [sku] => 
    [upc] => 
    [ean] => 
    [jan] => 
    [isbn] => 
    [mpn] => 
    [location] => 
    [price] => 5.1402
    [tax_class_id] => 9
    [quantity] => 500
    [minimum] => 1
    [subtract] => 1
    [stock_status_id] => 5
    [preorder] => Array
        (
            [preorder_note] => Array
                (
                    [2] => 
                    [1] => 
                )

            [preorder_date] => 
            [preorder_quantity] => 99
        )

    [preorder_enabled] => no
    [shipping] => 1
    [date_available] => 2015-11-17
    [length] => 0.00000000
    [width] => 0.00000000
    [height] => 0.00000000
    [length_class_id] => 1
    [weight] => 0.10000000
    [weight_class_id] => 1
    [status] => 1
    [sort_order] => 1
    [manufacturer] => 
    [manufacturer_id] => 0
    [category] => 
    [product_category] => Array
        (
            [0] => 75
            [1] => 105
        )

    [filter] => 
    [product_store] => Array
        (
            [0] => 0
        )

    [download] => 
    [related] => 
    [product_attribute] => Array
        (
            [0] => Array
                (
                    [name] => Winterhärte
                    [attribute_id] => 19
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => winterhart
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [1] => Array
                (
                    [name] => Lebensdauer
                    [attribute_id] => 20
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => mehrjährig und ausdauernd
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [2] => Array
                (
                    [name] => Schwierigkeit
                    [attribute_id] => 21
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => einfach
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [3] => Array
                (
                    [name] => Standort
                    [attribute_id] => 22
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => halbschattig bis sonnig; trockene und durchlässige Böden, gern mit Kies
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [4] => Array
                (
                    [name] => Inhaltsstoffe
                    [attribute_id] => 23
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => Allicin, Alliin (Aminosäuren)
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [5] => Array
                (
                    [name] => Verwendung
                    [attribute_id] => 24
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => als Zier-, Heil- und Küchenpflanze toll
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [6] => Array
                (
                    [name] => Wirkung
                    [attribute_id] => 25
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => soll im Verdauungstrakt tonisierend wirken, den Cholesterinspiegel regulieren und den Kreislauf in Schwung halten
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [7] => Array
                (
                    [name] => Verfügbarkeit
                    [attribute_id] => 26
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => Mai bis September
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [8] => Array
                (
                    [name] => Pflege
                    [attribute_id] => 28
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => braucht viel Licht, aber nur sehr wenig Wasser, sehr leicht zu pflegen
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

            [9] => Array
                (
                    [name] => Botanischer Name
                    [attribute_id] => 29
                    [product_attribute_description] => Array
                        (
                            [2] => Array
                                (
                                    [text] => Allium senescens ssp. montanum
                                )

                            [1] => Array
                                (
                                    [text] => 
                                )

                        )

                )

        )

    [option] => 
    [image] => catalog/produkte/pflanzen/berglauch/BerglauchQ.jpg
    [product_image] => Array
        (
            [0] => Array
                (
                    [image] => catalog/produkte/pflanzen/berglauch/DberglauchQ.jpg
                    [sort_order] => 0
                )

        )

    [points] => 0
    [product_reward] => Array
        (
            [1] => Array
                (
                    [points] => 
                )

        )

    [product_seo_url] => Array
        (
            [0] => Array
                (
                    [2] => 
                    [1] => 
                )

            [1] => Array
                (
                    [2] => 
                    [1] => 
                )

        )

    [product_layout] => Array
        (
            [0] => 
            [1] => 
        )

)
This looks good to me.
Which leaves me even more confused than before. When I go back in the browser after getting the echo everything is OK. But when I take your code out of the product.php again and hit save --> the image is gone same as before :( So this must happen directly when saving the array. Any other ideas?

Thanks & best,
Torge

New member

Posts

Joined
Tue Jun 19, 2012 6:09 am

Post by straightlight » Thu Aug 23, 2018 5:23 am

[image] => catalog/produkte/pflanzen/berglauch/BerglauchQ.jpg
[product_image] => Array
(
[0] => Array
(
[image] => catalog/produkte/pflanzen/berglauch/DberglauchQ.jpg
[sort_order] => 0
)

)
This looks good to me
Is it? Are these folders configured on your current FTP environment where OC is running and are your folders permissions configured recursively with CHMOD?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by xoomit » Thu Aug 23, 2018 7:20 pm

I found the problem!
I imported the product and product_description tables from my old shop into this dev and I just saw that some external module altered the structure of the product_description table.

The indices for the table had the additional line

Code: Select all

ALTER TABLE `oc_product_description` ADD FULLTEXT KEY `related_generator` (`name`,`description`);
COMMIT;
And also the table had some additional columns:

Code: Select all

  `seo_keyword` varchar(255) NOT NULL,
  `seo_h1` varchar(255) NOT NULL,
  `seo_h2` varchar(255) NOT NULL,
  `seo_h3` varchar(255) NOT NULL,
  `image_title` varchar(255) NOT NULL,
  `image_alt` varchar(255) NOT NULL,
  `image` varchar(255) NOT NULL
I am not sure what exactly caused the problem but when I changed the table structure / indices back to normal it worked again.
As far as I see it the first 6 additional columns were added by a SEO plugin which should not cause the problem. The last one I assume was added by a mod that should allow to add one image per language. I would guess that one lead to trouble. However, maybe someone else could explain why exactly this goes awry with the additional columns.

Again: Thanks a lot for your feedback and reply Straightlight. This led me on the right path!

Thanks & best,
Torge

New member

Posts

Joined
Tue Jun 19, 2012 6:09 am
Who is online

Users browsing this forum: No registered users and 115 guests