Recettes : presque OK sur addToCart

This commit is contained in:
2021-05-05 21:05:08 +02:00
parent a34b17a47c
commit 347fbf2d77
6 changed files with 77 additions and 13 deletions

View File

@@ -3,12 +3,17 @@
namespace Recettes\Loop;
use Recettes\Model\RecipeProductsQuery;
use Thelia\Action\AttributeAv;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
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\AttributeAvI18nQuery;
use Thelia\Model\AttributeCombinationQuery;
use Thelia\Model\AttributeI18n;
use Thelia\Model\AttributeI18nQuery;
use Thelia\Model\ProductI18nQuery;
use Thelia\Model\ProductSaleElementsQuery;
@@ -33,6 +38,8 @@ class ProductsLoop extends BaseLoop implements PropelSearchLoopInterface
$pse = ProductSaleElementsQuery::create()->findOneById($product->getPseId());
$productLabel = ProductI18nQuery::create()->findOneById($pse->getProductId())->getTitle();
$attributeCombination = AttributeCombinationQuery::create()->findOneByProductSaleElementsId($product->getPseId());
$unity = AttributeAvI18nQuery::create()->findOneById($attributeCombination->getAttributeAvId())->getTitle();
$loopResultRow = new LoopResultRow($product);
$loopResultRow
@@ -41,6 +48,7 @@ class ProductsLoop extends BaseLoop implements PropelSearchLoopInterface
->set("PRODUCT_LABEL", $productLabel)
->set("QUANTITY_NEEDED", $product->getQuantity())
->set("QUANTITY_PROPOSED", $product->getNbOfProducts())
->set('UNITY', $unity)
;
$loopResult->addRow($loopResultRow);
}