Commit c361f57467ab5d1f92f19f6b73c3acb1f23f2f16
1 parent
389fc0d1
big commti
Showing
6 changed files
with
37 additions
and
6 deletions
Show diff stats
backend/views/event/_form.php
common/models/Event.php
... | ... | @@ -91,7 +91,7 @@ class Event extends \yii\db\ActiveRecord |
91 | 91 | { |
92 | 92 | return [ |
93 | 93 | [['body', 'seo_text'], 'string'], |
94 | - [['created_at', 'updated_at','percent','sale' ], 'integer'], | |
94 | + [['created_at', 'updated_at','percent','sale','is_event' ], 'integer'], | |
95 | 95 | [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at','banner'], 'string', 'max' => 255], |
96 | 96 | [['name','body'], 'required'], |
97 | 97 | [['imageUpload'], 'safe'], |
... | ... | @@ -122,6 +122,7 @@ class Event extends \yii\db\ActiveRecord |
122 | 122 | 'products_file' => Yii::t('app', 'Загрузка файла'), |
123 | 123 | 'sale' => Yii::t('app', 'Распродажа'), |
124 | 124 | 'percent' => Yii::t('app', 'Процент'), |
125 | + 'is_event' => Yii::t('app', 'Акция'), | |
125 | 126 | ]; |
126 | 127 | } |
127 | 128 | ... | ... |
common/modules/product/models/Export.php
... | ... | @@ -13,6 +13,7 @@ class Export extends Model { |
13 | 13 | public function process($dirName, $filename = null, $use_not_enables = false) { |
14 | 14 | set_time_limit(0); |
15 | 15 | ini_set('max_execution_time', 900); |
16 | + ini_set('memory_limit', '1024M'); | |
16 | 17 | if (is_null($filename)) { |
17 | 18 | $filename = 'products_'. date('d_m_Y_H_i') .'.csv'; |
18 | 19 | } | ... | ... |
common/modules/product/models/Import.php
... | ... | @@ -443,17 +443,17 @@ class Import extends Model { |
443 | 443 | $MOD_ARRAY[] = $_productVariant->product_variant_id; |
444 | 444 | |
445 | 445 | if ($mod_image) { |
446 | - $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($mod_image); | |
447 | - if (file_exists($source_image)) { | |
446 | +// $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($mod_image); | |
447 | +// if (file_exists($source_image)) { | |
448 | 448 | if (($variantImage = ProductImage::find()->andFilterWhere(['ilike', 'image', $mod_image])->andFilterWhere(['product_variant_id' => $_productVariant->product_variant_id])->one()) === null) { |
449 | - copy($source_image, Yii::getAlias('@productsDir') . "/" . $mod_image); | |
449 | +// copy($source_image, Yii::getAlias('@productsDir') . "/" . $mod_image); | |
450 | 450 | $variantImage = new ProductImage(); |
451 | 451 | $variantImage->product_id = $_product->product_id; |
452 | 452 | $variantImage->product_variant_id = $_productVariant->product_variant_id; |
453 | 453 | $variantImage->image = $mod_image; |
454 | 454 | $variantImage->save(); |
455 | 455 | } |
456 | - } | |
456 | +// } | |
457 | 457 | } |
458 | 458 | } |
459 | 459 | } | ... | ... |
console/migrations/m160920_193159_add_isEvent_to_event.php
0 → 100755
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160920_193159_add_isEvent_to_event extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->addColumn('event', 'is_event', $this->boolean()); | |
10 | + } | |
11 | + | |
12 | + public function down() | |
13 | + { | |
14 | + $this->dropColumn('event', 'is_event'); | |
15 | + } | |
16 | + | |
17 | + /* | |
18 | + // Use safeUp/safeDown to run migration code within a transaction | |
19 | + public function safeUp() | |
20 | + { | |
21 | + } | |
22 | + | |
23 | + public function safeDown() | |
24 | + { | |
25 | + } | |
26 | + */ | |
27 | +} | ... | ... |
frontend/controllers/EventController.php
... | ... | @@ -54,7 +54,7 @@ class EventController extends Controller |
54 | 54 | |
55 | 55 | protected function findModel($alias) |
56 | 56 | { |
57 | - if (($model = Event::findOne(["alias"=>$alias])) !== null) { | |
57 | + if (($model = Event::findOne(["alias"=>$alias,'is_event' => true])) !== null) { | |
58 | 58 | return $model; |
59 | 59 | } else { |
60 | 60 | throw new NotFoundHttpException('The requested page does not exist.'); | ... | ... |