Commit e3b0a3cbf50e101557397e6db21058a80028b34b

Authored by Alexey Boroda
1 parent 427196c7

-Export/Import

-Variants fix
common/config/main.php
... ... @@ -231,7 +231,8 @@
231 231 'main_event_one' => [
232 232 'resize' => [
233 233 'width' => 308,
234   - 'height' => 221,
  234 + 'height' => 206,
  235 + 'master' => yii\image\drivers\Kohana_Image::NONE,
235 236 ],
236 237 ],
237 238 'product_list_item' => [
... ...
common/modules/product/models/Export.php
... ... @@ -47,7 +47,7 @@
47 47  
48 48 $list = [
49 49 $categories,
50   - (!empty($product->size) ? $product->size : ''),
  50 + '',
51 51 $product->name,
52 52 '',
53 53 ( ( !empty( $product->description ) ) ? $product->description : '' ),
... ...
common/modules/product/models/Import.php
... ... @@ -220,8 +220,8 @@ class Import extends Model {
220 220 continue;
221 221 }
222 222  
223   - // 4 Описание Укр
224   - $product_body_uk = $data[3];
  223 + // 4 Материал (кастомное поле для Баккары)
  224 + $product_material = $data[3];
225 225  
226 226 // 5 Описание Рус
227 227 $product_body_ru = $data[4];
... ... @@ -231,8 +231,9 @@ class Import extends Model {
231 231  
232 232 // 11 Цена акция
233 233 $product_cost_old = floatval($data[7]);
234   -
  234 +
235 235 // 10 Цена
  236 + $product_cost = '';
236 237 if ($product_cost_old) {
237 238 $product_cost_old = floatval($data[6]);
238 239 $product_cost = floatval($data[7]);
... ... @@ -274,7 +275,7 @@ class Import extends Model {
274 275  
275 276 foreach($catalog_names as $catalog_name){
276 277 // ==== Set category ====
277   - if ( ($category = Category::find()->filterWhere(['ilike', 'name', trim($catalog_name)])->one()) === null ) {
  278 + if ( ($category = Category::find()->filterWhere(['name' => trim($catalog_name)])->one()) === null ) {
278 279 // Create category
279 280 $category = new Category();
280 281 $category->name = trim($catalog_name);
... ... @@ -308,6 +309,7 @@ class Import extends Model {
308 309 $_product->akciya = $product_akciya;
309 310 $_product->is_new = $product_new;
310 311 $_product->size = $product_size;
  312 + $_product->material = $product_material;
311 313  
312 314 if (!$_product->save()) {
313 315 $result_items[] = 'Product #'. $_product->name .' not saved' . " (строка $j)";
... ...
common/modules/product/models/ProductVariant.php
... ... @@ -317,7 +317,7 @@
317 317 {
318 318 parent::afterSave($insert, $changedAttributes);
319 319 $this->unlinkAll('options', true);
320   - $options = TaxOption::findAll($this->_options);
  320 + $options = TaxOption::findAll($this->options);
321 321 foreach($options as $option) {
322 322 $this->link('options', $option);
323 323 }
... ...