From 7d401cbd42c1cceccaf09938b6fbe009c4e45153 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 24 Nov 2016 17:13:16 +0200 Subject: [PATCH] slider --- models/Product.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/models/Product.php b/models/Product.php index 658e608..6fdcffe 100755 --- a/models/Product.php +++ b/models/Product.php @@ -8,6 +8,7 @@ use artweb\artbox\ecommerce\behaviors\DefaultVariantBehavior; use artweb\artbox\behaviors\MultipleImgBehavior; use artweb\artbox\behaviors\SaveMultipleFileBehavior; + use artweb\artbox\event\models\Event; use artweb\artbox\language\behaviors\LanguageBehavior; use Yii; use yii\base\InvalidParamException; @@ -274,7 +275,20 @@ { return $this->getVariant(); } - + + + + + + /** + * @return \yii\db\ActiveQuery + */ + public function getEvents(){ + return $this->hasMany(Event::className(), ['id' => 'event_id'])->viaTable('events_to_products', ['product_id' => 'id'])->where(['status'=>Event::ACTIVE]); + } + + + /** * Get ProductVariant query fetching only available in stock to current Product * -- libgit2 0.21.4