|
|
|
|
|
|
|
|
], |
|
|
], |
|
|
'sort' => false, |
|
|
'sort' => false, |
|
|
]); |
|
|
]); |
|
|
|
|
|
$this->filterProductsPublic($dataProviderProductsByCategories[$productCategory->id]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$queryProducts = Product::find() |
|
|
$queryProducts = Product::find() |
|
|
|
|
|
|
|
|
], |
|
|
], |
|
|
'sort' => false, |
|
|
'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(); |
|
|
$products = $queryProducts->all(); |
|
|
foreach ($dataProviderProductsByCategories as $dataProvider) { |
|
|
foreach ($dataProviderProductsByCategories as $dataProvider) { |
|
|
|
|
|
|
|
|
]); |
|
|
]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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. |
|
|
* Affiche et traite le formulaire de contact dédié aux producteurs. |
|
|
*/ |
|
|
*/ |