I need to order the list as follows;
- First the shops which are featured (featured shops have values >1 in "order_no") should be ordered according to order_no values
- After featured shops, the regular shops ("order_no"=1) should be ordered ascending by "title" (alphabetical order)
Here are some part of the code;
const DEFAULT_ORDER_COLUMN = "title";
const DEFAULT_ORDER_BY = "asc";
public function category() {
$orderColumn = isset( $_GET['column'] ) && in_array($_GET['column'], $this->orderColum) ? $_GET['column'] : self::DEFAULT_ORDER_COLUMN;
$orderBy = isset( $_GET['order'] ) && in_array($_GET['order'], $this->orderBy) ? $_GET['order'] : self::DEFAULT_ORDER_BY;
$params['total'] = $search->rowCount();
$params['result'] = $search->fetchAll();
template::add_content(template::load('homepage/category', $params));
}
I tried to get this issue done with this code
if ( isset( $_GET['order_no'] ) ) != 1 {
const DEFAULT_ORDER_COLUMN = "order";
const DEFAULT_ORDER_BY = "desc";
} else {
const DEFAULT_ORDER_COLUMN = "title";
const DEFAULT_ORDER_BY = "asc";
}
but did not work. What would be the solution?