add cart item id on order product save event
This commit is contained in:
committed by
Boyquotes
parent
e0c1bd6d6e
commit
c893629bfd
@@ -11,12 +11,34 @@ class OrderProduct extends BaseOrderProduct
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
protected $cartIemId;
|
||||
|
||||
/**
|
||||
* @param mixed $cartIemId
|
||||
*/
|
||||
public function setCartIemId($cartIemId)
|
||||
{
|
||||
$this->cartIemId = $cartIemId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCartIemId()
|
||||
{
|
||||
return $this->cartIemId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_BEFORE_CREATE, new OrderEvent($this->getOrder()));
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_BEFORE_CREATE, (new OrderEvent($this->getOrder()))->setCartItemId($this->cartIemId));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -26,6 +48,6 @@ class OrderProduct extends BaseOrderProduct
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_AFTER_CREATE, new OrderEvent($this->getOrder()));
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_AFTER_CREATE, (new OrderEvent($this->getOrder()))->setCartItemId($this->cartIemId));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user