News:

Looking for documentation? Take a look on our wiki

Main Menu

Ordering custom fields is not woorking on 4.4.6

Started by Kuubs, February 21, 2025, 01:11:02 AM

Previous topic - Next topic

Kuubs

See title. You cannot set the order of the custom fields anymore. It doesnt get saved.

hazael


Kuubs


waeron

I found an error. in the file customfields.php in administrator\components\com_virtuemart\models\ on line 1758

change

if(!empty($customfield->ordering)){

to

if(isset($customfield->ordering)){

caused by the fact that php empty() also takes zero as empty and each new inserted field has ordering 0 :/


hazael

Acctually I don't need it, but as I remember well, someone already wrote about this problem once and it was solved exactly the same way. It's just strange that the Virtuemart authors don't read this forum to use user comments to fix these bugs :)

Milbo

This whole post is a perfect example, why none of the veterans reacted. The ordering was tested by the team, just before. But we did the test error to test it on already existing products and that worked, because the ordering was not 0. The ordering was assumingly working until the release after the committ 11100. The solution above fixes the problem, if done for the second, now commmented if, not for the first.
if(empty($customfield->ordering)){
$customfield->ordering = 0;
}

//if(!empty($customfield->ordering)){
$html .= '<input class="ordering" type="hidden" value="'.$customfield->ordering.'" name="field[' . $i . '][ordering]" />';
//}

The hidden input was not set if the ordering was 0. And the whole thing is line 1783, so the fix was too short. So I or some other mod sees this post and thinks either "cant be true, I just tested it" or test it and it works again, because the error does not appear products stored before. The real fix is just to remove the added if completly.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/