Commit 176ac41d1deabc30ee01720ecbc8a2d80dc9e92d
1 parent
81796c8b
-Blog article form fixed
-Table of sizes added -Catalog java script fixed
Showing
2 changed files
with
45 additions
and
1 deletions
Show diff stats
models/Product.php
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | namespace artweb\artbox\ecommerce\models; |
| 4 | 4 | |
| 5 | + use artweb\artbox\behaviors\SaveImgBehavior; | |
| 5 | 6 | use artweb\artbox\comment\models\CommentModel; |
| 6 | 7 | use artweb\artbox\comment\models\interfaces\RatingCacheInterface; |
| 7 | 8 | use artweb\artbox\ecommerce\behaviors\DefaultVariantBehavior; |
| ... | ... | @@ -22,6 +23,7 @@ |
| 22 | 23 | * @property integer $brand_id |
| 23 | 24 | * @property integer $id |
| 24 | 25 | * @property ProductVideo[] $videos |
| 26 | + * @property string $size_image | |
| 25 | 27 | * @property Category $category |
| 26 | 28 | * @property Category[] $categories |
| 27 | 29 | * @property ProductVariant $variant |
| ... | ... | @@ -122,7 +124,7 @@ |
| 122 | 124 | 'product_id' => 'id', |
| 123 | 125 | ], |
| 124 | 126 | 'conditions' => [ |
| 125 | - 'product_image.product_variant_id' => null, | |
| 127 | + 'product_image.product_variant_id' => NULL, | |
| 126 | 128 | ], |
| 127 | 129 | 'model' => ProductImage::className(), |
| 128 | 130 | 'config' => [ |
| ... | ... | @@ -140,6 +142,15 @@ |
| 140 | 142 | 'cacheRating' => true, |
| 141 | 143 | 'cacheModelName' => ProductToRating::className(), |
| 142 | 144 | ], |
| 145 | + 'size_image' => [ | |
| 146 | + 'class' => SaveImgBehavior::className(), | |
| 147 | + 'fields' => [ | |
| 148 | + [ | |
| 149 | + 'name' => 'size_image', | |
| 150 | + 'directory' => 'products', | |
| 151 | + ], | |
| 152 | + ], | |
| 153 | + ], | |
| 143 | 154 | ]; |
| 144 | 155 | } |
| 145 | 156 | |
| ... | ... | @@ -184,6 +195,10 @@ |
| 184 | 195 | ], |
| 185 | 196 | 'boolean', |
| 186 | 197 | ], |
| 198 | + [ | |
| 199 | + [ 'size_image' ], | |
| 200 | + 'string', | |
| 201 | + ], | |
| 187 | 202 | ]; |
| 188 | 203 | } |
| 189 | 204 | |
| ... | ... | @@ -204,6 +219,7 @@ |
| 204 | 219 | 'is_top' => Yii::t('product', 'Is top'), |
| 205 | 220 | 'is_new' => Yii::t('product', 'Is new'), |
| 206 | 221 | 'is_discount' => Yii::t('product', 'Is promo'), |
| 222 | + 'size_image' => Yii::t('product', 'Sizes table'), | |
| 207 | 223 | ]; |
| 208 | 224 | } |
| 209 | 225 | ... | ... |
views/manage/_form.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | + use artweb\artbox\components\artboximage\ArtboxImageHelper; | |
| 3 | 4 | use artweb\artbox\ecommerce\models\ProductVideo; |
| 4 | 5 | use artweb\artbox\language\widgets\LanguageForm; |
| 5 | 6 | use artweb\artbox\ecommerce\models\Brand; |
| ... | ... | @@ -181,6 +182,33 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) { |
| 181 | 182 | ] |
| 182 | 183 | ); ?> |
| 183 | 184 | |
| 185 | + <?= $form->field($model, 'size_image') | |
| 186 | + ->widget( | |
| 187 | + \kartik\file\FileInput::className(), | |
| 188 | + [ | |
| 189 | + 'language' => 'ru', | |
| 190 | + 'options' => [ | |
| 191 | + 'accept' => 'image/*', | |
| 192 | + 'multiple' => false, | |
| 193 | + ], | |
| 194 | + 'pluginOptions' => [ | |
| 195 | + 'allowedFileExtensions' => [ | |
| 196 | + 'jpg', | |
| 197 | + 'gif', | |
| 198 | + 'png', | |
| 199 | + ], | |
| 200 | + 'initialPreview' => !empty( $model->getBehavior('size_image')->imageUrl ) ? ArtboxImageHelper::getImage( | |
| 201 | + $model->getBehavior('size_image')->imageUrl, | |
| 202 | + 'list' | |
| 203 | + ) : '', | |
| 204 | + 'overwriteInitial' => true, | |
| 205 | + 'showRemove' => false, | |
| 206 | + 'showUpload' => false, | |
| 207 | + 'previewFileType' => 'image', | |
| 208 | + ], | |
| 209 | + ] | |
| 210 | + ); ?> | |
| 211 | + | |
| 184 | 212 | <?php if (!empty( $groups )) { |
| 185 | 213 | foreach ($groups->with('lang') |
| 186 | 214 | ->all() as $group) { | ... | ... |