VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Studio 42 on November 17, 2017, 18:54:32 PM

Title: disappearance of the customs fields BUG[solved]
Post by: Studio 42 on November 17, 2017, 18:54:32 PM
Hi,
I had suddenly some missing custom fields, after adding some other same type of customfields in different positions.
the problem is in the file /components/com_virtuemart/sublayouts/customfield.php
if(!isset($customfield->display))$customfield->display = '';
The $customfield->display is not empty, but after in the trigger
$ret = $dispatcher->trigger ('plgVmOnDisplayProductFEVM3', array(&$product, &$customfields[$k]));
the reference &$customfields[$k] do not get always the right one and $customfield->display is not set.

On changing line 42
foreach($customfields as $k => $customfield){
and using reference for the $customfield value
foreach($customfields as $k => &$customfield){

and modify line 57 in trigger &$customfields[$k]
$ret = $dispatcher->trigger ('plgVmOnDisplayProductFEVM3', array(&$product, &$customfields[$k]));
to &$customfield
$ret = $dispatcher->trigger ('plgVmOnDisplayProductFEVM3', array(&$product, &$customfield));
The behavior is correct and all my customfields are rendered in the product.

Note that i think that it's perhaps only in PHP7+

VirtueMart 3.2.4, Joomla! 3.8.1, PHP 7.0.25
Title: Re: disappearance of the customs fields BUG
Post by: Studio 42 on November 17, 2017, 23:21:53 PM
Hum, the problem is not here.
It seems that when you have customfields for cart and standard customfields and display the minicart, the standard customfields get removed from product detail display.
You can try an example here :
http://pro.st42.fr/fr/test-product-no4-bug,-missing-fields.html
Title: Re: disappearance of the customs fields BUG
Post by: Studio 42 on November 17, 2017, 23:53:41 PM
I removed minicart module in this product page:
http://pro.st42.fr/fr/bug-test-standard-customfields
And the standard fields are rendered correctly.
Title: Re: disappearance of the customs fields BUG
Post by: Studio 42 on November 18, 2017, 01:19:54 AM
I found the origin of the problem.
When i try to display cart module inside product, it break, but not in other case.
I removed the cart module as customfield in product from my test and now it work.
But i dont know why it break ?
Some idear ?
Title: Re: disappearance of the customs fields BUG[solved]
Post by: aftertaf on November 19, 2017, 22:33:48 PM
no idea, but i have weird behaviour too with custom fields.
possibly no relation at ALL, but just saying.
If i could develop i'd look but i can't ;)