Browse Source

[Espace producteur] Accueil : correctif liste produits

refactoring
Guillaume 1 year ago
parent
commit
ab0cec6f98
3 changed files with 13 additions and 4 deletions
  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 View File

@@ -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 View File

@@ -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 View File

@@ -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…
Cancel
Save