Commit 410763c6a9e4cf73c252cacb2762812f967821ee
1 parent
9c155103
price display
Showing
2 changed files
with
21 additions
and
5 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
| @@ -902,7 +902,14 @@ | @@ -902,7 +902,14 @@ | ||
| 902 | '1' => isset($seo['description']) && !empty($seo['description']) ? $seo['description'] : 'Професіонали рекомендують ' . $catalog_name . ' ' . $item['0']['title'] . ' в інтернет магазині насіння Semena.in.ua.', | 902 | '1' => isset($seo['description']) && !empty($seo['description']) ? $seo['description'] : 'Професіонали рекомендують ' . $catalog_name . ' ' . $item['0']['title'] . ' в інтернет магазині насіння Semena.in.ua.', |
| 903 | '2' => isset($seo['description']) && !empty($seo['description']) ? $seo['description'] : 'Профессионалы рекомендуют ' . $catalog_name . ' ' . $item['0']['title'] . ' в интернет магазине семян Semena.in.ua.' | 903 | '2' => isset($seo['description']) && !empty($seo['description']) ? $seo['description'] : 'Профессионалы рекомендуют ' . $catalog_name . ' ' . $item['0']['title'] . ' в интернет магазине семян Semena.in.ua.' |
| 904 | ]; | 904 | ]; |
| 905 | - | 905 | + |
| 906 | + $discount = $this->models->getDiscount()->getActiveData(); | ||
| 907 | + if (!empty($discount)) { | ||
| 908 | + $discount = $discount[0]; | ||
| 909 | + $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
| 910 | + $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
| 911 | + $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
| 912 | + } | ||
| 906 | 913 | ||
| 907 | $this->view->setVars([ | 914 | $this->view->setVars([ |
| 908 | 'change_lang_url' => $lang_url, | 915 | 'change_lang_url' => $lang_url, |
| @@ -923,8 +930,9 @@ | @@ -923,8 +930,9 @@ | ||
| 923 | 'meta_description' => $meta_description[$this->lang_id], | 930 | 'meta_description' => $meta_description[$this->lang_id], |
| 924 | 'breadcrumbs' => $breadcrumbs, | 931 | 'breadcrumbs' => $breadcrumbs, |
| 925 | 'catalog_id' => $catalog_id, | 932 | 'catalog_id' => $catalog_id, |
| 926 | - 'type_alias' => $type_alias, | ||
| 927 | - 'subtype_alias' => $subtype_alias | 933 | + 'type_alias' => $type_alias, |
| 934 | + 'subtype_alias' => $subtype_alias, | ||
| 935 | + 'discount' => $discount | ||
| 928 | ]); | 936 | ]); |
| 929 | } | 937 | } |
| 930 | else | 938 | else |
src/app/frontend/views/page/item.php
| @@ -75,7 +75,7 @@ | @@ -75,7 +75,7 @@ | ||
| 75 | </div> | 75 | </div> |
| 76 | 76 | ||
| 77 | <div class="float item_content"> | 77 | <div class="float item_content"> |
| 78 | - <div class="item_title">123<h1 class="item_name_h1" itemprop="name"><?= $item['title'] ?></h1></div> | 78 | + <div class="item_title"><h1 class="item_name_h1" itemprop="name"><?= $item['title'] ?></h1></div> |
| 79 | <div class="item_decription"><?= $item['description'] ?></div> | 79 | <div class="item_decription"><?= $item['description'] ?></div> |
| 80 | <div style="float:right;width:270px;font-weight:bold;line-height:20px;"> | 80 | <div style="float:right;width:270px;font-weight:bold;line-height:20px;"> |
| 81 | <img src="/images/truck.jpg" width="64" height="64" border="0" align="left" style="margin-right:10px;" /> | 81 | <img src="/images/truck.jpg" width="64" height="64" border="0" align="left" style="margin-right:10px;" /> |
| @@ -202,7 +202,15 @@ | @@ -202,7 +202,15 @@ | ||
| 202 | <div class="one_item_price float" itemprop="offers" itemscope itemtype="http://schema.org/Offer" ><?= $t->_("price")?> | 202 | <div class="one_item_price float" itemprop="offers" itemscope itemtype="http://schema.org/Offer" ><?= $t->_("price")?> |
| 203 | <ul> | 203 | <ul> |
| 204 | <li> | 204 | <li> |
| 205 | - <span itemprop="price"><?= number_format($item['price2'], 2, '.', ' '); ?></span> грн<span style="display:none;" itemprop="priceCurrency">UAH</span> | 205 | + <?php |
| 206 | + if (isset($discount) && $discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item['id'], $discount['group_ids'])) { | ||
| 207 | + echo '<span itemprop="price">'.number_format($item['price2']*(1-$discount['discount']/100), 2, '.', ' ').'</span> грн<span style="display:none;" itemprop="priceCurrency">UAH</span>'; | ||
| 208 | + } | ||
| 209 | + else { | ||
| 210 | + echo '<span itemprop="price">'.number_format($item['price2'], 2, '.', ' ').'</span> грн<span style="display:none;" itemprop="priceCurrency">UAH</span>'; | ||
| 211 | + } | ||
| 212 | + ?> | ||
| 213 | + <!--<span itemprop="price"><?//= number_format($item['price2'], 2, '.', ' '); ?></span> грн<span style="display:none;" itemprop="priceCurrency">UAH</span>--> | ||
| 206 | <div style="display: none" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> | 214 | <div style="display: none" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> |
| 207 | <span itemprop="ratingValue">5</span> | 215 | <span itemprop="ratingValue">5</span> |
| 208 | <span itemprop="reviewCount">31</span> | 216 | <span itemprop="reviewCount">31</span> |