• Resolved viktor1sk

    (@viktor1sk)


    This is for the developers. There’s a bug in 3dprint-lite-functions.php

    function p3dlite_sort_by_order($array) {
    $sort = array();
    foreach($array as $key=>$value) {
    $sort[‘sort_order’][$key] = $value[‘sort_order’];
    }
    array_multisort($sort[‘sort_order’], SORT_ASC, $array);
    return $array;
    }

    Not sure if it’s a good code because I’m not a developer but ChatGPT fixed it this way and it appears to be working:

    function p3dlite_sort_by_order($array) {
    if (!is_array($array) || empty($array)) {
    return $array;
    }
    $sort = array(); foreach ($array as $key => $value) { $sort['sort_order'][$key] = isset($value['sort_order']) ? $value['sort_order'] : 0; } array_multisort($sort['sort_order'], SORT_ASC, $array); return $array;
    }

The topic ‘Fatal Error’ is closed to new replies.