diff --git a/models/Product.php b/models/Product.php index dd5c0e7..21d975e 100755 --- a/models/Product.php +++ b/models/Product.php @@ -10,6 +10,7 @@ use artweb\artbox\behaviors\SaveMultipleFileBehavior; use artweb\artbox\event\models\Event; use artweb\artbox\language\behaviors\LanguageBehavior; + use frontend\models\Catalog; use Yii; use yii\base\InvalidParamException; use yii\db\ActiveQuery; @@ -664,4 +665,24 @@ { $this->options = $values; } + + public function beforeSave($insert) + { + if (parent::beforeSave($insert)) { + Catalog::addRecord($this); + return true; + } else { + return false; + } + } + + public function beforeDelete() + { + if (parent::beforeDelete()) { + Catalog::deleteRecord($this); + return true; + } else { + return false; + } + } } -- libgit2 0.21.4