Commit a00287ac99a8ea9b4ccabcf1cee02f0de28a61e7

Authored by Alex Savenko
2 parents 2f257af3 410763c6

Merge branch 'discount' of gitlab.artweb.com.ua:Alex/semena

src/app/frontend/controllers/PageController.php
@@ -903,7 +903,14 @@ @@ -903,7 +903,14 @@
903 '1' => isset($seo['description']) && !empty($seo['description']) ? $seo['description'] : 'Професіонали рекомендують ' . $catalog_name . ' ' . $item['0']['title'] . ' в інтернет магазині насіння Semena.in.ua.', 903 '1' => isset($seo['description']) && !empty($seo['description']) ? $seo['description'] : 'Професіонали рекомендують ' . $catalog_name . ' ' . $item['0']['title'] . ' в інтернет магазині насіння Semena.in.ua.',
904 '2' => isset($seo['description']) && !empty($seo['description']) ? $seo['description'] : 'Профессионалы рекомендуют ' . $catalog_name . ' ' . $item['0']['title'] . ' в интернет магазине семян Semena.in.ua.' 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 $this->view->setVars([ 915 $this->view->setVars([
909 'change_lang_url' => $lang_url, 916 'change_lang_url' => $lang_url,
@@ -924,8 +931,9 @@ @@ -924,8 +931,9 @@
924 'meta_description' => $meta_description[$this->lang_id], 931 'meta_description' => $meta_description[$this->lang_id],
925 'breadcrumbs' => $breadcrumbs, 932 'breadcrumbs' => $breadcrumbs,
926 'catalog_id' => $catalog_id, 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 else 939 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>