|
|
@@ -110,6 +110,7 @@ class SiteController extends ProducerBaseController |
|
|
|
], |
|
|
|
'sort' => false, |
|
|
|
]); |
|
|
|
$this->filterProductsPublic($dataProviderProductsByCategories[$productCategory->id]); |
|
|
|
} |
|
|
|
|
|
|
|
$queryProducts = Product::find() |
|
|
@@ -128,14 +129,7 @@ class SiteController extends ProducerBaseController |
|
|
|
], |
|
|
|
'sort' => false, |
|
|
|
]); |
|
|
|
|
|
|
|
$models = $dataProviderProducts->getModels(); |
|
|
|
foreach($models as $index => $product) { |
|
|
|
if(!$productManager->isPublic($product)) { |
|
|
|
unset($models[$index]); |
|
|
|
} |
|
|
|
} |
|
|
|
$dataProviderProducts->setModels($models); |
|
|
|
$this->filterProductsPublic($dataProviderProducts); |
|
|
|
|
|
|
|
$products = $queryProducts->all(); |
|
|
|
foreach ($dataProviderProductsByCategories as $dataProvider) { |
|
|
@@ -167,6 +161,18 @@ class SiteController extends ProducerBaseController |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
public function filterProductsPublic($dataProviderProducts) |
|
|
|
{ |
|
|
|
$productManager = $this->getProductManager(); |
|
|
|
$models = $dataProviderProducts->getModels(); |
|
|
|
foreach($models as $index => $product) { |
|
|
|
if(!$productManager->isPublic($product)) { |
|
|
|
unset($models[$index]); |
|
|
|
} |
|
|
|
} |
|
|
|
$dataProviderProducts->setModels($models); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Affiche et traite le formulaire de contact dédié aux producteurs. |
|
|
|
*/ |