Commit ce64afcb192114ddd4dcc07831e5a482f003f891
1 parent
4b0990fd
Image fixes
Showing
1 changed file
with
216 additions
and
215 deletions
Show diff stats
frontend/views/product/view.php
| ... | ... | @@ -17,8 +17,8 @@ |
| 17 | 17 | * @var Product[] $similar |
| 18 | 18 | */ |
| 19 | 19 | $seo = \Yii::$app->get('seo'); |
| 20 | - if (!empty( $model->category )) { | |
| 21 | - if (!empty( $model->category->parent )) { | |
| 20 | + if (!empty($model->category)) { | |
| 21 | + if (!empty($model->category->parent)) { | |
| 22 | 22 | $this->params[ 'breadcrumbs' ][] = [ |
| 23 | 23 | 'label' => $model->category->parent->lang->title, |
| 24 | 24 | 'url' => [ |
| ... | ... | @@ -36,236 +36,237 @@ |
| 36 | 36 | ]; |
| 37 | 37 | } |
| 38 | 38 | $this->params[ 'breadcrumbs' ][] = $seo->title; |
| 39 | + $images = $model->images; | |
| 39 | 40 | if (!empty($model->image)) { |
| 40 | - array_unshift($model->images, $model->image); | |
| 41 | + array_unshift($images, $model->image); | |
| 41 | 42 | } |
| 42 | 43 | ?> |
| 43 | 44 | <div id="content"> |
| 44 | - <div class="container"> | |
| 45 | - <div class="row"> | |
| 46 | - <div class="col-md-12"> | |
| 47 | - | |
| 48 | - <div class="row" id="productMain"> | |
| 49 | - <div class="col-sm-6"> | |
| 50 | - <div id="mainImage"> | |
| 51 | - <?php | |
| 52 | - if (!empty( $model->images )) { | |
| 53 | - echo ImageHelper::set($model->images[ 0 ]->getPath()) | |
| 54 | - ->fillResize(555, 555) | |
| 55 | - ->renderImage( | |
| 56 | - [ | |
| 57 | - 'class' => 'img-responsive', | |
| 58 | - 'alt' => $model->lang->title, | |
| 59 | - 'title' => $model->lang->title, | |
| 60 | - ] | |
| 61 | - ); | |
| 62 | - } else { | |
| 63 | - echo ImageHelper::set('@frontend/web/img/no-image.png') | |
| 64 | - ->fillResize(555, 555) | |
| 65 | - ->renderImage( | |
| 66 | - [ | |
| 67 | - 'class' => 'img-responsive', | |
| 68 | - 'alt' => $model->lang->title, | |
| 69 | - 'title' => $model->lang->title, | |
| 70 | - ] | |
| 71 | - ); | |
| 72 | - } | |
| 73 | - ?> | |
| 74 | - </div> | |
| 75 | - | |
| 76 | - <?php | |
| 77 | - if ($model->is(2)) { | |
| 78 | - ?> | |
| 79 | - <div class="ribbon sale"> | |
| 80 | - <div class="theribbon">SALE</div> | |
| 81 | - <div class="ribbon-background"></div> | |
| 82 | - </div> | |
| 83 | - <!-- /.ribbon --> | |
| 84 | - <?php | |
| 85 | - } | |
| 86 | - if ($model->is(1)) { | |
| 87 | - ?> | |
| 88 | - <div class="ribbon new"> | |
| 89 | - <div class="theribbon">NEW</div> | |
| 90 | - <div class="ribbon-background"></div> | |
| 91 | - </div> | |
| 92 | - <!-- /.ribbon --> | |
| 93 | - <?php | |
| 94 | - } | |
| 95 | - ?> | |
| 96 | - | |
| 97 | - <div class="row" id="thumbs"> | |
| 98 | - <?php | |
| 99 | - if (!empty( $model->images )) { | |
| 100 | - foreach ($model->images as $image) { | |
| 101 | - echo Html::tag( | |
| 102 | - 'div', | |
| 103 | - Html::a( | |
| 104 | - ImageHelper::set($image->getPath()) | |
| 105 | - ->fillResize(70, 60) | |
| 106 | - ->renderImage( | |
| 107 | - [ | |
| 108 | - 'class' => 'img-responsive', | |
| 109 | - 'alt' => $model->lang->title, | |
| 110 | - 'title' => $model->lang->title, | |
| 111 | - ] | |
| 112 | - ), | |
| 113 | - ImageHelper::set($image->getPath()) | |
| 114 | - ->fillResize(555, 555) | |
| 115 | - ->render(), | |
| 116 | - [ | |
| 117 | - 'class' => 'thumb', | |
| 118 | - ] | |
| 119 | - ), | |
| 45 | + <div class="container"> | |
| 46 | + <div class="row"> | |
| 47 | + <div class="col-md-12"> | |
| 48 | + | |
| 49 | + <div class="row" id="productMain"> | |
| 50 | + <div class="col-sm-6"> | |
| 51 | + <div id="mainImage"> | |
| 52 | + <?php | |
| 53 | + if (!empty($images)) { | |
| 54 | + echo ImageHelper::set($images[ 0 ]->getPath()) | |
| 55 | + ->fillResize(555, 555) | |
| 56 | + ->renderImage( | |
| 120 | 57 | [ |
| 121 | - 'class' => 'col-xs-2', | |
| 58 | + 'class' => 'img-responsive', | |
| 59 | + 'alt' => $model->lang->title, | |
| 60 | + 'title' => $model->lang->title, | |
| 122 | 61 | ] |
| 123 | 62 | ); |
| 124 | - } | |
| 125 | - } else { | |
| 126 | - echo Html::tag( | |
| 127 | - 'div', | |
| 128 | - Html::a( | |
| 129 | - ImageHelper::set('@frontend/web/img/no-image.png') | |
| 130 | - ->fillResize(70, 60) | |
| 131 | - ->renderImage( | |
| 132 | - [ | |
| 133 | - 'class' => 'img-responsive', | |
| 134 | - 'alt' => $model->lang->title, | |
| 135 | - 'title' => $model->lang->title, | |
| 136 | - ] | |
| 137 | - ), | |
| 138 | - ImageHelper::set('@frontend/web/img/no-image.png') | |
| 139 | - ->fillResize(555, 555) | |
| 140 | - ->render(), | |
| 63 | + } else { | |
| 64 | + echo ImageHelper::set('@frontend/web/img/no-image.png') | |
| 65 | + ->fillResize(555, 555) | |
| 66 | + ->renderImage( | |
| 141 | 67 | [ |
| 142 | - 'class' => 'thumb', | |
| 68 | + 'class' => 'img-responsive', | |
| 69 | + 'alt' => $model->lang->title, | |
| 70 | + 'title' => $model->lang->title, | |
| 143 | 71 | ] |
| 144 | - ), | |
| 145 | - [ | |
| 146 | - 'class' => 'col-xs-2', | |
| 147 | - ] | |
| 148 | - ); | |
| 149 | - } | |
| 150 | - ?> | |
| 151 | - </div> | |
| 152 | - <?php | |
| 153 | - if (!empty( $model->video )) { | |
| 154 | - ?> | |
| 155 | - <div class="product-video"> | |
| 156 | - <div class="h3"> | |
| 157 | - <?php echo \Yii::t('app', 'ะะธะดะตะพะพะฑะทะพั ะฟัะพะดัะบัะฐ'); ?> | |
| 158 | - </div> | |
| 159 | - <div class="video-box"> | |
| 160 | - <?php echo $model->video; ?> | |
| 161 | - </div> | |
| 162 | - </div> | |
| 163 | - <?php | |
| 164 | - } | |
| 165 | - ?> | |
| 72 | + ); | |
| 73 | + } | |
| 74 | + ?> | |
| 75 | + </div> | |
| 76 | + | |
| 77 | + <?php | |
| 78 | + if ($model->is(2)) { | |
| 79 | + ?> | |
| 80 | + <div class="ribbon sale"> | |
| 81 | + <div class="theribbon">SALE</div> | |
| 82 | + <div class="ribbon-background"></div> | |
| 166 | 83 | </div> |
| 167 | - <div class="col-sm-6"> | |
| 168 | - <div class="box"> | |
| 169 | - <h1><?php echo $model->lang->title; ?></h1> | |
| 170 | - <p class="no-margin"><?php echo $variant->sku; ?></p> | |
| 171 | - <p class="price"> | |
| 172 | - <span class="price-title">ะฆะตะฝะฐ:</span><?php echo $variant->price ? : 0; ?> ะณัะฝ  | |
| 173 | - <button class="btn btn-success"> | |
| 174 | - <i class="fa fa-shopping-cart"></i> ะะพะฑะฐะฒะธัั ะฒ ะบะพัะทะธะฝั | |
| 175 | - </button> | |
| 176 | - <button class="btn btn-default pull-right" data-toggle="tooltip" data-placement="top" title="ะะพะฑะฐะฒะธัั ะฒ ะธะทะฑัะฐะฝะฝะพะต"> | |
| 177 | - <i class="fa fa-heart-o"></i> | |
| 178 | - </button> | |
| 179 | - </p> | |
| 180 | - <hr> | |
| 181 | - | |
| 182 | - <button class="btn btn-template-main"> | |
| 183 | - <i class="fa fa-phone"></i> ะัะฟะธัั ะฒ ะพะดะธะฝ ะบะปะธะบ | |
| 184 | - </button> | |
| 185 | -  <button class="btn btn-template-main"> | |
| 186 | - <i class="fa fa-tags"></i> ะัะฟะธัั ะฒ ะบัะตะดะธั | |
| 187 | - </button> | |
| 188 | - </div> | |
| 189 | - <div class="box" id="details"> | |
| 190 | - <h2><?php echo \Yii::t('app', 'ะะฟะธัะฐะฝะธะต ัะพะฒะฐัะฐ'); ?></h2> | |
| 191 | - <?php echo $model->lang->description ? : \Yii::t('app', 'ะะตั ะพะฟะธัะฐะฝะธั'); ?> | |
| 192 | - </div> | |
| 193 | - | |
| 194 | - <div class="box" id="details"> | |
| 195 | - <h2><?php echo \Yii::t('app', 'ะฅะฐัะฐะบัะตัะธััะธะบะธ'); ?></h2> | |
| 196 | - <table class="table"> | |
| 197 | - <tbody> | |
| 198 | - <?php | |
| 199 | - foreach ($groups as $group) { | |
| 200 | - foreach ($group as $optionGroup) { | |
| 201 | - /** | |
| 202 | - * @var OptionGroup $optionGroup | |
| 203 | - */ | |
| 204 | - echo Html::tag( | |
| 205 | - 'tr', | |
| 206 | - Html::tag( | |
| 207 | - 'td', | |
| 208 | - $optionGroup->lang->title, | |
| 209 | - [ 'class' => 'td-title' ] | |
| 210 | - ) . Html::tag( | |
| 211 | - 'td', | |
| 212 | - implode( | |
| 213 | - ', ', | |
| 214 | - ArrayHelper::getColumn( | |
| 215 | - $optionGroup->currentOptions, | |
| 216 | - 'lang.value' | |
| 217 | - ) | |
| 218 | - ) | |
| 219 | - ) | |
| 220 | - ); | |
| 221 | - } | |
| 222 | - } | |
| 223 | - ?> | |
| 224 | - </tbody> | |
| 225 | - </table> | |
| 226 | - </div> | |
| 84 | + <!-- /.ribbon --> | |
| 85 | + <?php | |
| 86 | + } | |
| 87 | + if ($model->is(1)) { | |
| 88 | + ?> | |
| 89 | + <div class="ribbon new"> | |
| 90 | + <div class="theribbon">NEW</div> | |
| 91 | + <div class="ribbon-background"></div> | |
| 227 | 92 | </div> |
| 228 | - | |
| 93 | + <!-- /.ribbon --> | |
| 94 | + <?php | |
| 95 | + } | |
| 96 | + ?> | |
| 97 | + | |
| 98 | + <div class="row" id="thumbs"> | |
| 99 | + <?php | |
| 100 | + if (!empty($images)) { | |
| 101 | + foreach ($images as $image) { | |
| 102 | + echo Html::tag( | |
| 103 | + 'div', | |
| 104 | + Html::a( | |
| 105 | + ImageHelper::set($image->getPath()) | |
| 106 | + ->fillResize(70, 60) | |
| 107 | + ->renderImage( | |
| 108 | + [ | |
| 109 | + 'class' => 'img-responsive', | |
| 110 | + 'alt' => $model->lang->title, | |
| 111 | + 'title' => $model->lang->title, | |
| 112 | + ] | |
| 113 | + ), | |
| 114 | + ImageHelper::set($image->getPath()) | |
| 115 | + ->fillResize(555, 555) | |
| 116 | + ->render(), | |
| 117 | + [ | |
| 118 | + 'class' => 'thumb', | |
| 119 | + ] | |
| 120 | + ), | |
| 121 | + [ | |
| 122 | + 'class' => 'col-xs-2', | |
| 123 | + ] | |
| 124 | + ); | |
| 125 | + } | |
| 126 | + } else { | |
| 127 | + echo Html::tag( | |
| 128 | + 'div', | |
| 129 | + Html::a( | |
| 130 | + ImageHelper::set('@frontend/web/img/no-image.png') | |
| 131 | + ->fillResize(70, 60) | |
| 132 | + ->renderImage( | |
| 133 | + [ | |
| 134 | + 'class' => 'img-responsive', | |
| 135 | + 'alt' => $model->lang->title, | |
| 136 | + 'title' => $model->lang->title, | |
| 137 | + ] | |
| 138 | + ), | |
| 139 | + ImageHelper::set('@frontend/web/img/no-image.png') | |
| 140 | + ->fillResize(555, 555) | |
| 141 | + ->render(), | |
| 142 | + [ | |
| 143 | + 'class' => 'thumb', | |
| 144 | + ] | |
| 145 | + ), | |
| 146 | + [ | |
| 147 | + 'class' => 'col-xs-2', | |
| 148 | + ] | |
| 149 | + ); | |
| 150 | + } | |
| 151 | + ?> | |
| 152 | + </div> | |
| 153 | + <?php | |
| 154 | + if (!empty($model->video)) { | |
| 155 | + ?> | |
| 156 | + <div class="product-video"> | |
| 157 | + <div class="h3"> | |
| 158 | + <?php echo \Yii::t('app', 'ะะธะดะตะพะพะฑะทะพั ะฟัะพะดัะบัะฐ'); ?> | |
| 159 | + </div> | |
| 160 | + <div class="video-box"> | |
| 161 | + <?php echo $model->video; ?> | |
| 162 | + </div> | |
| 163 | + </div> | |
| 164 | + <?php | |
| 165 | + } | |
| 166 | + ?> | |
| 167 | + </div> | |
| 168 | + <div class="col-sm-6"> | |
| 169 | + <div class="box"> | |
| 170 | + <h1><?php echo $model->lang->title; ?></h1> | |
| 171 | + <p class="no-margin"><?php echo $variant->sku; ?></p> | |
| 172 | + <p class="price"> | |
| 173 | + <span class="price-title">ะฆะตะฝะฐ:</span><?php echo $variant->price ? : 0; ?> ะณัะฝ  | |
| 174 | + <button class="btn btn-success"> | |
| 175 | + <i class="fa fa-shopping-cart"></i> ะะพะฑะฐะฒะธัั ะฒ ะบะพัะทะธะฝั | |
| 176 | + </button> | |
| 177 | + <button class="btn btn-default pull-right" data-toggle="tooltip" data-placement="top" title="ะะพะฑะฐะฒะธัั ะฒ ะธะทะฑัะฐะฝะฝะพะต"> | |
| 178 | + <i class="fa fa-heart-o"></i> | |
| 179 | + </button> | |
| 180 | + </p> | |
| 181 | + <hr> | |
| 182 | + | |
| 183 | + <button class="btn btn-template-main"> | |
| 184 | + <i class="fa fa-phone"></i> ะัะฟะธัั ะฒ ะพะดะธะฝ ะบะปะธะบ | |
| 185 | + </button> | |
| 186 | +  <button class="btn btn-template-main"> | |
| 187 | + <i class="fa fa-tags"></i> ะัะฟะธัั ะฒ ะบัะตะดะธั | |
| 188 | + </button> | |
| 189 | + </div> | |
| 190 | + <div class="box" id="details"> | |
| 191 | + <h2><?php echo \Yii::t('app', 'ะะฟะธัะฐะฝะธะต ัะพะฒะฐัะฐ'); ?></h2> | |
| 192 | + <?php echo $model->lang->description ? : \Yii::t('app', 'ะะตั ะพะฟะธัะฐะฝะธั'); ?> | |
| 193 | + </div> | |
| 194 | + | |
| 195 | + <div class="box" id="details"> | |
| 196 | + <h2><?php echo \Yii::t('app', 'ะฅะฐัะฐะบัะตัะธััะธะบะธ'); ?></h2> | |
| 197 | + <table class="table"> | |
| 198 | + <tbody> | |
| 199 | + <?php | |
| 200 | + foreach ($groups as $group) { | |
| 201 | + foreach ($group as $optionGroup) { | |
| 202 | + /** | |
| 203 | + * @var OptionGroup $optionGroup | |
| 204 | + */ | |
| 205 | + echo Html::tag( | |
| 206 | + 'tr', | |
| 207 | + Html::tag( | |
| 208 | + 'td', | |
| 209 | + $optionGroup->lang->title, | |
| 210 | + [ 'class' => 'td-title' ] | |
| 211 | + ) . Html::tag( | |
| 212 | + 'td', | |
| 213 | + implode( | |
| 214 | + ', ', | |
| 215 | + ArrayHelper::getColumn( | |
| 216 | + $optionGroup->currentOptions, | |
| 217 | + 'lang.value' | |
| 218 | + ) | |
| 219 | + ) | |
| 220 | + ) | |
| 221 | + ); | |
| 222 | + } | |
| 223 | + } | |
| 224 | + ?> | |
| 225 | + </tbody> | |
| 226 | + </table> | |
| 227 | + </div> | |
| 228 | + </div> | |
| 229 | + | |
| 230 | + </div> | |
| 231 | + | |
| 232 | + <?php | |
| 233 | + if (!empty($similar)) { | |
| 234 | + ?> | |
| 235 | + <div class="heading text-center"> | |
| 236 | + <h2><?php echo \Yii::t('app', 'ะะพั ะพะถะธะต ัะพะฒะฐัั'); ?></h2> | |
| 229 | 237 | </div> |
| 230 | 238 | |
| 231 | - <?php | |
| 232 | - if (!empty( $similar )) { | |
| 233 | - ?> | |
| 234 | - <div class="heading text-center"> | |
| 235 | - <h2><?php echo \Yii::t('app', 'ะะพั ะพะถะธะต ัะพะฒะฐัั'); ?></h2> | |
| 236 | - </div> | |
| 237 | - | |
| 238 | - <div class="product-carousel"> | |
| 239 | - <div class="homepage owl-carousel"> | |
| 239 | + <div class="product-carousel"> | |
| 240 | + <div class="homepage owl-carousel"> | |
| 241 | + <?php | |
| 242 | + $newItemsArrays = array_chunk($similar, 4); | |
| 243 | + foreach ($newItemsArrays as $newItemsArray) { | |
| 244 | + ?> | |
| 245 | + <div class="products"> | |
| 240 | 246 | <?php |
| 241 | - $newItemsArrays = array_chunk($similar, 4); | |
| 242 | - foreach ($newItemsArrays as $newItemsArray) { | |
| 243 | - ?> | |
| 244 | - <div class="products"> | |
| 245 | - <?php | |
| 246 | - foreach ($newItemsArray as $product) { | |
| 247 | - echo $this->render( | |
| 248 | - '@frontend/views/site/_slider_product', | |
| 249 | - [ | |
| 250 | - 'product' => $product, | |
| 251 | - ] | |
| 252 | - ); | |
| 253 | - } | |
| 254 | - ?> | |
| 255 | - </div> | |
| 256 | - <?php | |
| 247 | + foreach ($newItemsArray as $product) { | |
| 248 | + echo $this->render( | |
| 249 | + '@frontend/views/site/_slider_product', | |
| 250 | + [ | |
| 251 | + 'product' => $product, | |
| 252 | + ] | |
| 253 | + ); | |
| 257 | 254 | } |
| 258 | 255 | ?> |
| 259 | 256 | </div> |
| 260 | - </div> | |
| 261 | - <?php | |
| 262 | - } | |
| 263 | - ?> | |
| 264 | - </div> | |
| 265 | - <!-- /.col-md-9 --> | |
| 266 | - </div> | |
| 267 | - <!-- /.row --> | |
| 257 | + <?php | |
| 258 | + } | |
| 259 | + ?> | |
| 260 | + </div> | |
| 261 | + </div> | |
| 262 | + <?php | |
| 263 | + } | |
| 264 | + ?> | |
| 265 | + </div> | |
| 266 | + <!-- /.col-md-9 --> | |
| 268 | 267 | </div> |
| 269 | - <!-- /.container --> | |
| 268 | + <!-- /.row --> | |
| 269 | + </div> | |
| 270 | + <!-- /.container --> | |
| 270 | 271 | </div> |
| 271 | 272 | <!-- /#content --> | ... | ... |