Commit c3c1539f4aabeb5924219a3f5b1f7af8740f557f
1 parent
83ccbace
Tax Option fix
Showing
5 changed files
with
42 additions
and
2 deletions
Show diff stats
| 1 | +<?php | |
| 2 | + | |
| 3 | + namespace common\behaviors; | |
| 4 | + | |
| 5 | + use common\models\ProductSpec; | |
| 6 | + use common\modules\product\models\Product; | |
| 7 | + use yii\base\Behavior; | |
| 8 | + use yii\db\ActiveRecord; | |
| 9 | + | |
| 10 | + /** | |
| 11 | + * Class TechBehavior | |
| 12 | + * @package common\behaviors | |
| 13 | + * @property Product $owner | |
| 14 | + */ | |
| 15 | + class TechBehavior extends Behavior | |
| 16 | + { | |
| 17 | + public function events() | |
| 18 | + { | |
| 19 | + return [ | |
| 20 | + ActiveRecord::EVENT_AFTER_INSERT => 'afterInsert', | |
| 21 | + ]; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public function afterInsert($event) { | |
| 25 | + $owner = $this->owner; | |
| 26 | + $spec = new ProductSpec([ | |
| 27 | + 'product_id' => $owner->prodcut_id, | |
| 28 | + ]); | |
| 29 | + $spec->generateLangs(); | |
| 30 | + $spec->save(false); | |
| 31 | + } | |
| 32 | + } | |
| 0 | 33 | \ No newline at end of file | ... | ... |
common/modules/product/controllers/ManageController.php
common/modules/product/models/Product.php
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | use common\behaviors\MultipleImgBehavior; |
| 6 | 6 | use common\behaviors\SaveMultipleFileBehavior; |
| 7 | + use common\behaviors\TechBehavior; | |
| 7 | 8 | use common\models\ProductCertificate; |
| 8 | 9 | use common\models\ProductSpec; |
| 9 | 10 | use common\models\ProductToRating; |
| ... | ... | @@ -121,6 +122,9 @@ |
| 121 | 122 | 'language' => [ |
| 122 | 123 | 'class' => LanguageBehavior::className(), |
| 123 | 124 | ], |
| 125 | + 'techSpec' => [ | |
| 126 | + 'class' => TechBehavior::className(), | |
| 127 | + ], | |
| 124 | 128 | ]; |
| 125 | 129 | } |
| 126 | 130 | ... | ... |
common/modules/rubrication/controllers/TaxOptionController.php
| ... | ... | @@ -111,8 +111,8 @@ |
| 111 | 111 | $group = TaxGroup::findOne($model->tax_group_id); |
| 112 | 112 | if($model->load(Yii::$app->request->post())) { |
| 113 | 113 | $model->loadLangs(\Yii::$app->request); |
| 114 | - TaxOption::find() | |
| 115 | - ->rebuildMP($model->tax_group_id); | |
| 114 | +// TaxOption::find() | |
| 115 | +// ->rebuildMP($model->tax_group_id); | |
| 116 | 116 | if($model->save() && $model->transactionStatus) { |
| 117 | 117 | return $this->redirect([ |
| 118 | 118 | 'view', | ... | ... |
frontend/controllers/FilterController.php