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