Commit 2e96ba936d07ce33eab0322e531d2fcc59094f7c
1 parent
10b789ee
big commti
Showing
2 changed files
with
75 additions
and
42 deletions
Show diff stats
frontend/views/catalog/product.php
| @@ -144,6 +144,46 @@ FlipclockAsset::register($this); | @@ -144,6 +144,46 @@ FlipclockAsset::register($this); | ||
| 144 | </colgroup> | 144 | </colgroup> |
| 145 | <tbody> | 145 | <tbody> |
| 146 | <tr> | 146 | <tr> |
| 147 | + <?php foreach($product->events as $event):?> | ||
| 148 | + <?php if(!empty($event->end_at) && $event->isActive()):?> | ||
| 149 | + <div class="event_block"> | ||
| 150 | + | ||
| 151 | + <div class="event_title"> <?= Html::a('Акция!!! '.$event->name,Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?></div> | ||
| 152 | + <div class="event_time">До конца осталось:</div> | ||
| 153 | + <div class="clock_<?= $event->primaryKey ?> clock_product_first "></div> | ||
| 154 | + <script type="text/javascript"> | ||
| 155 | + var clock; | ||
| 156 | + | ||
| 157 | + $(document).ready(function() { | ||
| 158 | + var clock; | ||
| 159 | + | ||
| 160 | + clock = $('.clock_<?= $event->primaryKey ?>').FlipClock({ | ||
| 161 | + clockFace: 'DailyCounter', | ||
| 162 | + language: 'ru', | ||
| 163 | + classes: { | ||
| 164 | + active: 'flip-clock-active', | ||
| 165 | + before: 'flip-clock-before', | ||
| 166 | + divider: 'flip-clock-divider', | ||
| 167 | + dot: 'flip-clock-dot', | ||
| 168 | + label: 'flip-clock-label', | ||
| 169 | + flip: 'flip', | ||
| 170 | + play: 'play', | ||
| 171 | + wrapper: 'flip-clock-wrapper' | ||
| 172 | + }, | ||
| 173 | + }); | ||
| 174 | + | ||
| 175 | + clock.setTime(<?= strtotime($event->end_at) - strtotime(date("Y-m-d H:i:s"))?>); | ||
| 176 | + clock.setCountdown(true); | ||
| 177 | + clock.start(); | ||
| 178 | + | ||
| 179 | + }); | ||
| 180 | + </script> | ||
| 181 | + | ||
| 182 | + </div> | ||
| 183 | + <?php endif; ?> | ||
| 184 | + <?php endforeach; ?> | ||
| 185 | + </tr> | ||
| 186 | + <tr> | ||
| 147 | <td class="left_count available"> | 187 | <td class="left_count available"> |
| 148 | под заказ | 188 | под заказ |
| 149 | </td> | 189 | </td> |
| @@ -211,47 +251,6 @@ FlipclockAsset::register($this); | @@ -211,47 +251,6 @@ FlipclockAsset::register($this); | ||
| 211 | </td> | 251 | </td> |
| 212 | </tr> | 252 | </tr> |
| 213 | <tr> | 253 | <tr> |
| 214 | - <?php foreach($product->events as $event):?> | ||
| 215 | - <?php if(!empty($event->end_at) && $event->isActive()):?> | ||
| 216 | - <div class="event_block"> | ||
| 217 | - | ||
| 218 | - <div class="event_title"> <?= Html::a('Акция!!! '.$event->name,Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?></div> | ||
| 219 | - <div class="event_time">До конца осталось:</div> | ||
| 220 | - <div class="clock_<?= $event->primaryKey ?> clock_product_first "></div> | ||
| 221 | - <script type="text/javascript"> | ||
| 222 | - var clock; | ||
| 223 | - | ||
| 224 | - $(document).ready(function() { | ||
| 225 | - var clock; | ||
| 226 | - | ||
| 227 | - clock = $('.clock_<?= $event->primaryKey ?>').FlipClock({ | ||
| 228 | - clockFace: 'DailyCounter', | ||
| 229 | - language: 'ru', | ||
| 230 | - classes: { | ||
| 231 | - active: 'flip-clock-active', | ||
| 232 | - before: 'flip-clock-before', | ||
| 233 | - divider: 'flip-clock-divider', | ||
| 234 | - dot: 'flip-clock-dot', | ||
| 235 | - label: 'flip-clock-label', | ||
| 236 | - flip: 'flip', | ||
| 237 | - play: 'play', | ||
| 238 | - wrapper: 'flip-clock-wrapper' | ||
| 239 | - }, | ||
| 240 | - }); | ||
| 241 | - | ||
| 242 | - clock.setTime(<?= strtotime($event->end_at) - strtotime(date("Y-m-d H:i:s"))?>); | ||
| 243 | - clock.setCountdown(true); | ||
| 244 | - clock.start(); | ||
| 245 | - | ||
| 246 | - }); | ||
| 247 | - </script> | ||
| 248 | - | ||
| 249 | - </div> | ||
| 250 | - <?php endif; ?> | ||
| 251 | - <?php endforeach; ?> | ||
| 252 | - | ||
| 253 | - </tr> | ||
| 254 | - <tr> | ||
| 255 | <td class="price_block"> | 254 | <td class="price_block"> |
| 256 | <div class="price_block_container"> | 255 | <div class="price_block_container"> |
| 257 | 256 |
frontend/widgets/views/slider.php
| @@ -5,13 +5,47 @@ use common\models\Slider; | @@ -5,13 +5,47 @@ use common\models\Slider; | ||
| 5 | use yii\helpers\Html; | 5 | use yii\helpers\Html; |
| 6 | use yii\helpers\Url; | 6 | use yii\helpers\Url; |
| 7 | use yii\web\View; | 7 | use yii\web\View; |
| 8 | - | 8 | +use frontend\assets\FlipclockAsset; |
| 9 | ?> | 9 | ?> |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | <div id="<?=$title?>" class="owl-carousel owl-theme"> | 12 | <div id="<?=$title?>" class="owl-carousel owl-theme"> |
| 13 | <?php foreach($slider->sliderImage as $image): | 13 | <?php foreach($slider->sliderImage as $image): |
| 14 | 14 | ||
| 15 | + if(!empty($image->end_at) && strtotime($row->end_at) > strtotime(date("Y-m-d"))){ | ||
| 16 | + ?> | ||
| 17 | + <div class="clock_style clock_<?= $row->primaryKey ?>"></div> | ||
| 18 | + <script type="text/javascript"> | ||
| 19 | + var clock; | ||
| 20 | + | ||
| 21 | + $(document).ready(function() { | ||
| 22 | + var clock; | ||
| 23 | + | ||
| 24 | + clock = $('.clock_<?= $row->primaryKey ?>').FlipClock({ | ||
| 25 | + clockFace: 'DailyCounter', | ||
| 26 | + language: 'ru', | ||
| 27 | + classes: { | ||
| 28 | + active: 'flip-clock-active', | ||
| 29 | + before: 'flip-clock-before', | ||
| 30 | + divider: 'flip-clock-divider', | ||
| 31 | + dot: 'flip-clock-dot', | ||
| 32 | + label: 'flip-clock-label', | ||
| 33 | + flip: 'flip', | ||
| 34 | + play: 'play', | ||
| 35 | + wrapper: 'flip-clock-wrapper' | ||
| 36 | + }, | ||
| 37 | + }); | ||
| 38 | + | ||
| 39 | + clock.setTime(<?= strtotime($row->end_at) - strtotime(date("Y-m-d H:i:s"))?>); | ||
| 40 | + clock.setCountdown(true); | ||
| 41 | + clock.start(); | ||
| 42 | + | ||
| 43 | + }); | ||
| 44 | + </script> | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + <?php | ||
| 48 | + } | ||
| 15 | 49 | ||
| 16 | ?> | 50 | ?> |
| 17 | <div class="item"> | 51 | <div class="item"> |