-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,12 +136,4 @@ public function init() | |
] | ||
); | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
public function clearCart() | ||
{ | ||
Yii::app()->cart->clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,7 @@ public function init() | |
[ | ||
'order.models.*', | ||
'order.forms.*', | ||
'order.listeners.*', | ||
] | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use yupe\components\Event; | ||
|
||
/** | ||
* Class OrderEvent | ||
*/ | ||
class OrderEvent extends Event | ||
{ | ||
/** | ||
* @var | ||
*/ | ||
protected $order; | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getOrder() | ||
{ | ||
return $this->order; | ||
} | ||
|
||
/** | ||
* @param mixed $order | ||
*/ | ||
public function setOrder($order) | ||
{ | ||
$this->order = $order; | ||
} | ||
|
||
/** | ||
* OrderEvent constructor. | ||
* @param Order $order | ||
*/ | ||
public function __construct(Order $order) | ||
{ | ||
$this->order = $order; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
use yupe\components\Event; | ||
|
||
/** | ||
* Class OrderListener | ||
*/ | ||
class OrderListener | ||
{ | ||
/** | ||
* @param Event $event | ||
*/ | ||
public static function onCreate(Event $event) | ||
{ | ||
if (Yii::app()->hasModule('cart')) { | ||
Yii::app()->cart->clear(); | ||
} | ||
|
||
$order = $event->getOrder(); | ||
|
||
Yii::app()->orderNotifyService->sendOrderCreatedAdminNotify($order); | ||
|
||
Yii::app()->orderNotifyService->sendOrderCreatedUserNotify($order); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters