Commit 1412c23ab6fd4075ffccec3abf06fda057a436aa
1 parent
efcf4c8f
add crocc search in goods view
Showing
7 changed files
with
358 additions
and
338 deletions
Show diff stats
backend/models/UploadFileParsingForm.php
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "{{%goods_view}}". | ||
9 | + * | ||
10 | + * @property string $name | ||
11 | + * @property string $brand | ||
12 | + * @property string $box | ||
13 | + * @property string $add_box | ||
14 | + * @property string $importer_id | ||
15 | + * @property string $importer_name | ||
16 | + * @property double $rate | ||
17 | + * @property string $currency_id | ||
18 | + * @property string $delivery | ||
19 | + * @property string $description | ||
20 | + * @property string $article | ||
21 | + * @property string $ID | ||
22 | + * @property string $image | ||
23 | + * @property string $tecdoc_id | ||
24 | + * @property double $price | ||
25 | + * @property string $brand_id | ||
26 | + | ||
27 | + */ | ||
28 | +class GoodsView extends \backend\components\base\BaseActiveRecord | ||
29 | +{ | ||
30 | + /** | ||
31 | + * @inheritdoc | ||
32 | + */ | ||
33 | + public static function tableName() | ||
34 | + { | ||
35 | + return '{{%goods_view}}'; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * @inheritdoc | ||
40 | + */ | ||
41 | + public function rules() | ||
42 | + { | ||
43 | + return [ | ||
44 | + [['name', 'brand', 'box', 'importer_id', 'importer_name', 'rate', 'delivery', 'price'], 'required'], | ||
45 | + [['box', 'add_box', 'importer_id', 'currency_id', 'ID', 'tecdoc_id', 'brand_id'], 'integer'], | ||
46 | + [['rate', 'price'], 'number'], | ||
47 | + [['name', 'brand'], 'string', 'max' => 100], | ||
48 | + [['importer_name', 'delivery'], 'string', 'max' => 254], | ||
49 | + [['description'], 'string', 'max' => 255], | ||
50 | + [['article'], 'string', 'max' => 150], | ||
51 | + [['image'], 'string', 'max' => 229] | ||
52 | + ]; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * @return string | ||
57 | + */ | ||
58 | + public function getOutputPrice() | ||
59 | + { | ||
60 | + $price_margin_id = Yii::$app->session->getFlash('price_margin_id',1); | ||
61 | + $price_currency_id = Yii::$app->session->getFlash('price_currency_id',1); | ||
62 | + | ||
63 | + $koef = Margins::getDb()->cache( function ($db) use ($price_margin_id) { | ||
64 | + return (float) Margins::findOne($price_margin_id)->koef; | ||
65 | + }); | ||
66 | + | ||
67 | + $rate = Currency::getDb()->cache( function ($db) use ($price_currency_id) { | ||
68 | + return (float) Currency::findOne($price_currency_id)->rate; | ||
69 | + }); | ||
70 | + | ||
71 | + if(!$rate) | ||
72 | + $rate = 1; // если 0, то 1 | ||
73 | + | ||
74 | + return round($this->price * ($this->rate/$rate) * $koef, 2); | ||
75 | + } | ||
76 | + | ||
77 | + | ||
78 | + public function attributeLabels() | ||
79 | + { | ||
80 | + return [ | ||
81 | + 'name' => 'Name', | ||
82 | + 'brand' => 'Brand', | ||
83 | + 'box' => 'Box', | ||
84 | + 'add_box' => 'Add Box', | ||
85 | + 'importer_id' => 'Importer ID', | ||
86 | + 'importer_name' => 'Importer Name', | ||
87 | + 'rate' => 'Rate', | ||
88 | + 'currency_id' => 'Currency ID', | ||
89 | + 'delivery' => 'Delivery', | ||
90 | + 'description' => 'Description', | ||
91 | + 'article' => 'Article', | ||
92 | + 'ID' => 'ID', | ||
93 | + 'image' => 'Image', | ||
94 | + 'tecdoc_id' => 'Tecdoc ID', | ||
95 | + 'price' => 'Price', | ||
96 | + 'brand_id' => 'Brand ID', | ||
97 | + ]; | ||
98 | + } | ||
99 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use common\models\GoodsView; | ||
9 | + | ||
10 | +/** | ||
11 | + * GoodsViewSearch represents the model behind the search form about `common\models\GoodsView`. | ||
12 | + */ | ||
13 | +class GoodsViewSearch extends GoodsView | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['name', 'brand', 'price_currency_id', 'price_margin_id'], 'safe'], | ||
22 | + ]; | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public function scenarios() | ||
29 | + { | ||
30 | + // bypass scenarios() implementation in the parent class | ||
31 | + return Model::scenarios(); | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Creates data provider instance with search query applied | ||
36 | + * | ||
37 | + * @param array $params | ||
38 | + * | ||
39 | + * @return ActiveDataProvider | ||
40 | + */ | ||
41 | + public function search($params) | ||
42 | + { | ||
43 | + $query = GoodsView::find(); | ||
44 | + | ||
45 | +// $pagination = [ | ||
46 | +// 'pageSize' => 20, | ||
47 | +// ]; | ||
48 | + | ||
49 | + | ||
50 | + $this->load($params); | ||
51 | + | ||
52 | + if ( !$this->validate() ) { | ||
53 | + $query->where('0=1'); | ||
54 | + } | ||
55 | + | ||
56 | + $query->andFilterWhere([ | ||
57 | + 'name' => $this->name, | ||
58 | + 'brand' => $this->brand, | ||
59 | + ]); | ||
60 | + | ||
61 | + $query->andWhere(['or', 'box > 0', 'add_box > 0']); | ||
62 | + | ||
63 | + $dataProvider = new ActiveDataProvider([ | ||
64 | + 'query' => $query, | ||
65 | + 'key' => 'article', | ||
66 | + 'sort' => [ | ||
67 | + 'attributes' => [ | ||
68 | + 'box', | ||
69 | + 'delivery', | ||
70 | + 'price' | ||
71 | + ], | ||
72 | + ], | ||
73 | + | ||
74 | + ]); | ||
75 | + | ||
76 | + return $dataProvider; | ||
77 | + } | ||
78 | + public function searchCrosses($params) | ||
79 | + { | ||
80 | + $query = GoodsView::find()->innerJoin('w_details_crosses', '`w_details_crosses`.`CROSS_ARTICLE` = `name` and `w_details_crosses`.`CROSS_BRAND` = w_goods_view.`brand`'); | ||
81 | + | ||
82 | +// $pagination = [ | ||
83 | +// 'pageSize' => 20, | ||
84 | +// ]; | ||
85 | + | ||
86 | + | ||
87 | + $this->load($params); | ||
88 | + | ||
89 | + if ( !$this->validate() ) { | ||
90 | + $query->where('0=1'); | ||
91 | + } | ||
92 | + | ||
93 | + $query->andFilterWhere([ | ||
94 | + 'w_details_crosses.ARTICLE' => $this->name, | ||
95 | + 'w_details_crosses.BRAND' => $this->brand, | ||
96 | + ]); | ||
97 | + | ||
98 | + $query->andWhere(['or', 'box > 0', 'add_box > 0']); | ||
99 | + | ||
100 | + $dataProvider = new ActiveDataProvider([ | ||
101 | + 'query' => $query, | ||
102 | + 'key' => 'article', | ||
103 | + 'sort' => [ | ||
104 | + 'attributes' => [ | ||
105 | + 'box', | ||
106 | + 'delivery', | ||
107 | + 'price' | ||
108 | + ], | ||
109 | + ], | ||
110 | + | ||
111 | + ]); | ||
112 | + | ||
113 | + return $dataProvider; | ||
114 | + } | ||
115 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Schema; | ||
4 | +use yii\db\Migration; | ||
5 | + | ||
6 | +class m151219_103804_goods_view extends Migration | ||
7 | +{ | ||
8 | + public function safeUp() | ||
9 | + { | ||
10 | + $view = <<< MySQL | ||
11 | + create view w_goods_view as | ||
12 | + select straight_join `w_details`.`ARTICLE` as `name`, | ||
13 | + `w_details`.`BRAND` as `brand`, | ||
14 | + `w_details`.`BOX` as `box`, | ||
15 | + `w_details`.`ADD_BOX` as `add_box`, | ||
16 | + `w_details`.`IMPORT_ID` as `importer_id`, | ||
17 | + `w_importers`.`name` as `importer_name`, | ||
18 | + `t`.`rate` as rate, | ||
19 | + `t`.`id` as currency_id, | ||
20 | + `w_importers`.`delivery`, | ||
21 | + if (`w_details_description`.`description` = '', | ||
22 | + if (`w_details_description`.`tecdoc_description` = '', | ||
23 | + `w_details_description`.`supplier_description`, | ||
24 | + `w_details_description`.`tecdoc_description` | ||
25 | + ), | ||
26 | + `w_details_description`.`description` | ||
27 | + ) as `description`, | ||
28 | + | ||
29 | + if (`w_details_description`.`tecdoc_article` = '', | ||
30 | + if (`w_details_description`.`article` = '', | ||
31 | + if (`w_details`.`FULL_ARTICLE` = '', | ||
32 | + `w_details`.`ARTICLE`, | ||
33 | + `w_details`.`FULL_ARTICLE` | ||
34 | + ), | ||
35 | + `w_details_description`.`article` | ||
36 | + ), | ||
37 | + `w_details_description`.`tecdoc_article` | ||
38 | + ) as `article`, | ||
39 | + `w_details`.`ID`, | ||
40 | + if (`w_details_description`.`image` = '', | ||
41 | + if (`w_details_description`.`tecdoc_image` = '', | ||
42 | + '', | ||
43 | + concat('ital_origin/images/tecdoc/big/',`w_details_description`.`tecdoc_image`) | ||
44 | + ), | ||
45 | + concat('ital_origin/images/goods/big/',`w_details_description`.`image`) | ||
46 | + ) as `image`, | ||
47 | + `w_details_description`.`tecdoc_id`, | ||
48 | + | ||
49 | + `w_details`.`PRICE`as `price`, | ||
50 | + `w_brands`.`ID` as `brand_id` | ||
51 | +from `w_details` | ||
52 | + inner join `w_brands` on `w_brands`.`BRAND` = `w_details`.`BRAND` | ||
53 | + left join `w_details_description` on `w_details_description`.`name` = `w_details`.`ARTICLE` and | ||
54 | + `w_details_description`.`brand` = `w_details`.`BRAND` | ||
55 | + inner join `w_importers` on `w_importers`.`id` = `w_details`.`IMPORT_ID` and | ||
56 | + `w_importers`.`active` = 1 | ||
57 | + inner join `w_currency` as `t` on `t`.`id` = `w_importers`.`currency_id`; | ||
58 | +MySQL; | ||
59 | + | ||
60 | + $this->execute($view); | ||
61 | + | ||
62 | + } | ||
63 | + | ||
64 | + public function safeDown() | ||
65 | + { | ||
66 | + // вернем все как было | ||
67 | + $drop_view = 'drop view if exists w_goods_view'; | ||
68 | + | ||
69 | + $this->execute($drop_view); | ||
70 | + | ||
71 | + } | ||
72 | +} |
frontend/controllers/GoodsController.php
@@ -9,8 +9,9 @@ | @@ -9,8 +9,9 @@ | ||
9 | namespace frontend\controllers; | 9 | namespace frontend\controllers; |
10 | 10 | ||
11 | use common\components\CustomVarDamp; | 11 | use common\components\CustomVarDamp; |
12 | +use common\models\DetailsCrosses; | ||
13 | +use common\models\GoodsViewSearch; | ||
12 | use Yii; | 14 | use Yii; |
13 | -use yii\data\SqlDataProvider; | ||
14 | use yii\web\Controller; | 15 | use yii\web\Controller; |
15 | 16 | ||
16 | class GoodsController extends Controller { | 17 | class GoodsController extends Controller { |
@@ -18,29 +19,40 @@ class GoodsController extends Controller { | @@ -18,29 +19,40 @@ class GoodsController extends Controller { | ||
18 | 19 | ||
19 | public function actionIndex($name = '') | 20 | public function actionIndex($name = '') |
20 | { | 21 | { |
21 | - | ||
22 | - $query = $this->getQuery(); | ||
23 | - | ||
24 | - $provider = new SqlDataProvider([ | ||
25 | - 'sql' => $query, | ||
26 | - 'key' => 'article', | ||
27 | - 'pagination' => false, | ||
28 | - 'params' => [':article' => '0092S40090', | ||
29 | - ':brand' => 'BOSCH', | ||
30 | - ':margin_id' => '1', | ||
31 | - ':currency_id' => '1'], | ||
32 | - 'sort' => [ | ||
33 | - 'attributes' => [ | ||
34 | - 'box', | ||
35 | - 'delivery', | ||
36 | - 'price' | ||
37 | - ], | ||
38 | - ], | ||
39 | - ]); | 22 | + $arr = ['GoodsViewSearch' => ['name' => '0092S40090', |
23 | + 'brand' => 'BOSCH']]; | ||
24 | + | ||
25 | + Yii::$app->session->setFlash('price_currency_id', 1); | ||
26 | + Yii::$app->session->setFlash('price_margin_id', 1); | ||
27 | + | ||
28 | + $searchModel = new GoodsViewSearch(); | ||
29 | + $goods_provider = $searchModel->searchCrosses($arr); | ||
30 | + | ||
31 | + | ||
32 | +//$cross_arr = DetailsCrosses::find()->select('ARTICLE, BRAND')->where(['CROSS_ARTICLE' => '0092S40090', 'CROSS_BRAND' => 'BOSCH'])->asArray()->all(); | ||
33 | +// | ||
34 | +// $article_condition = "'" . implode("','", array_column($cross_arr,'ARTICLE')) . "'"; | ||
35 | +// $brand_condition = "'" . implode("','", array_column($cross_arr,'BRAND')) . "'"; | ||
36 | +// | ||
37 | +// $crosses_provider = new SqlDataProvider([ | ||
38 | +// 'sql' => $query, | ||
39 | +// 'key' => 'article', | ||
40 | +// 'pagination' => false, | ||
41 | +// 'params' => [':article' => $article_condition, | ||
42 | +// ':brand' => $brand_condition], | ||
43 | +// 'sort' => [ | ||
44 | +// 'attributes' => [ | ||
45 | +// 'box', | ||
46 | +// 'delivery', | ||
47 | +// 'price' | ||
48 | +// ], | ||
49 | +// ], | ||
50 | +// ]); | ||
40 | 51 | ||
41 | 52 | ||
42 | return $this->render('index',[ | 53 | return $this->render('index',[ |
43 | - 'dataProvider' => $provider | 54 | + 'goods_data_provider' => $goods_provider, |
55 | + 'crosses_data_provider' => $goods_provider, | ||
44 | ]); | 56 | ]); |
45 | } | 57 | } |
46 | 58 | ||
@@ -114,19 +126,19 @@ from `w_details` | @@ -114,19 +126,19 @@ from `w_details` | ||
114 | `w_details_description`.`brand` = `w_details`.`BRAND` | 126 | `w_details_description`.`brand` = `w_details`.`BRAND` |
115 | inner join `w_importers` on `w_importers`.`id` = `w_details`.`IMPORT_ID` and | 127 | inner join `w_importers` on `w_importers`.`id` = `w_details`.`IMPORT_ID` and |
116 | `w_importers`.`active` = 1 | 128 | `w_importers`.`active` = 1 |
117 | - inner join `w_margins` on `w_margins`.`id` =:margin_id | 129 | + inner join `w_margins` on `w_margins`.`id` = @margin |
118 | left join `w_margins_importers` on `w_margins_importers`.`importer_id` = `w_details`.`IMPORT_ID` and | 130 | left join `w_margins_importers` on `w_margins_importers`.`importer_id` = `w_details`.`IMPORT_ID` and |
119 | - `w_margins_importers`.`margin_id`=:margin_id | 131 | + `w_margins_importers`.`margin_id`= @margin |
120 | left join `w_margins_groups` on `w_margins_groups`.`importer_id` = `w_details`.`IMPORT_ID` and | 132 | left join `w_margins_groups` on `w_margins_groups`.`importer_id` = `w_details`.`IMPORT_ID` and |
121 | - `w_margins_groups`.`margin_id` =:margin_id and | 133 | + `w_margins_groups`.`margin_id` = @margin and |
122 | `w_margins_groups`.`group` = `w_details`.`group` | 134 | `w_margins_groups`.`group` = `w_details`.`group` |
123 | - inner join `w_currency` on `w_currency`.`id` =:currency_id | 135 | + inner join `w_currency` on `w_currency`.`id` = @currency |
124 | inner join `w_currency` as `t` on `t`.`id` = `w_importers`.`currency_id` | 136 | inner join `w_currency` as `t` on `t`.`id` = `w_importers`.`currency_id` |
125 | inner join `w_currency` as `default` on `default`.`is_default` = 1 | 137 | inner join `w_currency` as `default` on `default`.`is_default` = 1 |
126 | left join `w_margins_groups` as `input_groups` on `input_groups`.`importer_id` = `w_details`.`IMPORT_ID` and | 138 | left join `w_margins_groups` as `input_groups` on `input_groups`.`importer_id` = `w_details`.`IMPORT_ID` and |
127 | `input_groups`.`margin_id` = 8 and | 139 | `input_groups`.`margin_id` = 8 and |
128 | `input_groups`.`group` = `w_details`.`group` | 140 | `input_groups`.`group` = `w_details`.`group` |
129 | -where `w_details`.`ARTICLE` =:article and `w_details`.`BRAND` =:brand and (`w_details`.`BOX` > 0 or `w_details`.`ADD_BOX`) | 141 | +where `w_details`.`ARTICLE` In(:article) and `w_details`.`BRAND` In(:brand) and (`w_details`.`BOX` > 0 or `w_details`.`ADD_BOX` > 0) |
130 | MySQL; | 142 | MySQL; |
131 | 143 | ||
132 | return $query; | 144 | return $query; |
frontend/views/goods/index.php
@@ -96,17 +96,18 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -96,17 +96,18 @@ $this->params['breadcrumbs'][] = $this->title; | ||
96 | <td class="medium_width row_name">Номер детали</td> | 96 | <td class="medium_width row_name">Номер детали</td> |
97 | <td class="large_width row_name">Описание</td> | 97 | <td class="large_width row_name">Описание</td> |
98 | <td class="row_select1 row_name"></td> | 98 | <td class="row_select1 row_name"></td> |
99 | - <td class="right_large row_name link_sort arrow_up"><?=$sort->link('box')?></td> | ||
100 | - <td class="right_small row_name link_sort arrow_up"><?=$sort->link('delivery')?></td> | ||
101 | - <td class="right_medium row_name link_sort arrow_up"><?=$sort->link('price')?></td> | 99 | + <td class="right_large row_name link_sort arrow_up"><?= $sort->link('box') ?></td> |
100 | + <td class="right_small row_name link_sort arrow_up"><?= $sort->link('delivery') ?></td> | ||
101 | + <td class="right_medium row_name link_sort arrow_up"><?= $sort->link('price') ?></td> | ||
102 | 102 | ||
103 | </tr> | 103 | </tr> |
104 | <?php | 104 | <?php |
105 | - echo \yii\widgets\ListView::widget( [ | ||
106 | - 'dataProvider' => $dataProvider, | ||
107 | - 'itemView'=>'one_item', | ||
108 | - 'layout' => "{items}" | ||
109 | - ] ); | 105 | + echo \yii\widgets\ListView::widget([ |
106 | + 'dataProvider' => $goods_data_provider, | ||
107 | + 'itemView' => 'one_item', | ||
108 | + 'summary' => '', | ||
109 | + 'layout' => "{items}" | ||
110 | + ]); | ||
110 | ?> | 111 | ?> |
111 | 112 | ||
112 | </tbody></table> | 113 | </tbody></table> |
@@ -129,294 +130,14 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -129,294 +130,14 @@ $this->params['breadcrumbs'][] = $this->title; | ||
129 | <td class="right_medium row_name link_sort arrow_up">Цена</td> | 130 | <td class="right_medium row_name link_sort arrow_up">Цена</td> |
130 | 131 | ||
131 | </tr> | 132 | </tr> |
132 | - <tr> | ||
133 | - <td class="small_width">BOSH</td> | ||
134 | - <td class="medium_width">0 092 S30 120 | ||
135 | - <img src="/images/favourite_notactive.png" class="favourite"> | ||
136 | - <img src="/images/favourite.png" class="pose"> | ||
137 | - </td> | ||
138 | - <td class="large_width">12V 88Ah 740A | ||
139 | - <a href=""><img src="/images/gear.png"></a> | ||
140 | - <a href="" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."><img src="/images/icon_cam.png"></a> | ||
141 | - </td> | ||
142 | - <td class="right instock"> | ||
143 | - <table class="right" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
144 | - border-top: 0;"> | ||
145 | - <tbody> | ||
146 | - | ||
147 | - | ||
148 | - <tr class="one" style="border-bottom: 0;border-top: 0;"> | ||
149 | - <td class="row_select" style="border-bottom: 0; | ||
150 | - border-top: 0;"> | ||
151 | - <div class="lend-tovar-cart-left"> | ||
152 | - <input type="text" class="lend-tovar-cart-number" value="1"> | ||
153 | - <div class="arrow-cart-lend-wr"> | ||
154 | - <img class="arrow-cart-lend-1" src="/images/arrow-cart-up.png" width="9" height="6" alt=""> | ||
155 | - <img class="arrow-cart-lend-2" src="/images/arrow-cart-down1.png" width="9" height="6" alt=""> | ||
156 | - </div> | ||
157 | - </div> | ||
158 | - <button class="purple">В корзину</button> | ||
159 | - </td> | ||
160 | - </tr> | ||
161 | - </tbody></table> | ||
162 | - | ||
163 | - </td> | ||
164 | - <td class="right_large instock">3</td> | ||
165 | - <td class="right_small instock">1 дн.</td> | ||
166 | - <td class="right_medium instock">103.75</td> | ||
167 | - </tr> | ||
168 | - <tr> | ||
169 | - <td class="small_width">BOSH</td> | ||
170 | - <td class="medium_width">0 092 S30 120 | ||
171 | - <img src="/images/favourite_notactive.png" class="favourite"> | ||
172 | - <img src="/images/favourite.png" class="pose"> | ||
173 | - </td> | ||
174 | - <td class="large_width">12V 88Ah 740A | ||
175 | - <a href=""><img src="/images/gear.png"></a> | ||
176 | - <a href="" id="go_photo" data-image="/images/acamulator_big.png"><img src="/images/icon_cam.png"></a> | ||
177 | - </td> | ||
178 | - <td class="right " style="border-bottom: 0; | ||
179 | - border-top: 0;"> | ||
180 | - <table class="right" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
181 | - border-top: 0;"> | ||
182 | - <tbody> | ||
183 | - | ||
184 | - <tr class="one" style="border-bottom: 0; | ||
185 | - border-top: 0;"> | ||
186 | - <td class="row_select" style="border-top: 0;"> | ||
187 | - <div class="lend-tovar-cart-left"> | ||
188 | - <input type="text" class="lend-tovar-cart-number" value="1"> | ||
189 | - <div class="arrow-cart-lend-wr"> | ||
190 | - <img class="arrow-cart-lend-1" src="/images/arrow-cart-up.png" width="9" height="6" alt=""> | ||
191 | - <img class="arrow-cart-lend-2" src="/images/arrow-cart-down1.png" width="9" height="6" alt=""> | ||
192 | - </div> | ||
193 | - </div> | ||
194 | - <button class="purple">В корзину</button> | ||
195 | - </td> | ||
196 | - | ||
197 | - </tr> | ||
198 | - <tr class="one" style="border-bottom: 0; | ||
199 | - border-top: 0;"> | ||
200 | - <td class="row_select" style="border-bottom: 0; | ||
201 | - border-top: 0;"> | ||
202 | - <div class="lend-tovar-cart-left"> | ||
203 | - <input type="text" class="lend-tovar-cart-number" value="1"> | ||
204 | - <div class="arrow-cart-lend-wr"> | ||
205 | - <img class="arrow-cart-lend-1" src="/images/arrow-cart-up.png" width="9" height="6" alt=""> | ||
206 | - <img class="arrow-cart-lend-2" src="/images/arrow-cart-down1.png" width="9" height="6" alt=""> | ||
207 | - </div> | ||
208 | - </div> | ||
209 | - <button class="purple">В корзину</button> | ||
210 | - </td> | ||
211 | - </tr> | ||
212 | - </tbody></table> | ||
213 | - | ||
214 | - </td> | ||
215 | - <td class="right_large"> | ||
216 | - <table class="inner_table" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
217 | - border-top: 0;"> | ||
218 | - <tbody> | ||
219 | - <tr> | ||
220 | - <td>3</td> | ||
221 | - </tr> | ||
222 | - <tr> | ||
223 | - <td>3</td> | ||
224 | - </tr> | ||
225 | - </tbody> | ||
226 | - </table> | ||
227 | - | ||
228 | - </td> | ||
229 | - <td class="right_small"> | ||
230 | - <table class="inner_table" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
231 | - border-top: 0;"> | ||
232 | - <tbody> | ||
233 | - <tr> | ||
234 | - <td>1 дн.</td> | ||
235 | - </tr> | ||
236 | - <tr> | ||
237 | - <td>1 дн.</td> | ||
238 | - </tr> | ||
239 | - </tbody> | ||
240 | - </table> | ||
241 | - </td> | ||
242 | - <td class="right_medium"> | ||
243 | - <table class="inner_table" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
244 | - border-top: 0;"> | ||
245 | - <tbody> | ||
246 | - <tr> | ||
247 | - <td>103.75</td> | ||
248 | - </tr> | ||
249 | - <tr> | ||
250 | - <td>103.75</td> | ||
251 | - </tr> | ||
252 | - </tbody> | ||
253 | - </table> | ||
254 | - </td> | ||
255 | - </tr> | ||
256 | - <tr> | ||
257 | - <td class="small_width">BOSH</td> | ||
258 | - <td class="medium_width">0 092 S30 120 | ||
259 | - <img src="/images/favourite_notactive.png" class="favourite"> | ||
260 | - <img src="/images/favourite.png" class="pose"> | ||
261 | - </td> | ||
262 | - <td class="large_width">12V 88Ah 740A | ||
263 | - <a href=""><img src="/images/gear.png"></a> | ||
264 | - <a href="" id="go_photo" data-image="/images/acamulator_big.png"><img src="/images/icon_cam.png"></a> | ||
265 | - </td> | ||
266 | - <td class="right" style="border-bottom: 0; | ||
267 | - border-top: 0;"> | ||
268 | - <table class="right" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
269 | - border-top: 0;"> | ||
270 | - <tbody> | ||
271 | - | ||
272 | - | ||
273 | - <tr class="one" style="border-bottom: 0; | ||
274 | - border-top: 0;"> | ||
275 | - <td class="row_select" style="border-bottom: 0; | ||
276 | - border-top: 0;"> | ||
277 | - <div class="lend-tovar-cart-left"> | ||
278 | - <input type="text" class="lend-tovar-cart-number" value="1"> | ||
279 | - <div class="arrow-cart-lend-wr"> | ||
280 | - <img class="arrow-cart-lend-1" src="/images/arrow-cart-up.png" width="9" height="6" alt=""> | ||
281 | - <img class="arrow-cart-lend-2" src="/images/arrow-cart-down1.png" width="9" height="6" alt=""> | ||
282 | - </div> | ||
283 | - </div> | ||
284 | - <button class="purple">В корзину</button> | ||
285 | - </td> | ||
286 | - </tr> | ||
287 | - </tbody></table> | ||
288 | - | ||
289 | - </td> | ||
290 | - <td class="right_large">3</td> | ||
291 | - <td class="right_small">1 дн.</td> | ||
292 | - <td class="right_medium">103.75</td> | ||
293 | - </tr> | ||
294 | - <tr> | ||
295 | - <td class="small_width">BOSH</td> | ||
296 | - <td class="medium_width">0 092 S30 120 | ||
297 | - <img src="/images/favourite_notactive.png" class="favourite"> | ||
298 | - <img src="/images/favourite.png" class="pose"> | ||
299 | - </td> | ||
300 | - <td class="large_width">12V 88Ah 740A | ||
301 | - <a href=""><img src="/images/gear.png"></a> | ||
302 | - <a href="" id="go_photo" data-image="/images/acamulator_big.png"><img src="/images/icon_cam.png"></a> | ||
303 | - </td> | ||
304 | - <td class="right" style="border-bottom: 0; | ||
305 | - border-top: 0;"> | ||
306 | - <table class="right" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
307 | - border-top: 0;"> | ||
308 | - <tbody> | ||
309 | - | ||
310 | - | ||
311 | - <tr class="one" style="border-bottom: 0; | ||
312 | - border-top: 0;"> | ||
313 | - | ||
314 | - <td class="row_select" style="border-bottom: 0; | ||
315 | - border-top: 0;"> | ||
316 | - <div class="lend-tovar-cart-left"> | ||
317 | - <input type="text" class="lend-tovar-cart-number" value="1"> | ||
318 | - <div class="arrow-cart-lend-wr"> | ||
319 | - <img class="arrow-cart-lend-1" src="/images/arrow-cart-up.png" width="9" height="6" alt=""> | ||
320 | - <img class="arrow-cart-lend-2" src="/images/arrow-cart-down1.png" width="9" height="6" alt=""> | ||
321 | - </div> | ||
322 | - </div> | ||
323 | - <button class="purple">В корзину</button> | ||
324 | - </td> | ||
325 | - </tr> | ||
326 | - </tbody></table> | ||
327 | - | ||
328 | - </td> | ||
329 | - <td class="right_large">3</td> | ||
330 | - <td class="right_small">1 дн.</td> | ||
331 | - <td class="right_medium">103.75</td> | ||
332 | - </tr> | ||
333 | - <tr> | ||
334 | - <td class="small_width">BOSH</td> | ||
335 | - <td class="medium_width">0 092 S30 120 | ||
336 | - <img src="/images/favourite_notactive.png" class="favourite"> | ||
337 | - <img src="/images/favourite.png" class="pose"> | ||
338 | - </td> | ||
339 | - <td class="large_width">12V 88Ah 740A | ||
340 | - <a href=""><img src="/images/gear.png"></a> | ||
341 | - <a href="" id="go_photo" data-image="/images/acamulator_big.png"><img src="/images/icon_cam.png"></a> | ||
342 | - </td><td class="right" style="border-bottom: 0; | ||
343 | - border-top: 0;"> | ||
344 | - <table class="right" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
345 | - border-top: 0;"> | ||
346 | - <tbody> | ||
347 | - | ||
348 | - <tr class="one" style="border-bottom: 0; | ||
349 | - border-top: 0;"> | ||
350 | - <td class="row_select" style="border-top: 0;"> | ||
351 | - <div class="lend-tovar-cart-left"> | ||
352 | - <input type="text" class="lend-tovar-cart-number" value="1"> | ||
353 | - <div class="arrow-cart-lend-wr"> | ||
354 | - <img class="arrow-cart-lend-1" src="/images/arrow-cart-up.png" width="9" height="6" alt=""> | ||
355 | - <img class="arrow-cart-lend-2" src="/images/arrow-cart-down1.png" width="9" height="6" alt=""> | ||
356 | - </div> | ||
357 | - </div> | ||
358 | - <button class="purple">В корзину</button> | ||
359 | - </td> | ||
360 | - | ||
361 | - </tr> | ||
362 | - <tr class="one" style="border-bottom: 0; | ||
363 | - border-top: 0;"> | ||
364 | - <td class="row_select" style="border-bottom: 0; | ||
365 | - border-top: 0;"> | ||
366 | - <div class="lend-tovar-cart-left"> | ||
367 | - <input type="text" class="lend-tovar-cart-number" value="1"> | ||
368 | - <div class="arrow-cart-lend-wr"> | ||
369 | - <img class="arrow-cart-lend-1" src="/images/arrow-cart-up.png" width="9" height="6" alt=""> | ||
370 | - <img class="arrow-cart-lend-2" src="/images/arrow-cart-down1.png" width="9" height="6" alt=""> | ||
371 | - </div> | ||
372 | - </div> | ||
373 | - <button class="purple">В корзину</button> | ||
374 | - </td> | ||
375 | - </tr> | ||
376 | - </tbody></table> | ||
377 | - | ||
378 | - </td> | ||
379 | - <td class="right_large"> | ||
380 | - <table class="inner_table" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
381 | - border-top: 0;"> | ||
382 | - <tbody> | ||
383 | - <tr> | ||
384 | - <td>3</td> | ||
385 | - </tr> | ||
386 | - <tr> | ||
387 | - <td>3</td> | ||
388 | - </tr> | ||
389 | - </tbody> | ||
390 | - </table> | ||
391 | - | ||
392 | - </td> | ||
393 | - <td class="right_small"> | ||
394 | - <table class="inner_table" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
395 | - border-top: 0;"> | ||
396 | - <tbody> | ||
397 | - <tr> | ||
398 | - <td>1 дн.</td> | ||
399 | - </tr> | ||
400 | - <tr> | ||
401 | - <td>1 дн.</td> | ||
402 | - </tr> | ||
403 | - </tbody> | ||
404 | - </table> | ||
405 | - </td> | ||
406 | - <td class="right_medium"> | ||
407 | - <table class="inner_table" cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0; | ||
408 | - border-top: 0;"> | ||
409 | - <tbody> | ||
410 | - <tr> | ||
411 | - <td>103.75</td> | ||
412 | - </tr> | ||
413 | - <tr> | ||
414 | - <td>103.75</td> | ||
415 | - </tr> | ||
416 | - </tbody> | ||
417 | - </table> | ||
418 | - </td> | ||
419 | - </tr> | 133 | + <?php |
134 | + echo \yii\widgets\ListView::widget([ | ||
135 | + 'dataProvider' => $crosses_data_provider, | ||
136 | + 'itemView' => 'one_item', | ||
137 | + 'summary' => '', | ||
138 | + 'layout' => "{items}" | ||
139 | + ]); | ||
140 | + ?> | ||
420 | 141 | ||
421 | </tbody></table> | 142 | </tbody></table> |
422 | <div class="yellow_stock"> | 143 | <div class="yellow_stock"> |
frontend/views/goods/one_item.php
@@ -15,23 +15,25 @@ if ( empty($article_arr[$index - 1]) || $article_arr[$index - 1] != $key ) | @@ -15,23 +15,25 @@ if ( empty($article_arr[$index - 1]) || $article_arr[$index - 1] != $key ) | ||
15 | <?php $this->beginBlock('item_details'); | 15 | <?php $this->beginBlock('item_details'); |
16 | // выделим отдельно детали товара в блок, для опционального его вывода | 16 | // выделим отдельно детали товара в блок, для опционального его вывода |
17 | ?> | 17 | ?> |
18 | -<tr> | ||
19 | - <td class="small_width"><?= $model['brand']?></td> | ||
20 | - <td class="medium_width"><?= $model['article']?> | ||
21 | - <img src="/images/favourite_notactive.png" class="favourite"> | ||
22 | - <img src="/images/favourite.png" class="pose"> | ||
23 | - </td> | ||
24 | - <td class="large_width"><?= $model['description']?> | ||
25 | - <a href=""><img src="/images/gear.png"></a> | ||
26 | - <a href="" id="go_photo"><img src="/images/icon_cam.png"></a> | ||
27 | - </td> | 18 | + <tr style="border-bottom: 0"> |
19 | + <td style="border-bottom: 0" class="small_width"><?= $model->brand?></td> | ||
20 | + <td style="border-bottom: 0" class="medium_width"><?= $model->article?> | ||
21 | + <img src="/images/favourite_notactive.png" class="favourite"> | ||
22 | + <img src="/images/favourite.png" class="pose"> | ||
23 | + </td> | ||
24 | + <td style="border-bottom: 0" class="large_width"><?= $model->description?> | ||
25 | + <a href=""><img src="/images/gear.png"></a> | ||
26 | + <a href="" id="go_photo"><img src="/images/icon_cam.png"></a> | ||
27 | + </td> | ||
28 | <?php $this->endBlock(); ?> | 28 | <?php $this->endBlock(); ?> |
29 | 29 | ||
30 | <?php $this->beginBlock('empty_details'); | 30 | <?php $this->beginBlock('empty_details'); |
31 | // иначе пустой блок | 31 | // иначе пустой блок |
32 | ?> | 32 | ?> |
33 | -<tr style="border-bottom: 0;border-top: 0;"> | ||
34 | - <td colspan="3"></td> | 33 | + <tr style="border-bottom: 0;border-top: 0;"> |
34 | + <td style="border-bottom: 0;border-top: 0;"></td> | ||
35 | + <td style="border-bottom: 0;border-top: 0;"></td> | ||
36 | + <td style="border-bottom: 0;border-top: 0;"></td> | ||
35 | 37 | ||
36 | <?php $this->endBlock(); ?> | 38 | <?php $this->endBlock(); ?> |
37 | 39 | ||
@@ -66,16 +68,16 @@ if ( empty($article_arr[$index - 1]) || $article_arr[$index - 1] != $key ) | @@ -66,16 +68,16 @@ if ( empty($article_arr[$index - 1]) || $article_arr[$index - 1] != $key ) | ||
66 | </td> | 68 | </td> |
67 | <td class="right_large"> | 69 | <td class="right_large"> |
68 | <table class="inner" border='0' style='border-top:0; border-left:0'> | 70 | <table class="inner" border='0' style='border-top:0; border-left:0'> |
69 | - <tr border='0' style='border-top:0; border-left:0'><td border='0' style='border-top:0; border-left:0'><?= $model['box'] ?></td></tr> | 71 | + <tr border='0' style='border-top:0; border-left:0'><td border='0' style='border-top:0; border-left:0'><?= $model->box ?></td></tr> |
70 | 72 | ||
71 | </table> | 73 | </table> |
72 | </td> | 74 | </td> |
73 | <td class="right_small"><table class="inner" border='0' style='border-top:0; border-left:0'> | 75 | <td class="right_small"><table class="inner" border='0' style='border-top:0; border-left:0'> |
74 | - <tr border='0' style='border-top:0; border-left:0'><td border='0' style='border-top:0; border-left:0'><?= $model['delivery']?> дн.</td></tr> | 76 | + <tr border='0' style='border-top:0; border-left:0'><td border='0' style='border-top:0; border-left:0'><?= $model->delivery?> дн.</td></tr> |
75 | 77 | ||
76 | </table></td> | 78 | </table></td> |
77 | <td class="right_medium"><table class="inner" border='0' style='border-top:0; border-left:0'> | 79 | <td class="right_medium"><table class="inner" border='0' style='border-top:0; border-left:0'> |
78 | - <tr border='0' style='border-top:0; border-left:0'><td border='0' style='border-top:0; border-left:0'><?= $model['price']?></td></tr> | 80 | + <tr border='0' style='border-top:0; border-left:0'><td border='0' style='border-top:0; border-left:0'><?= $model->outputPrice?></td></tr> |
79 | 81 | ||
80 | </table></td> | 82 | </table></td> |
81 | </tr> | 83 | </tr> |