Commit 37415bee4fc1e7726fa78de3b4173357910b940d
1 parent
c361f574
big commti
Showing
22 changed files
with
273 additions
and
96 deletions
 
Show diff stats
common/behaviors/SaveImgBehavior.php
| ... | ... | @@ -29,11 +29,11 @@ class SaveImgBehavior extends Behavior | 
| 29 | 29 | { | 
| 30 | 30 | foreach($this->fields as $field){ | 
| 31 | 31 | if ( ($image = UploadedFile::getInstance($this->owner, $field['name'])) ) { | 
| 32 | - $this->owner->image = $image->name; | |
| 32 | + $this->owner->{$field['name']} = $image->name; | |
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | - if(!$this->owner->image){ | |
| 36 | - $this->owner->image = $this->owner->getOldAttribute($field['name']); | |
| 35 | + if(!$this->owner->{$field['name']}){ | |
| 36 | + $this->owner->{$field['name']} = $this->owner->getOldAttribute($field['name']); | |
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | 39 | |
| ... | ... | @@ -58,7 +58,7 @@ class SaveImgBehavior extends Behavior | 
| 58 | 58 | foreach($this->fields as $field){ | 
| 59 | 59 | |
| 60 | 60 | if ( ($image = UploadedFile::getInstance($this->owner, $field['name'])) ) { | 
| 61 | - $this->owner->$field['name'] = $image->name; | |
| 61 | + $this->owner->{$field['name']} = $image->name; | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\behaviors; | |
| 4 | + | |
| 5 | +use common\modules\comment\models\CommentModel; | |
| 6 | +use common\modules\product\models\ProductImage; | |
| 7 | +use yii\base\Behavior; | |
| 8 | +use yii\db\ActiveRecord; | |
| 9 | +use yii\web\UploadedFile; | |
| 10 | +/** | |
| 11 | + * Class RatingBehavior | |
| 12 | + * @property CommentModel $owner | |
| 13 | + * @package common\behaviors | |
| 14 | + */ | |
| 15 | +class SaveMultipleImgBehavior extends Behavior | |
| 16 | +{ | |
| 17 | + | |
| 18 | + public $fields; | |
| 19 | + public $imagesUpload; | |
| 20 | + //public $directory; | |
| 21 | + | |
| 22 | + public function events() | |
| 23 | + { | |
| 24 | + return [ | |
| 25 | + ActiveRecord::EVENT_BEFORE_UPDATE=> 'downloadImages', | |
| 26 | + ActiveRecord::EVENT_BEFORE_INSERT => 'downloadImages', | |
| 27 | + ]; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public function downloadImages($event) | |
| 31 | + { | |
| 32 | + foreach($this->fields as $field){ | |
| 33 | + | |
| 34 | + | |
| 35 | + $this->imagesUpload = UploadedFile::getInstances($this->owner, $field['name']); | |
| 36 | + | |
| 37 | + if ( ($images = $this->imagesUpload($field)) !== FALSE) { | |
| 38 | + | |
| 39 | + foreach ($images as $image) { | |
| 40 | + $imageModel = new ProductImage(); | |
| 41 | + $imageModel->product_id = $this->owner->product_id; | |
| 42 | + $imageModel->image = $image; | |
| 43 | + $imageModel->save(); | |
| 44 | + } | |
| 45 | + | |
| 46 | + | |
| 47 | + } | |
| 48 | + | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * @param $field array ['directory','name'] | |
| 56 | + * @return array | |
| 57 | + */ | |
| 58 | + | |
| 59 | + public function imagesUpload($field) | |
| 60 | + { | |
| 61 | + $images = []; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * @var $image UploadedFile | |
| 65 | + */ | |
| 66 | + | |
| 67 | + foreach ($this->imagesUpload as $image) { | |
| 68 | + | |
| 69 | + $imageName = $image->baseName . '.' . $image->extension; | |
| 70 | + $i = 0; | |
| 71 | + | |
| 72 | + while (file_exists(\Yii::getAlias('@imagesDir/'.$field['directory'].'/' . $imageName))) { | |
| 73 | + $i++; | |
| 74 | + $imageName = $image->baseName . '_' . $i . '.' . $image->extension; | |
| 75 | + } | |
| 76 | + | |
| 77 | + $imgDir = \Yii::getAlias('@imagesDir/'.$field['directory'].'/'); | |
| 78 | + | |
| 79 | + if (!is_dir($imgDir)) { | |
| 80 | + mkdir($imgDir, 0755, true); | |
| 81 | + } | |
| 82 | + | |
| 83 | + $image->saveAs($imgDir . $imageName); | |
| 84 | + | |
| 85 | + $images[] = $imageName; | |
| 86 | + | |
| 87 | + } | |
| 88 | + return $images; | |
| 89 | + } | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + public function getImageFile($image = 'image') { | |
| 95 | + return empty($this->owner->$image) ? null : '/storage/'.$this->fields[0]['directory'].'/'. $this->owner->$image; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public function getImageUrl($image = 'image') { | |
| 99 | + return empty($this->owner->$image) ? null : '/storage/'.$this->fields[0]['directory'].'/'. $this->owner->$image; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public function getImagesConfig() { | |
| 103 | + $op = []; | |
| 104 | + if ($this->owner->images) { | |
| 105 | + foreach ($this->owner->images as $image) { | |
| 106 | + $op[] = [ | |
| 107 | + 'caption' => $image->owner->image, | |
| 108 | + 'url' => \yii\helpers\Url::to(['/product/manage/delimg', 'id' => $image->product_image_id]), | |
| 109 | + 'key' => $image->primaryKey, | |
| 110 | + 'extra' => [ | |
| 111 | + 'id' => $image->primaryKey, | |
| 112 | + ], | |
| 113 | + ]; | |
| 114 | + } | |
| 115 | + } | |
| 116 | + return $op; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public function getImagesHTML() { | |
| 120 | + $op = []; | |
| 121 | + if ($this->images) { | |
| 122 | + foreach ($this->images as $image) { | |
| 123 | + $op[] = \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'admin_thumb'); | |
| 124 | + } | |
| 125 | + } | |
| 126 | + return $op; | |
| 127 | + } | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | +} | |
| 0 | 136 | \ No newline at end of file | ... | ... | 
common/behaviors/Slug.php
| ... | ... | @@ -22,6 +22,7 @@ class Slug extends Behavior | 
| 22 | 22 | |
| 23 | 23 | public function getSlug( $event ) | 
| 24 | 24 | { | 
| 25 | + | |
| 25 | 26 | if(!empty($this->owner->{$this->in_attribute})){ | 
| 26 | 27 | if ( empty( $this->owner->{$this->out_attribute} ) ) { | 
| 27 | 28 | $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} ); | ... | ... | 
common/config/main.php
common/modules/product/controllers/ManageController.php
| ... | ... | @@ -82,20 +82,7 @@ class ManageController extends Controller | 
| 82 | 82 | $model = new Product(); | 
| 83 | 83 | |
| 84 | 84 | if ($model->load(Yii::$app->request->post())) { | 
| 85 | - $model->imagesUpload = UploadedFile::getInstances($model, 'imagesUpload'); | |
| 86 | - | |
| 87 | - if ($model->save() && $model->imagesUpload) { | |
| 88 | - | |
| 89 | - $imgDir = Yii::getAlias('@storage/articles/'); | |
| 90 | - | |
| 91 | - if ( ($images = $model->imagesUpload()) !== FALSE) { | |
| 92 | - foreach ($images as $image) { | |
| 93 | - $imageModel = new ProductImage(); | |
| 94 | - $imageModel->product_id = $model->product_id; | |
| 95 | - $imageModel->image = $image; | |
| 96 | - $imageModel->save(); | |
| 97 | - } | |
| 98 | - } | |
| 85 | + if ($model->save()) { | |
| 99 | 86 | |
| 100 | 87 | return $this->redirect(['view', 'id' => $model->product_id]); | 
| 101 | 88 | } | 
| ... | ... | @@ -116,20 +103,7 @@ class ManageController extends Controller | 
| 116 | 103 | { | 
| 117 | 104 | $model = $this->findModel($id); | 
| 118 | 105 | if ($model->load(Yii::$app->request->post())) { | 
| 119 | - $model->imagesUpload = UploadedFile::getInstances($model, 'imagesUpload'); | |
| 120 | 106 | if ($model->save()) { | 
| 121 | -// foreach ($model->images as $image) { | |
| 122 | -// $image->delete(); | |
| 123 | -// } | |
| 124 | - if ( ($images = $model->imagesUpload()) !== FALSE) { | |
| 125 | - foreach ($images as $image) { | |
| 126 | - $imageModel = new ProductImage(); | |
| 127 | - $imageModel->product_id = $model->product_id; | |
| 128 | - $imageModel->image = $image; | |
| 129 | - $imageModel->save(); | |
| 130 | - } | |
| 131 | - } | |
| 132 | - | |
| 133 | 107 | return $this->redirect(['view', 'id' => $model->product_id]); | 
| 134 | 108 | } | 
| 135 | 109 | } else { | ... | ... | 
common/modules/product/models/Category.php
| ... | ... | @@ -209,7 +209,8 @@ class Category extends \yii\db\ActiveRecord | 
| 209 | 209 | ->innerJoin('product', 'product.product_id = product_variant.product_id') | 
| 210 | 210 | ->innerJoin('product_category', 'product_category.product_id = product.product_id') | 
| 211 | 211 | ->innerJoin('tax_value_string', 'tax_value_string.tax_option_id = tax_option.tax_option_id') | 
| 212 | - ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE]) | |
| 212 | + ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id') | |
| 213 | + ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id]) | |
| 213 | 214 | ->andWhere(['!=', 'product_variant.stock', 0]); | 
| 214 | 215 | |
| 215 | 216 | $query2 = (new Query()) | 
| ... | ... | @@ -224,7 +225,8 @@ class Category extends \yii\db\ActiveRecord | 
| 224 | 225 | ->innerJoin('product_category', 'product_category.product_id = product.product_id') | 
| 225 | 226 | ->innerJoin('product_variant', 'product_variant.product_id = product.product_id') | 
| 226 | 227 | ->innerJoin('tax_value_string', 'tax_value_string.tax_option_id = tax_option.tax_option_id') | 
| 227 | - ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE]) | |
| 228 | + ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id') | |
| 229 | + ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id]) | |
| 228 | 230 | ->andWhere(['!=', 'product_variant.stock', 0]); | 
| 229 | 231 | $query3 = (new Query()) | 
| 230 | 232 | ->select([ | ... | ... | 
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 | } | ... | ... | 
common/modules/product/models/Product.php
| ... | ... | @@ -2,6 +2,7 @@ | 
| 2 | 2 | |
| 3 | 3 | namespace common\modules\product\models; | 
| 4 | 4 | |
| 5 | +use common\behaviors\SaveMultipleImgBehavior; | |
| 5 | 6 | use common\behaviors\Slug; | 
| 6 | 7 | use common\models\ProductToRating; | 
| 7 | 8 | use common\models\Share; | 
| ... | ... | @@ -42,6 +43,9 @@ class Product extends \yii\db\ActiveRecord | 
| 42 | 43 | /** @var array $_images */ | 
| 43 | 44 | public $imagesUpload = ''; | 
| 44 | 45 | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 45 | 49 | /** | 
| 46 | 50 | * @inheritdoc | 
| 47 | 51 | */ | 
| ... | ... | @@ -49,7 +53,13 @@ class Product extends \yii\db\ActiveRecord | 
| 49 | 53 | { | 
| 50 | 54 | return [ | 
| 51 | 55 | [ | 
| 52 | - 'class' =>FilterBehavior::className(), | |
| 56 | + 'class' => SaveMultipleImgBehavior::className(), | |
| 57 | + 'fields' => [ | |
| 58 | + ['name'=>'imagesUpload','directory' => 'products' ] | |
| 59 | + ] | |
| 60 | + ], | |
| 61 | + [ | |
| 62 | + 'class' => FilterBehavior::className(), | |
| 53 | 63 | ], | 
| 54 | 64 | [ | 
| 55 | 65 | 'class' => Slug::className(), | 
| ... | ... | @@ -298,28 +308,37 @@ class Product extends \yii\db\ActiveRecord | 
| 298 | 308 | ->sum('quantity'); | 
| 299 | 309 | } | 
| 300 | 310 | |
| 301 | - public function afterSave($insert, $changedAttributes) | |
| 311 | + | |
| 312 | + public function beforeSave($insert) | |
| 302 | 313 | { | 
| 303 | - parent::afterSave($insert, $changedAttributes); | |
| 304 | 314 | |
| 315 | + if(parent::beforeSave($insert)){ | |
| 316 | + if(!empty($this->categories)){ | |
| 317 | + $categories = Category::findAll($this->categories); | |
| 318 | + $this->unlinkAll('categories', true); | |
| 319 | + foreach($categories as $category){ | |
| 320 | + $this->link('categories', $category); | |
| 321 | + } | |
| 322 | + } | |
| 305 | 323 | |
| 306 | - if(!empty($this->categories)){ | |
| 307 | - $categories = Category::findAll($this->categories); | |
| 308 | - $this->unlinkAll('categories', true); | |
| 309 | - foreach($categories as $category){ | |
| 310 | - $this->link('categories', $category); | |
| 324 | + if(!empty($this->options)){ | |
| 325 | + $options = TaxOption::findAll($this->options); | |
| 326 | + $this->unlinkAll('options',true); | |
| 327 | + foreach($options as $option){ | |
| 328 | + $this->link('options', $option); | |
| 329 | + } | |
| 311 | 330 | } | 
| 331 | + return true; | |
| 312 | 332 | } | 
| 333 | + return false; | |
| 313 | 334 | |
| 314 | 335 | |
| 315 | - if(!empty($this->options)){ | |
| 316 | - $options = TaxOption::findAll($this->options); | |
| 317 | - $this->unlinkAll('options',true); | |
| 318 | - foreach($options as $option){ | |
| 319 | - $this->link('options', $option); | |
| 320 | - } | |
| 321 | - } | |
| 322 | 336 | |
| 337 | + } | |
| 338 | + | |
| 339 | + public function afterSave($insert, $changedAttributes) | |
| 340 | + { | |
| 341 | + parent::afterSave($insert, $changedAttributes); | |
| 323 | 342 | |
| 324 | 343 | if (!empty($this->_variants)) { | 
| 325 | 344 | $todel = []; | 
| ... | ... | @@ -399,7 +418,6 @@ class Product extends \yii\db\ActiveRecord | 
| 399 | 418 | foreach ($this->images as $image) { | 
| 400 | 419 | $op[] = [ | 
| 401 | 420 | 'caption' => $image->image, | 
| 402 | - 'width' => '120px', | |
| 403 | 421 | 'url' => \yii\helpers\Url::to(['/product/manage/delimg', 'id' => $image->product_image_id]), | 
| 404 | 422 | 'key' => $image->product_image_id, | 
| 405 | 423 | 'extra' => [ | ... | ... | 
common/modules/product/models/ProductVariant.php
| ... | ... | @@ -163,7 +163,7 @@ class ProductVariant extends \yii\db\ActiveRecord | 
| 163 | 163 | public function getImageUrl() | 
| 164 | 164 | { | 
| 165 | 165 | // return a default image placeholder if your source image is not found | 
| 166 | - return !empty($this->image) ? $this->image->imageUrl : '/images/no_photo.png'; | |
| 166 | + return (!empty($this->image) && file_exists(Yii::getAlias('@productsDir') . "/" . $this->image->image )) ? $this->image->imageUrl : '/images/no_photo.png'; | |
| 167 | 167 | } | 
| 168 | 168 | |
| 169 | 169 | public function getFullname() { | ... | ... | 
console/config/bootstrap.php
| ... | ... | @@ -6,4 +6,4 @@ Yii::setAlias('@uploadFilePricesAway', 'price_product_away.csv'); | 
| 6 | 6 | Yii::setAlias('@uploadFilePricesDuplicate', 'price_duplicate.csv'); | 
| 7 | 7 | Yii::setAlias('@uploadFilePricesNoVariant', 'price_no_variant.csv'); | 
| 8 | 8 | |
| 9 | -Yii::setAlias('@productsDir', '@frontend/web/images/products'); | |
| 10 | 9 | \ No newline at end of file | 
| 10 | +Yii::setAlias('@productsDir', '@storage/products'); | |
| 11 | 11 | \ No newline at end of file | ... | ... | 
console/controllers/ImportController.php
| ... | ... | @@ -20,6 +20,26 @@ class ImportController extends Controller { | 
| 20 | 20 | public $errors = []; | 
| 21 | 21 | |
| 22 | 22 | |
| 23 | + public function actionImages(){ | |
| 24 | + $files = ProductImage::find()->all(); | |
| 25 | + foreach($files as $file_object){ | |
| 26 | + $file = $file_object->image; | |
| 27 | + $file_array = explode('/',$file); | |
| 28 | + if(is_array($file_array) && count($file_array) >3){ | |
| 29 | + $count = count($file_array); | |
| 30 | + $file_name = $file_array[$count-2]."_".$file_array[$count-1]; | |
| 31 | + print_r($file_name); | |
| 32 | + $save_image = Yii::getAlias('@productsDir') . "/" . $file_name; | |
| 33 | + copy($file, $save_image); | |
| 34 | + $file_object->image = $file_name; | |
| 35 | + $file_object->save(); | |
| 36 | + } | |
| 37 | + | |
| 38 | + } | |
| 39 | + | |
| 40 | + | |
| 41 | + } | |
| 42 | + | |
| 23 | 43 | private function getProductsFile($file_type = 'uploadFileProducts') { | 
| 24 | 44 | $filename = Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@'. $file_type); | 
| 25 | 45 | if (!is_file($filename)) { | ... | ... | 
console/migrations/m160920_193159_add_isEvent_to_event.php renamed to console/migrations/m160920_193158_add_isEvent_to_event.php
frontend/config/bootstrap.php
frontend/config/main.php
| ... | ... | @@ -76,7 +76,7 @@ return [ | 
| 76 | 76 | 'blog' => 'articles/index', | 
| 77 | 77 | 'blog/<translit:[\w\-]+>-<id:\d+>' => 'articles/show', | 
| 78 | 78 | 'event' => 'event/index', | 
| 79 | - 'event/<alias:[\w\-]+>-<id:\d+>' => 'event/show', | |
| 79 | + 'event/<alias:[\w\-]+>' => 'event/show', | |
| 80 | 80 | ], | 
| 81 | 81 | 'class' => 'common\components\urlManager\LangUrlManager', | 
| 82 | 82 | 'languages' => ['ru', 'ua', 'en'], | ... | ... | 
frontend/controllers/CatalogController.php
| ... | ... | @@ -24,6 +24,7 @@ use yii\data\Pagination; | 
| 24 | 24 | use yii\data\Sort; | 
| 25 | 25 | use yii\db\ActiveQuery; | 
| 26 | 26 | use yii\helpers\ArrayHelper; | 
| 27 | +use yii\helpers\VarDumper; | |
| 27 | 28 | use yii\web\HttpException; | 
| 28 | 29 | |
| 29 | 30 | class CatalogController extends \yii\web\Controller | 
| ... | ... | @@ -117,7 +118,6 @@ class CatalogController extends \yii\web\Controller | 
| 117 | 118 | |
| 118 | 119 | $groups = $category->getActiveFilters()->all(); | 
| 119 | 120 | $groups = ArrayHelper::index($groups, null, 'name'); | 
| 120 | - | |
| 121 | 121 | $priceLimits = $productModel->priceLimits($category, $params); | 
| 122 | 122 | |
| 123 | 123 | /* | ... | ... | 
frontend/controllers/EventController.php
| ... | ... | @@ -17,7 +17,7 @@ class EventController extends Controller | 
| 17 | 17 | { | 
| 18 | 18 | |
| 19 | 19 | $dataProvider = new ActiveDataProvider([ | 
| 20 | - 'query' => Event::find() ]); | |
| 20 | + 'query' => Event::find()->where(['is_event'=>true]) ]); | |
| 21 | 21 | |
| 22 | 22 | return $this->render('index', [ | 
| 23 | 23 | 'dataProvider' => $dataProvider, | 
| ... | ... | @@ -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,'is_event' => true])) !== null) { | |
| 57 | + if (($model = Event::findOne(["alias"=>$alias])) !== null) { | |
| 58 | 58 | return $model; | 
| 59 | 59 | } else { | 
| 60 | 60 | throw new NotFoundHttpException('The requested page does not exist.'); | ... | ... | 
frontend/controllers/OrderController.php
| ... | ... | @@ -70,7 +70,10 @@ | 
| 70 | 70 | $modelOrdersProducts->validate(); | 
| 71 | 71 | $modelOrdersProducts->save(); | 
| 72 | 72 | $productV[ $index ] = ArrayHelper::toArray($modelOrdersProducts); | 
| 73 | - $productV[ $index ][ 'img' ] = \common\components\artboximage\ArtboxImageHelper::getImageSrc($product->image->imageUrl, 'list'); | |
| 73 | + if(isset($product->image)){ | |
| 74 | + $productV[ $index ][ 'img' ] = \common\components\artboximage\ArtboxImageHelper::getImageSrc($product->image->imageUrl, 'list'); | |
| 75 | + } | |
| 76 | + | |
| 74 | 77 | } | 
| 75 | 78 | } | 
| 76 | 79 | /** | ... | ... | 
frontend/controllers/SiteController.php
frontend/views/catalog/product.php
| ... | ... | @@ -96,7 +96,10 @@ FlipclockAsset::register($this); | 
| 96 | 96 | <tbody> | 
| 97 | 97 | <tr> | 
| 98 | 98 | <td> | 
| 99 | - <strike><span><span id='old_cost'><?= $product->variant->price_old ?></span></span> грн.</strike> | |
| 99 | + <?php if( $product->variant->price_old ){?> | |
| 100 | + <strike><span><span id='old_cost'><?= $product->variant->price_old ?></span></span> грн.</strike> | |
| 101 | + <?php }?> | |
| 102 | + | |
| 100 | 103 | <span class="cost"><span itemprop="price"><span id='cost'><?= $product->variant->price ?></span></span> <span class="valute">грн.</span></span> | 
| 101 | 104 | <meta itemprop="priceCurrency" content="UAH"> | 
| 102 | 105 | </td> | 
| ... | ... | @@ -204,7 +207,7 @@ FlipclockAsset::register($this); | 
| 204 | 207 | — Самовывоз Новая Почта - 55 грн.<br> | 
| 205 | 208 | — Курьер Новая Почта - 88 грн.<br> | 
| 206 | 209 | — Курьер «ИнТайм» - 60 грн.</p> | 
| 207 | - | |
| 210 | + <?php if($product->variant->price > 1000){?> | |
| 208 | 211 | <p> | 
| 209 | 212 | <span class="strong black">Киев</span>:<br> | 
| 210 | 213 | — Курьер - <s>50 грн.</s> | 
| ... | ... | @@ -214,8 +217,19 @@ FlipclockAsset::register($this); | 
| 214 | 217 | <span class="up bold black">бесплатно!</span><br> | 
| 215 | 218 | — Пункт Новой Почты - <s>55 грн.</s> | 
| 216 | 219 | <span class="bold black up">бесплатно!</span> | 
| 217 | - <span class="star_info">*</span></p> | |
| 218 | - | |
| 220 | + <span class="star_info">*</span> | |
| 221 | + </p> | |
| 222 | + <?php } else {?> | |
| 223 | + <p> | |
| 224 | + <span class="strong black">Киев</span>:<br> | |
| 225 | + — Курьер - 50 грн | |
| 226 | + <span class="star_info">*</span><br> | |
| 227 | + — Самовывоз - | |
| 228 | + <span class="up bold black">бесплатно!</span><br> | |
| 229 | + — Пункт Новой Почты - 55 грн. | |
| 230 | + <span class="star_info">*</span> | |
| 231 | + </p> | |
| 232 | + <?php }?> | |
| 219 | 233 | <p> | 
| 220 | 234 | <span class="star_info">* Стоимость расчитана для оформляемого заказа</span> | 
| 221 | 235 | </p> | 
| ... | ... | @@ -254,9 +268,15 @@ FlipclockAsset::register($this); | 
| 254 | 268 | <tr> | 
| 255 | 269 | <td class="price_block"> | 
| 256 | 270 | <div class="price_block_container"> | 
| 257 | - | |
| 258 | - | |
| 271 | + | |
| 272 | + | |
| 259 | 273 | <div class="price"> | 
| 274 | + <?php if($product->variant->price_old){?> | |
| 275 | + <span class="main"> | |
| 276 | + <span itemprop="price" class="price"><s><?= $product->variant->price_old ?></s></span> | |
| 277 | + <span class="currency"> грн.</span> | |
| 278 | + </span> | |
| 279 | + <?php }?> | |
| 260 | 280 | <span class="main"> | 
| 261 | 281 | <span itemprop="price" class="price"><?= $product->variant->price ?></span> | 
| 262 | 282 | <span class="currency"> грн.</span> | 
| ... | ... | @@ -271,21 +291,20 @@ FlipclockAsset::register($this); | 
| 271 | 291 | |
| 272 | 292 | <div class="buy_button"> | 
| 273 | 293 | <a href="#" class="btn btn-large buy_button" data-toggle="modal" data-id="<?php echo $product->variant->product_variant_id; ?>" data-target="#buyForm" lang="5892">Купить</a> | 
| 274 | - <?php | |
| 275 | - /* Payment by Visa and Webmoney | |
| 276 | - ?> | |
| 277 | - <div class="payment_visa"> | |
| 278 | - Оплатить | |
| 279 | - <a href="payment.htm#privat" target="_blank"> | |
| 280 | - <span class="visa" onclick="" data-toggle1="modal" data-target1="#buyForm"></span> | |
| 281 | - </a> | |
| 282 | - <span class="webmoney" onclick="" data-toggle="modal" data-target="#buyForm"></span> | |
| 283 | - </div> | |
| 284 | - */ | |
| 285 | - ?> | |
| 294 | + | |
| 295 | + | |
| 286 | 296 | <div class="clearfix"></div> | 
| 287 | 297 | </div> | 
| 288 | - | |
| 298 | + <div> | |
| 299 | + <div class="payment_visa"> | |
| 300 | + Оплатить | |
| 301 | + <a href="/text/oplata" target="_blank"> | |
| 302 | + <span class="visa" ></span> | |
| 303 | + </a> | |
| 304 | + </div> | |
| 305 | + <div class="clearfix"></div> | |
| 306 | + </div> | |
| 307 | + | |
| 289 | 308 | <div class="follow_price"> | 
| 290 | 309 | <?php | 
| 291 | 310 | /* Where buy | 
| ... | ... | @@ -389,7 +408,7 @@ FlipclockAsset::register($this); | 
| 389 | 408 | <div class="events"> | 
| 390 | 409 | <?php foreach($product->events as $event):?> | 
| 391 | 410 | <?php if(!empty($event->banner) && $event->isActive()):?> | 
| 392 | - <?= Html::a(\common\components\artboximage\ArtboxImageHelper::getImage($event->bannerUrl, 'event_in_product'),Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?> | |
| 411 | + <?= Html::a(\common\components\artboximage\ArtboxImageHelper::getImage($event->getImageUrl('banner'), 'event_in_product'),Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?> | |
| 393 | 412 | <?php endif; ?> | 
| 394 | 413 | <?php endforeach; ?> | 
| 395 | 414 | </div> | ... | ... | 
frontend/views/event/_objects.php
| ... | ... | @@ -9,11 +9,11 @@ FlipclockAsset::register($this); | 
| 9 | 9 | <div class="news_item"> | 
| 10 | 10 | |
| 11 | 11 | |
| 12 | - <a href="<?=Url::to(['event/show','alias'=>$model->alias,'id'=>$model->primaryKey])?>" class="name"><?=$model->name?></a> | |
| 12 | + <a href="<?=Url::to(['event/show','alias'=>$model->alias])?>" class="name"><?=$model->name?></a> | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | <div style="position: relative"> | 
| 16 | - <a href="<?=Url::to(['event/show','alias'=>$model->alias,'id'=>$model->primaryKey])?>"> | |
| 16 | + <a href="<?=Url::to(['event/show','alias'=>$model->alias])?>"> | |
| 17 | 17 | <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'event_left', ['align' => 'left'])?> | 
| 18 | 18 | </a> | 
| 19 | 19 | ... | ... | 
frontend/views/site/error.php
| ... | ... | @@ -62,8 +62,8 @@ $this->title = 'Ошибка '.$code; | 
| 62 | 62 | margin-right: 24px; | 
| 63 | 63 | width: 180px; | 
| 64 | 64 | height: 38px; | 
| 65 | - background: #95ba2f; | |
| 66 | - border-bottom: 3px solid #799920; | |
| 65 | + background: #0f6fc7; | |
| 66 | + border-bottom: 3px solid #075fb0; | |
| 67 | 67 | box-sizing: border-box; | 
| 68 | 68 | text-align: center; | 
| 69 | 69 | text-transform: uppercase; | 
| ... | ... | @@ -75,11 +75,11 @@ $this->title = 'Ошибка '.$code; | 
| 75 | 75 | border-radius: 4px; | 
| 76 | 76 | } | 
| 77 | 77 | .button-home-404 a:hover { | 
| 78 | - border-bottom: 3px solid #95ba2f; | |
| 78 | + border-bottom: 3px solid #0f6fc7; | |
| 79 | 79 | } | 
| 80 | 80 | .button-home-404 a:active { | 
| 81 | - background: #799920; | |
| 82 | - border-bottom: 3px solid #799920; | |
| 81 | + background: #0f6fc7; | |
| 82 | + border-bottom: 3px solid #075fb0; | |
| 83 | 83 | } | 
| 84 | 84 | </style> | 
| 85 | 85 | ... | ... | 
frontend/web/css/css_header.css
| ... | ... | @@ -11704,13 +11704,13 @@ a.preview { | 
| 11704 | 11704 | border-bottom: 1px dashed #0156a9 | 
| 11705 | 11705 | } | 
| 11706 | 11706 | |
| 11707 | -.product_detail .info_table .price_block .buy_button .payment_visa { | |
| 11707 | +.product_detail .info_table .price_block .payment_visa { | |
| 11708 | 11708 | font: 14px/20px 'roboto', sans-serif; | 
| 11709 | 11709 | color: #666; | 
| 11710 | 11710 | margin: 0 0 10px 0 | 
| 11711 | 11711 | } | 
| 11712 | 11712 | |
| 11713 | -.product_detail .info_table .price_block .buy_button .payment_visa .visa { | |
| 11713 | +.product_detail .info_table .price_block .payment_visa .visa { | |
| 11714 | 11714 | display: inline-block; | 
| 11715 | 11715 | width: 92px; | 
| 11716 | 11716 | height: 18px; | 
| ... | ... | @@ -11719,11 +11719,11 @@ a.preview { | 
| 11719 | 11719 | cursor: pointer | 
| 11720 | 11720 | } | 
| 11721 | 11721 | |
| 11722 | -.product_detail .info_table .price_block .buy_button .payment_visa .visa:hover { | |
| 11722 | +.product_detail .info_table .price_block .payment_visa .visa:hover { | |
| 11723 | 11723 | background-position: 0 -18px | 
| 11724 | 11724 | } | 
| 11725 | 11725 | |
| 11726 | -.product_detail .info_table .price_block .buy_button .payment_visa .webmoney { | |
| 11726 | +.product_detail .info_table .price_block .payment_visa .webmoney { | |
| 11727 | 11727 | display: inline-block; | 
| 11728 | 11728 | width: 30px; | 
| 11729 | 11729 | height: 18px; | 
| ... | ... | @@ -11732,7 +11732,7 @@ a.preview { | 
| 11732 | 11732 | cursor: pointer | 
| 11733 | 11733 | } | 
| 11734 | 11734 | |
| 11735 | -.product_detail .info_table .price_block .buy_button .payment_visa .webmoney:hover { | |
| 11735 | +.product_detail .info_table .price_block .payment_visa .webmoney:hover { | |
| 11736 | 11736 | background-position: -92px -18px | 
| 11737 | 11737 | } | 
| 11738 | 11738 | |
| ... | ... | @@ -14501,7 +14501,6 @@ ul.product-special li.promo div{ | 
| 14501 | 14501 | |
| 14502 | 14502 | .news_item{ | 
| 14503 | 14503 | display: block; | 
| 14504 | - height: 270px; | |
| 14505 | 14504 | } | 
| 14506 | 14505 | .news_item{ | 
| 14507 | 14506 | margin-bottom: 20px | ... | ... | 
