add customer cart
This commit is contained in:
@@ -144,6 +144,10 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
||||
return $this->hasOne( UserSoldItem::className(), ["id_transfer" =>"id_transfer" ] );
|
||||
}
|
||||
|
||||
public function getCustomerCart(){
|
||||
return $this->hasOne( ShoppingCart::className(), ["id_transfer" =>"id_transfer" ] );
|
||||
}
|
||||
|
||||
public function getSale(){
|
||||
return $this->hasOne( Sale::className(), ["id_sale" =>"id_object" ] ) ;
|
||||
}
|
||||
@@ -398,6 +402,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
||||
|
||||
return $transfers;
|
||||
}
|
||||
public static function readCustomerCart($customer){
|
||||
$transfers = [];
|
||||
|
||||
if ( isset($customer) ){
|
||||
$query = Transfer::find();
|
||||
$query->innerJoinWith('customerCart');
|
||||
$query->andWhere(['shopping_cart.id_customer' => $customer->id_customer ]);
|
||||
$transfers = $query->all();
|
||||
}
|
||||
|
||||
return $transfers;
|
||||
}
|
||||
|
||||
public static function types( ) {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user