add customer cart
This commit is contained in:
24
common/components/CurrencyAwareBehavior.php
Normal file
24
common/components/CurrencyAwareBehavior.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use yii\base\Behavior;
|
||||
use common\models\Currency;
|
||||
|
||||
class CurrencyAwareBehavior extends Behavior{
|
||||
|
||||
|
||||
public function getCurrencyName(){
|
||||
$result = "";
|
||||
$currency = $this->owner->currency;
|
||||
if (isset($currency)){
|
||||
$result = $currency->name;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function getCurrency(){
|
||||
return $this->owner->hasOne( Currency::className(), ["id_currency" =>"id_currency" ] ) ;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user