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

{ {
return Product::find() return Product::find()
->andWhere([ ->andWhere([
'id_producer' => $productCategory->id_producer,
'id_producer' => $this->getProducerContext()->id,
'active' => true, 'active' => true,
]) ])
->andWhere( ->andWhere(

+ 7
- 1
common/logic/Product/ProductCategory/Repository/ProductCategoryRepository.php View File



public function findProductCategories() 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() public function findProductCategoriesAsArray()

+ 5
- 2
producer/controllers/SiteController.php View File

*/ */
public function actionIndex() public function actionIndex()
{ {
$productManager = $this->getProductManager();
$pointSaleManager = $this->getPointSaleManager();

$dataProviderPointsSale = new ActiveDataProvider([ $dataProviderPointsSale = new ActiveDataProvider([
'query' => $this->getPointSaleManager()->queryPointSalesPublic($this->getProducerCurrent()),
'query' => $pointSaleManager->queryPointSalesPublic($this->getProducerCurrent()),
'pagination' => [ 'pagination' => [
'pageSize' => 50, 'pageSize' => 50,
], ],
$dataProviderProductsByCategories = []; $dataProviderProductsByCategories = [];
foreach ($productCategoryArray as $productCategory) { foreach ($productCategoryArray as $productCategory) {
$dataProviderProductsByCategories[$productCategory->id] = new ActiveDataProvider([ $dataProviderProductsByCategories[$productCategory->id] = new ActiveDataProvider([
'query' => $this->getProductManager()->queryProductsByProductCategory($productCategory),
'query' => $productManager->queryProductsByProductCategory($productCategory),
'pagination' => [ 'pagination' => [
'pageSize' => 500, 'pageSize' => 500,
], ],

Loading…
Cancel
Save