check if price is already valid on duplicate cart
This commit is contained in:
@@ -24,7 +24,7 @@ class Cart extends BaseCart
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cart->save();
|
$cart->save();
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
foreach ($cartItems as $cartItem){
|
foreach ($cartItems as $cartItem){
|
||||||
|
|
||||||
$product = $cartItem->getProduct();
|
$product = $cartItem->getProduct();
|
||||||
@@ -36,6 +36,12 @@ class Cart extends BaseCart
|
|||||||
$item->setProductId($cartItem->getProductId());
|
$item->setProductId($cartItem->getProductId());
|
||||||
$item->setQuantity($cartItem->getQuantity());
|
$item->setQuantity($cartItem->getQuantity());
|
||||||
$item->setProductSaleElements($productSaleElements);
|
$item->setProductSaleElements($productSaleElements);
|
||||||
|
if ($currentDateTime <= $cartItem->getPriceEndOfLife()) {
|
||||||
|
$item->setPrice($cartItem->getPrice());
|
||||||
|
$item->setPromoPrice($cartItem->getPromoPrice());
|
||||||
|
// TODO : new price EOF or duplicate current priceEOF from $cartItem ?
|
||||||
|
$item->setPriceEndOfLife($cartItem->getPriceEndOfLife());
|
||||||
|
}
|
||||||
$item->save();
|
$item->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user