common\models\Store::getGoods PHP Method

getGoods() public method

public getGoods ( $categoryId = null ) : ActiveQuery
return yii\db\ActiveQuery
    public function getGoods($categoryId = null)
    {
        $query = $this->hasMany(Goods::className(), ['store_id' => 'id'])->where(['status' => Goods::STATUS_NORMAL]);
        if ($categoryId !== null) {
            $query->andWhere(['category_id' => $categoryId]);
        }
        return $query->orderBy(['is_promotion' => SORT_DESC, 'is_hot' => SORT_DESC, 'sales' => SORT_DESC, 'name' => SORT_ASC]);
    }