add customer cart

This commit is contained in:
2015-10-21 17:57:16 +02:00
parent baf7c79d04
commit 23a0390a27
14 changed files with 467 additions and 16 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace common\components;
use yii\base\Behavior;
use common\models\Account;
use common\models\Discount;
class DiscountAwareBehavior extends Behavior{
public function getDiscountName(){
$result = "";
$discount = $this->owner->discount;
if (isset($discount)){
$result = $discount->name;
}
return $result;
}
public function getDiscount(){
return $this->owner->hasOne( Discount::className(), ["id_discount" =>"id_discount" ] ) ;
}
}