News:

Looking for documentation? Take a look on our wiki

Main Menu

Error after deleting variant in multi-variant custom field

Started by Geppux, February 15, 2018, 13:05:39 PM

Previous topic - Next topic

Geppux

J 3.8.5 - VM 3.2.12
Hi,
I was creating variants in a parent product and I wanted to change the order of the variants  (there are 3 variants); I deleted the second variant because I wanted to be the third and I saved.  From this point I can not open anymore the parent product, I receive the following error:  Cannot use object of type stdClass as array
Any suggestion? thank you
Giuseppe

Geppux

I solved taking all the description data from the DB deleting the faulty product and creating a new one, but I would like to know what happened just not to repeat it, thank you.
Giuseppe.

lica

#2
This happens because after a deletion of a ramification the options associated to the child products are saved as an object instead of a normal array. Then in visualization this is not considered. I fixed modifying line 285 of file models/customfields.php from:

if(!isset($myoption[$k])){

to

if (is_object($myoption) && property_exists($myoption, $k)) {
                                    $value = $myoption->$k;
                                } else if(!isset($myoption[$k])){

is not the best fix, would be better to fix the save when a ramification is deleted. On top of that any update of VM will rewrite the file and you will lose the modification.

Hope they will release an update with a definitive fix to this issue


Studio 42

Yes, multi variant have know bugs. I dont checked because i find it too complex and use other solutions.