Module Recettes : on avance... un peu...

This commit is contained in:
2021-04-29 19:05:43 +02:00
parent 8ccce53560
commit 30a5848cf9
12 changed files with 105 additions and 36 deletions

View File

@@ -34,10 +34,12 @@ class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface
->set("ID", $recipe->getId())
->set("CONTENT_ID", $recipe->getContentId())
->set("TITLE", $recipe->getTitle())
->set("SUMMARY", $recipe->getSummary())
->set("PEOPLE", $recipe->getPeople())
->set("DIFFICULTY", $recipe->getDifficulty())
->set("PREPARATION_TIME", $recipe->getPreparationTime())
->set("COOKING_TIME", $recipe->getCookingTime())
->set("OTHER_INGREDIENTS", $recipe->getOtherIngredients())
;
$loopResult->addRow($loopResultRow);
}

View File

@@ -9,6 +9,8 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ProductI18nQuery;
use Thelia\Model\ProductSaleElementsQuery;
/**
* Class ProductsLoop
@@ -29,10 +31,14 @@ class ProductsLoop extends BaseLoop implements PropelSearchLoopInterface
{
foreach ($loopResult->getResultDataCollection() as $product) {
$pse = ProductSaleElementsQuery::create()->findOneById($product->getPseId());
$productLabel = ProductI18nQuery::create()->findOneById($pse->getProductId())->getTitle();
$loopResultRow = new LoopResultRow($product);
$loopResultRow
->set("RECIPE_ID", $product->getId())
->set("RECIPE_ID", $product->getRecipeId())
->set("PSE_ID", $product->getPseId())
->set("PRODUCT_LABEL", $productLabel)
->set("QUANTITY", $product->getQuantity())
;
$loopResult->addRow($loopResultRow);
@@ -57,8 +63,8 @@ class ProductsLoop extends BaseLoop implements PropelSearchLoopInterface
{
$products = RecipeProductsQuery::create();
if (null != $id = $this->getRecipeId()) {
$products->filterById($id);
if (null != $recipeId = $this->getRecipeId()) {
$products->filterByRecipeId($recipeId);
}
return $products;