瀏覽代碼

[Espace producteur] Accueil : correctif liste produits

refactoring
Guillaume 1 年之前
父節點
當前提交
ab0cec6f98
共有 3 個檔案被更改,包括 13 行新增4 行删除
  1. +1
    -1
      common/logic/Product/Product/Repository/ProductRepository.php
  2. +7
    -1
      common/logic/Product/ProductCategory/Repository/ProductCategoryRepository.php
  3. +5
    -2
      producer/controllers/SiteController.php

+ 1
- 1
common/logic/Product/Product/Repository/ProductRepository.php 查看文件

@@ -88,7 +88,7 @@ class ProductRepository extends AbstractRepository
{
return Product::find()
->andWhere([
'id_producer' => $productCategory->id_producer,
'id_producer' => $this->getProducerContext()->id,
'active' => true,
])
->andWhere(

+ 7
- 1
common/logic/Product/ProductCategory/Repository/ProductCategoryRepository.php 查看文件

@@ -31,7 +31,13 @@ class ProductCategoryRepository extends AbstractRepository

public function findProductCategories()
{
return ProductCategory::searchAll([], ['orderby' => 'product_category.position ASC']);
return ProductCategory::searchAll([
'id_producer' => $this->getProducerContext()->id
],
[
'orderby' => 'product_category.position ASC'
]
);
}

public function findProductCategoriesAsArray()

+ 5
- 2
producer/controllers/SiteController.php 查看文件

@@ -89,8 +89,11 @@ class SiteController extends ProducerBaseController
*/
public function actionIndex()
{
$productManager = $this->getProductManager();
$pointSaleManager = $this->getPointSaleManager();

$dataProviderPointsSale = new ActiveDataProvider([
'query' => $this->getPointSaleManager()->queryPointSalesPublic($this->getProducerCurrent()),
'query' => $pointSaleManager->queryPointSalesPublic($this->getProducerCurrent()),
'pagination' => [
'pageSize' => 50,
],
@@ -101,7 +104,7 @@ class SiteController extends ProducerBaseController
$dataProviderProductsByCategories = [];
foreach ($productCategoryArray as $productCategory) {
$dataProviderProductsByCategories[$productCategory->id] = new ActiveDataProvider([
'query' => $this->getProductManager()->queryProductsByProductCategory($productCategory),
'query' => $productManager->queryProductsByProductCategory($productCategory),
'pagination' => [
'pageSize' => 500,
],

Loading…
取消
儲存