diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php index 9a17e3160..7493546ae 100644 --- a/core/lib/Thelia/Model/Cart.php +++ b/core/lib/Thelia/Model/Cart.php @@ -2,10 +2,12 @@ namespace Thelia\Model; +use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Thelia\Model\Base\Cart as BaseCart; use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductPriceQuery; +use Thelia\Model\CartItemQuery; class Cart extends BaseCart { @@ -60,4 +62,13 @@ class Cart extends BaseCart return $cart; } + + public function getLastCartItemAdded() + { + $items = CartItemQuery::create() + ->filterByCartId($this->getId()) + ->orderByCreatedAt(Criteria::DESC) + ->findOne() + ; + } }