Commit 55b984adf20f5cef540fc265d0e2bc46dc2dbb89

Authored by Karnovsky A
1 parent d0a3671d

---

common/components/artboximage/ArtboxImage.php
@@ -52,7 +52,8 @@ class ArtboxImage extends Component { @@ -52,7 +52,8 @@ class ArtboxImage extends Component {
52 'initialPreview' => $model->{$modelField} ? Html::img($model->{$modelField}) : '', 52 'initialPreview' => $model->{$modelField} ? Html::img($model->{$modelField}) : '',
53 'overwriteInitial' => !$multiple, 53 'overwriteInitial' => !$multiple,
54 'showRemove' => true, 54 'showRemove' => true,
55 - 'showUpload' => false, 55 + 'showUpload' => true,
  56 + 'showCaption' => false,
56 'uploadUrl' => $this->uploadUrl, 57 'uploadUrl' => $this->uploadUrl,
57 'uploadExtraData' => [ 58 'uploadExtraData' => [
58 'fileField' => $modelField, 59 'fileField' => $modelField,
@@ -60,7 +61,9 @@ class ArtboxImage extends Component { @@ -60,7 +61,9 @@ class ArtboxImage extends Component {
60 ], 61 ],
61 ], 62 ],
62 'pluginEvents' => [ 63 'pluginEvents' => [
63 - "change" => "function() { console.log('change'); }", 64 + "change" => "function() {
  65 + alert('_change');
  66 + }",
64 "open" => "function() { console.log('open'); }", 67 "open" => "function() { console.log('open'); }",
65 "save" => "function() { console.log('save'); }", 68 "save" => "function() { console.log('save'); }",
66 "upload" => "function() { console.log('upload'); }", 69 "upload" => "function() { console.log('upload'); }",
common/modules/product/models/Brand.php
@@ -43,6 +43,13 @@ class Brand extends \yii\db\ActiveRecord @@ -43,6 +43,13 @@ class Brand extends \yii\db\ActiveRecord
43 'slugKeyName' => 'alias', 43 'slugKeyName' => 'alias',
44 'translit' => true 44 'translit' => true
45 ], 45 ],
  46 + 'image' => [
  47 + 'class' => UploadBehavior::className(),
  48 + 'attribute' => 'file',
  49 + 'scenarios' => ['insert', 'update'],
  50 + 'path' => '@webroot/upload/docs/{category.id}',
  51 + 'url' => '@web/upload/docs/{category.id}',
  52 + ],
46 ], 53 ],
47 ]; 54 ];
48 } 55 }
common/modules/product/models/Product.php
@@ -71,7 +71,7 @@ class Product extends \yii\db\ActiveRecord @@ -71,7 +71,7 @@ class Product extends \yii\db\ActiveRecord
71 [['name'], 'string', 'max' => 150], 71 [['name'], 'string', 'max' => 150],
72 [['alias'], 'string', 'max' => 250], 72 [['alias'], 'string', 'max' => 250],
73 [['categories', 'variants', 'options', 'imagesUpload'], 'safe'], 73 [['categories', 'variants', 'options', 'imagesUpload'], 'safe'],
74 - [['imagesUpload'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif', 'maxFiles' => 50], 74 +// [['imagesUpload'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif', 'maxFiles' => 50],
75 [['description', 'video'], 'safe'], 75 [['description', 'video'], 'safe'],
76 [['is_top', 'is_new'], 'boolean'], 76 [['is_top', 'is_new'], 'boolean'],
77 // [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']], 77 // [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']],
console/controllers/ImportController.php
@@ -28,17 +28,22 @@ class ImportController extends Controller { @@ -28,17 +28,22 @@ class ImportController extends Controller {
28 $new_products = $linked_products = 0; 28 $new_products = $linked_products = 0;
29 foreach(RemoteProducts::find()->all() as $product) { 29 foreach(RemoteProducts::find()->all() as $product) {
30 $product->Brand = trim($product->Brand); 30 $product->Brand = trim($product->Brand);
31 - if (!empty($product->product->product_id)) { 31 + if (empty($product->remoteCategory) || empty($product->remoteCategory->category)) {
  32 + continue;
  33 + }
  34 + if (!empty($product->product->product_id))
  35 + {
32 $linked_products++; 36 $linked_products++;
33 37
34 $_productVariant = ProductVariant::findOne($product->product->product_variant_id); 38 $_productVariant = ProductVariant::findOne($product->product->product_variant_id);
  39 +
35 $_product = Product::findOne($product->product->product_id); 40 $_product = Product::findOne($product->product->product_id);
36 41
37 $brand = Brand::find()->filterWhere(['ilike', 'remote_id', trim($product->Brand)])->one(); 42 $brand = Brand::find()->filterWhere(['ilike', 'remote_id', trim($product->Brand)])->one();
38 43
39 if ( 44 if (
40 $_product->name != $product->Name || 45 $_product->name != $product->Name ||
41 - $_product->categories[0]->category_id != [$product->remoteCategory->category->category_id] || 46 + $_product->categories[0]->category_id != $product->remoteCategory->category->category_id ||
42 ($product->Brand && $brand !== null && $_product->brand_id != $brand->brand_id) 47 ($product->Brand && $brand !== null && $_product->brand_id != $brand->brand_id)
43 ) { 48 ) {
44 $_product->name = $product->Name; 49 $_product->name = $product->Name;
@@ -71,7 +76,8 @@ class ImportController extends Controller { @@ -71,7 +76,8 @@ class ImportController extends Controller {
71 } 76 }
72 $_productVariant->save(); 77 $_productVariant->save();
73 } 78 }
74 - } elseif (!empty($product->remoteCategory) && !empty($product->remoteCategory->category) && !empty($product->remoteCategory->category->category_id)) { 79 + }
  80 + elseif (!empty($product->remoteCategory->category->category_id)) {
75 $new_products++; 81 $new_products++;
76 82
77 $_product = new Product(); 83 $_product = new Product();
@@ -90,7 +96,6 @@ class ImportController extends Controller { @@ -90,7 +96,6 @@ class ImportController extends Controller {
90 $_product->brand_id = $brand->brand_id; 96 $_product->brand_id = $brand->brand_id;
91 } 97 }
92 } 98 }
93 -  
94 $_productVariant->price = floatval($product->Price); 99 $_productVariant->price = floatval($product->Price);
95 $_productVariant->price_old = floatval($product->Price_old); 100 $_productVariant->price_old = floatval($product->Price_old);
96 $_productVariant->sku = empty($product->Article) ? uniqid('gds_') : $product->Article; 101 $_productVariant->sku = empty($product->Article) ? uniqid('gds_') : $product->Article;
@@ -102,7 +107,6 @@ class ImportController extends Controller { @@ -102,7 +107,6 @@ class ImportController extends Controller {
102 print $this->stdout("Saved error for the {$_product->name} {$_product->product_id}?\n"); 107 print $this->stdout("Saved error for the {$_product->name} {$_product->product_id}?\n");
103 return Controller::EXIT_CODE_ERROR; 108 return Controller::EXIT_CODE_ERROR;
104 } 109 }
105 -  
106 $_productVariant->product_id = $_product->product_id; 110 $_productVariant->product_id = $_product->product_id;
107 if (!$_productVariant->save()) { 111 if (!$_productVariant->save()) {
108 print $this->stdout("Saved error for variant of the {$_product->name} {$_product->product_id}?\n"); 112 print $this->stdout("Saved error for variant of the {$_product->name} {$_product->product_id}?\n");
frontend/web/images/lightbox/close.png 0 → 100644

280 Bytes

frontend/web/images/lightbox/loading.gif 0 → 100644

8.28 KB

frontend/web/images/lightbox/next.png 0 → 100644

1.32 KB

frontend/web/images/lightbox/prev.png 0 → 100644

1.33 KB