1412c23a
Mihail
add crocc search ...
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
//$cross_arr = DetailsCrosses::find()->select('ARTICLE, BRAND')->where(['CROSS_ARTICLE' => '0092S40090', 'CROSS_BRAND' => 'BOSCH'])->asArray()->all();
//
// $article_condition = "'" . implode("','", array_column($cross_arr,'ARTICLE')) . "'";
// $brand_condition = "'" . implode("','", array_column($cross_arr,'BRAND')) . "'";
//
// $crosses_provider = new SqlDataProvider([
// 'sql' => $query,
// 'key' => 'article',
// 'pagination' => false,
// 'params' => [':article' => $article_condition,
// ':brand' => $brand_condition],
// 'sort' => [
// 'attributes' => [
// 'box',
// 'delivery',
// 'price'
// ],
// ],
// ]);
|
f0a8acb5
Mihail
add sort function...
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
private function getQuery(){
$query = <<< MySQL
select straight_join `w_details`.`ARTICLE` as `name`,
`w_details`.`BRAND` as `brand`,
`w_details`.`BOX` as `box`,
`w_details`.`ADD_BOX` as `add_box`,
`w_details`.`IMPORT_ID` as `importer_id`,
`w_importers`.`name` as `importer_name`,
`w_importers`.`delivery`,
if (`w_details_description`.`description` = '',
if (`w_details_description`.`tecdoc_description` = '',
`w_details_description`.`supplier_description`,
`w_details_description`.`tecdoc_description`
),
`w_details_description`.`description`
) as `description`,
if (`w_details_description`.`tecdoc_article` = '',
if (`w_details_description`.`article` = '',
if (`w_details`.`FULL_ARTICLE` = '',
`w_details`.`ARTICLE`,
`w_details`.`FULL_ARTICLE`
),
`w_details_description`.`article`
),
`w_details_description`.`tecdoc_article`
) as `article`,
`w_details`.`ID`,
if (`w_details_description`.`image` = '',
if (`w_details_description`.`tecdoc_image` = '',
'',
concat('ital_origin/images/tecdoc/big/',`w_details_description`.`tecdoc_image`)
),
concat('ital_origin/images/goods/big/',`w_details_description`.`image`)
) as `image`,
`w_details_description`.`tecdoc_id`,
round(if(`w_margins_groups`.`koef` is not null,
`w_details`.`PRICE`*`w_margins_groups`.`koef`,
if (`w_margins_importers`.`koef` is not null,
`w_details`.`PRICE`*`w_margins_importers`.`koef`,
`w_details`.`PRICE`*`w_margins`.`koef`
)
)*`t`.`rate`/`w_currency`.`rate`,2) as `price`,
round(if(`input_groups`.`koef` is not null,
`w_details`.`PRICE`*`input_groups`.`koef`,
`w_details`.`PRICE`
)*`t`.`rate`/`w_currency`.`rate`,2) as `input_price`,
round(if(`input_groups`.`koef` is not null,
`w_details`.`PRICE`*`input_groups`.`koef`,
`w_details`.`PRICE`
)*`t`.`rate`/`default`.`rate`,2) as `input_price_default`,
round(if(`w_margins_groups`.`koef` is not null,
`w_details`.`PRICE`*`w_margins_groups`.`koef`,
if (`w_margins_importers`.`koef` is not null,
`w_details`.`PRICE`*`w_margins_importers`.`koef`,
`w_details`.`PRICE`*`w_margins`.`koef`
)
)*`t`.`rate`/`default`.`rate`,2) as `price_default`,
`w_brands`.`ID` as `brand_id`
from `w_details`
inner join `w_brands` on `w_brands`.`BRAND` = `w_details`.`BRAND`
left join `w_details_description` on `w_details_description`.`name` = `w_details`.`ARTICLE` and
`w_details_description`.`brand` = `w_details`.`BRAND`
inner join `w_importers` on `w_importers`.`id` = `w_details`.`IMPORT_ID` and
`w_importers`.`active` = 1
|