create a new event fire when cart item is duplicated

This commit is contained in:
Manuel Raynaud
2014-04-09 17:05:18 +02:00
parent ad58b27b00
commit 48b7eb9353
4 changed files with 78 additions and 2 deletions

View File

@@ -0,0 +1,70 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event\Cart;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\CartItem;
/**
* Class CartItemDuplicationItem
* @package Thelia\Core\Event\Cart
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CartItemDuplicationItem extends ActionEvent
{
/**
* @var \Thelia\Model\CartItem
*/
protected $oldItem;
/**
* @var \Thelia\Model\CartItem
*/
protected $newItem;
function __construct(CartItem $newItem, CartItem $oldItem)
{
$this->newItem = $newItem;
$this->oldItem = $oldItem;
}
/**
* @return \Thelia\Model\CartItem
*/
public function getNewItem()
{
return $this->newItem;
}
/**
* @return \Thelia\Model\CartItem
*/
public function getOldItem()
{
return $this->oldItem;
}
}

View File

@@ -342,6 +342,8 @@ final class TheliaEvents
*/
const CART_DUPLICATE = "cart.duplicate";
const CART_ITEM_DUPLICATE = "cart.item.duplicate";
/**
* sent when a new item is added to current cart
*/