VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Kuubs on February 21, 2025, 01:11:02 AM

Title: Ordering custom fields is not woorking on 4.4.6
Post by: Kuubs on February 21, 2025, 01:11:02 AM
See title. You cannot set the order of the custom fields anymore. It doesnt get saved.
Title: Re: Ordering custom fields is not woorking on 4.4.6
Post by: hazael on February 21, 2025, 15:08:58 PM
Has it ever had such a possibility?  ???
Title: Re: Ordering custom fields is not woorking on 4.4.6
Post by: Kuubs on March 06, 2025, 15:12:26 PM
Quote from: hazael on February 21, 2025, 15:08:58 PMHas it ever had such a possibility?  ???
Most definitely.
Title: Re: Ordering custom fields is not woorking on 4.4.6
Post by: waeron on March 08, 2025, 18:28:52 PM
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 :/
Title: Re: Ordering custom fields is not woorking on 4.4.6
Post by: Kuubs on March 12, 2025, 14:33:20 PM
Thanks mate
Title: Re: Ordering custom fields is not woorking on 4.4.6
Post by: hazael on March 12, 2025, 22:21:45 PM
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 :)
Title: Re: Ordering custom fields is not woorking on 4.4.6
Post by: Milbo on October 07, 2025, 17:31:35 PM
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.
Title: Re: Ordering custom fields is not woorking on 4.4.6
Post by: Kuubs on October 10, 2025, 09:08:21 AM
Thanks I see it's fixed in the latest core build. Thanks for that.