Hi, I have a problem with the exta fields calucated in the product module, it is only displayed correctly within the product (card.php), in the product listing (list.php), the calculated fields appear in 0.
Do you know any solution?
Dolibarr 16.0.3
Hi, I have a problem with the exta fields calucated in the product module, it is only displayed correctly within the product (card.php), in the product listing (list.php), the calculated fields appear in 0.
Do you know any solution?
Dolibarr 16.0.3
Hello ![]()
in list.php, extrafields values are loaded in an object named “$obj”,
in card.php, extrafields values are loaded in an object named “$object”,
you must use this kind of calculation using reloaded object whith Product class
Good continuation
Thank you very much for your reply.
I have tried the following code but I get error 500:
(($reloadedobj = new Product($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? $reloadedobj->id: 3
but testing with the Societe class with the same code, it works:
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? $reloadedobj->id: 3
I don’t understand why. I am doing something wrong?
Thanks!
I have managed to make it work in the following way, I hope that if someone has the same problem it will help:
(($reloadedobj = new Product($db)) && ($reloadedobj->fetchNoCompute($obj->id ? $obj->id: ($obj->rowid ? $obj->rowid: $object->id)) > 0)) ? $reloadedobj->array_options[options_extrafield]+$reloadedobj->array_options[options_extrafield1]+$reloadedobj->array_options[options_extrafield2]: $reloadedobj
Thank you very much.