save if producSaleElements is in promo or not

This commit is contained in:
Manuel Raynaud
2013-09-16 10:49:42 +02:00
parent 365d90b4a8
commit da60359c15
2 changed files with 12 additions and 9 deletions

View File

@@ -44,16 +44,18 @@ class Cart extends BaseCart
$item->setQuantity($cartItem->getQuantity());
$item->setProductSaleElements($productSaleElements);
if ($currentDateTime <= $cartItem->getPriceEndOfLife()) {
$item->setPrice($cartItem->getPrice());
$item->setPromoPrice($cartItem->getPromoPrice());
$item->setPrice($cartItem->getPrice())
->setPromoPrice($cartItem->getPromoPrice())
->setPromo($productSaleElements->getPromo())
// TODO : new price EOF or duplicate current priceEOF from $cartItem ?
$item->setPriceEndOfLife($cartItem->getPriceEndOfLife());
->setPriceEndOfLife($cartItem->getPriceEndOfLife());
} else {
$productPrices = ProductPriceQuery::create()->filterByProductSaleElements($productSaleElements)->findOne();
$item->setPrice($productPrices->getPrice());
$item->setPromoPrice($productPrices->getPromoPrice());
$item->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30));
$item->setPrice($productPrices->getPrice())
->setPromoPrice($productPrices->getPromoPrice())
->setPromo($productSaleElements->getPromo())
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30));
}
$item->save();
}