Commit d25c776313db3373b3ed80af95b548daf3ae5dfe
1 parent
a58f01f1
add crocc search in goods view
Showing
3 changed files
with
7 additions
and
5 deletions
Show diff stats
common/models/GoodsView.php
| @@ -30,8 +30,7 @@ class GoodsView extends \backend\components\base\BaseActiveRecord | @@ -30,8 +30,7 @@ class GoodsView extends \backend\components\base\BaseActiveRecord | ||
| 30 | /** | 30 | /** |
| 31 | * @inheritdoc | 31 | * @inheritdoc |
| 32 | */ | 32 | */ |
| 33 | - public $price_currency_id; | ||
| 34 | - public $price_margin_id; | 33 | + |
| 35 | 34 | ||
| 36 | public static function tableName() | 35 | public static function tableName() |
| 37 | { | 36 | { |
| @@ -77,7 +76,10 @@ class GoodsView extends \backend\components\base\BaseActiveRecord | @@ -77,7 +76,10 @@ class GoodsView extends \backend\components\base\BaseActiveRecord | ||
| 77 | return round($this->price * ($this->rate/$rate) * $koef, 2); | 76 | return round($this->price * ($this->rate/$rate) * $koef, 2); |
| 78 | } | 77 | } |
| 79 | 78 | ||
| 80 | - | 79 | + public static function primaryKey() |
| 80 | + { | ||
| 81 | + return ['name','brand']; | ||
| 82 | + } | ||
| 81 | 83 | ||
| 82 | 84 | ||
| 83 | public function attributeLabels() | 85 | public function attributeLabels() |
common/models/GoodsViewSearch.php
| @@ -18,7 +18,7 @@ class GoodsViewSearch extends GoodsView | @@ -18,7 +18,7 @@ class GoodsViewSearch extends GoodsView | ||
| 18 | public function rules() | 18 | public function rules() |
| 19 | { | 19 | { |
| 20 | return [ | 20 | return [ |
| 21 | - [['name', 'brand', 'price_currency_id', 'price_margin_id'], 'safe'], | 21 | + [['name', 'brand'], 'safe'], |
| 22 | ]; | 22 | ]; |
| 23 | } | 23 | } |
| 24 | 24 |
frontend/controllers/GoodsController.php
| @@ -26,7 +26,7 @@ class GoodsController extends Controller { | @@ -26,7 +26,7 @@ class GoodsController extends Controller { | ||
| 26 | Yii::$app->session->setFlash('price_margin_id', 1); | 26 | Yii::$app->session->setFlash('price_margin_id', 1); |
| 27 | 27 | ||
| 28 | $searchModel = new GoodsViewSearch(); | 28 | $searchModel = new GoodsViewSearch(); |
| 29 | - $goods_provider = $searchModel->search($arr); | 29 | + $goods_provider = $searchModel->searchCrosses($arr); |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | //$cross_arr = DetailsCrosses::find()->select('ARTICLE, BRAND')->where(['CROSS_ARTICLE' => '0092S40090', 'CROSS_BRAND' => 'BOSCH'])->asArray()->all(); | 32 | //$cross_arr = DetailsCrosses::find()->select('ARTICLE, BRAND')->where(['CROSS_ARTICLE' => '0092S40090', 'CROSS_BRAND' => 'BOSCH'])->asArray()->all(); |