示例#1
0
 private function _sortOptions(&$options, $sort, $a = false, $attribute_id = NULL)
 {
     if ($sort) {
         list($type, $order) = explode('_', $sort);
     } else {
         $type = $order = '';
     }
     if ($attribute_id) {
         $attribute_id = str_replace(array('a_', 'o_', 'f_'), '', $attribute_id);
     }
     self::$_tmp_sort_parameters = array('attribute_id' => $attribute_id, 'type' => $type, 'order' => $order, 'a' => $a, 'options' => $options, 'config' => $this->config->get('mega_filter_at_sort_' . $attribute_id . '_' . $this->config->get('config_language_id')));
     if (!self::$_tmp_sort_parameters['type'] && !self::$_tmp_sort_parameters['config']) {
         self::$_tmp_sort_parameters = NULL;
         return;
     }
     if (!self::$_tmp_sort_parameters['type'] && self::$_tmp_sort_parameters['attribute_id'] !== NULL && self::$_tmp_sort_parameters['config']) {
         uasort($options, array('ModelModuleMegaFilter', '_sortItems'));
     } else {
         $tmp = array();
         foreach ($options as $k => $v) {
             $tmp['_' . $k] = htmlspecialchars_decode($v['name']);
         }
         if ($order == 'desc') {
             arsort($tmp, $type == 'string' ? SORT_STRING : SORT_NUMERIC);
         } else {
             asort($tmp, $type == 'string' ? SORT_STRING : SORT_NUMERIC);
         }
         $tmp2 = array();
         foreach ($tmp as $k => $v) {
             $tmp2[trim($k, '_')] = $options[trim($k, '_')];
         }
         $options = $tmp2;
     }
     self::$_tmp_sort_parameters = NULL;
 }
示例#2
0
 private function _sortOptions(&$options, $sort, $a = false, $attribute_id = NULL)
 {
     if ($sort) {
         list($type, $order) = explode('_', $sort);
     } else {
         $type = $order = '';
     }
     self::$_tmp_sort_parameters = array('attribute_id' => $attribute_id, 'type' => $type, 'order' => $order, 'a' => $a, 'config' => $this->config->get('mega_filter_at_sort_' . $attribute_id . '_' . $this->config->get('config_language_id')));
     if (!self::$_tmp_sort_parameters['type'] && !self::$_tmp_sort_parameters['config']) {
         self::$_tmp_sort_parameters = NULL;
         return;
     }
     usort($options, 'ModelModuleMegaFilter::_sortItems');
     self::$_tmp_sort_parameters = NULL;
 }