/** * Set order * * @param string $attribute * @param string $dir * @return $this */ public function setOrder($attribute, $dir = self::SORT_ORDER_DESC) { if (in_array($attribute, ['orders', 'ordered_qty'])) { $this->getSelect()->order($attribute . ' ' . $dir); } else { parent::setOrder($attribute, $dir); } return $this; }