本文整理汇总了PHP中app\models\Product::getGroupsProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getGroupsProducts方法的具体用法?PHP Product::getGroupsProducts怎么用?PHP Product::getGroupsProducts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::getGroupsProducts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView($id)
{
// Категория
$category = $this->findModel($id);
$top_category = Category::findOne(Category::getParentCategory($category));
// Провайдер продуктов категории
$dataProvider = new ActiveDataProvider(['query' => Product::getProductCategory($id), 'pagination' => ['pageSize' => 100]]);
// Активные группы
$groups = Product::getGroupsProducts($dataProvider->getModels());
// Меню
$menu = Category::getMenuCategory($category, false);
$top_menu = Category::getTopMenuCategory();
return $this->render('view', ['model' => $category, 'products' => $dataProvider, 'menu' => $menu, 'top_menu' => $top_menu, 'top_menu_title' => $top_category->title, 'groups' => $groups]);
}
示例2: actionIndex
public function actionIndex()
{
// Получаем запрос
$request = Yii::$app->request->post()['Search']['request'];
$dataProvider = '';
$groups = '';
// Поиск обнаружил продукты
if ($products = Product::getProductSearch($request)) {
// Провайдер продуктов удовлетворяющих запросу
$dataProvider = new ActiveDataProvider(['query' => $products, 'pagination' => ['pageSize' => 100]]);
// Активные группы
$groups = Product::getGroupsProducts($dataProvider->getModels());
}
return $this->render('index', ['products' => $dataProvider, 'groups' => $groups]);
}