Commit a4516a4de9ce7e529dec7d4d30f44007f035f9d2

Authored by Administrator
1 parent f1646b52

add variantSku

Showing 1 changed file with 21 additions and 0 deletions   Show diff stats
models/Product.php
... ... @@ -10,6 +10,7 @@
10 10 use artweb\artbox\behaviors\SaveMultipleFileBehavior;
11 11 use artweb\artbox\event\models\Event;
12 12 use artweb\artbox\language\behaviors\LanguageBehavior;
  13 + use frontend\models\Catalog;
13 14 use Yii;
14 15 use yii\base\InvalidParamException;
15 16 use yii\db\ActiveQuery;
... ... @@ -664,4 +665,24 @@
664 665 {
665 666 $this->options = $values;
666 667 }
  668 +
  669 + public function beforeSave($insert)
  670 + {
  671 + if (parent::beforeSave($insert)) {
  672 + Catalog::addRecord($this);
  673 + return true;
  674 + } else {
  675 + return false;
  676 + }
  677 + }
  678 +
  679 + public function beforeDelete()
  680 + {
  681 + if (parent::beforeDelete()) {
  682 + Catalog::deleteRecord($this);
  683 + return true;
  684 + } else {
  685 + return false;
  686 + }
  687 + }
667 688 }
... ...