Commit 6de693e8bbafe51d5b77b34cb3fc1b9ea2565504
Merge branch 'discount' of gitlab.artweb.com.ua:Alex/semena
Showing
3 changed files
with
18 additions
and
13 deletions
Show diff stats
src/app/backend/controllers/DiscountController.php
@@ -82,7 +82,12 @@ class DiscountController extends Controller | @@ -82,7 +82,12 @@ class DiscountController extends Controller | ||
82 | $data['end_date'] = $this->request->getPost('end_date'); | 82 | $data['end_date'] = $this->request->getPost('end_date'); |
83 | $data['discount'] = $this->request->getPost('discount', 'string', NULL ); | 83 | $data['discount'] = $this->request->getPost('discount', 'string', NULL ); |
84 | 84 | ||
85 | - if($this->models->getDiscount()->addData( $data )) { | 85 | + |
86 | + $data['catalog_ids'] = $this->request->getPost('catalog', 'string', NULL ); | ||
87 | + $data['group_ids'] = $this->request->getPost('items', 'string', NULL ); | ||
88 | + $data['all_items'] = $this->request->getPost('all_items', 'int', NULL); | ||
89 | + | ||
90 | + if(!empty($data['group_ids']) && $this->models->getDiscount()->addData( $data )) { | ||
86 | 91 | ||
87 | $this->flash->success( 'Сохранение прошло успешно' ); | 92 | $this->flash->success( 'Сохранение прошло успешно' ); |
88 | return $this->response->redirect([ 'for' => 'discount_index' ]); | 93 | return $this->response->redirect([ 'for' => 'discount_index' ]); |
src/app/backend/controllers/PromoCodesController.php
@@ -50,17 +50,17 @@ class PromoCodesController extends Controller | @@ -50,17 +50,17 @@ class PromoCodesController extends Controller | ||
50 | if( $this->request->isPost() ) | 50 | if( $this->request->isPost() ) |
51 | { | 51 | { |
52 | 52 | ||
53 | - $data['name'] = $this->request->getPost('name', 'string', NULL ); | ||
54 | - $data['code'] = $this->request->getPost('code', 'string', NULL ); | ||
55 | - $data['start_date'] = $this->request->getPost('start_date'); | ||
56 | - $data['end_date'] = $this->request->getPost('end_date'); | ||
57 | - $data['single_use'] = $this->request->getPost('single_use'); | ||
58 | - $data['discount'] = $this->request->getPost('discount', 'string', NULL ); | ||
59 | - $data['description'] = $this->request->getPost('description'); | ||
60 | - $data['catalog_ids'] = $this->request->getPost('catalog', 'string', NULL ); | ||
61 | - $data['group_ids'] = $this->request->getPost('items', 'string', NULL ); | ||
62 | - $data['all_items'] = $this->request->getPost('all_items', 'int', NULL); | ||
63 | - $data['image'] = $this->uploadImage(); | 53 | + $data['name'] = $this->request->getPost('name', 'string', NULL ); |
54 | + $data['code'] = $this->request->getPost('code', 'string', NULL ); | ||
55 | + $data['start_date'] = $this->request->getPost('start_date'); | ||
56 | + $data['end_date'] = $this->request->getPost('end_date'); | ||
57 | + $data['single_use'] = $this->request->getPost('single_use'); | ||
58 | + $data['discount'] = $this->request->getPost('discount', 'string', NULL ); | ||
59 | + $data['description'] = $this->request->getPost('description'); | ||
60 | + $data['catalog_ids'] = $this->request->getPost('catalog', 'string', NULL ); | ||
61 | + $data['group_ids'] = $this->request->getPost('items', 'string', NULL ); | ||
62 | + $data['all_items'] = $this->request->getPost('all_items', 'int', NULL); | ||
63 | + $data['image'] = $this->uploadImage(); | ||
64 | 64 | ||
65 | if( empty($this->models->getPromoCodes()->getPromoByCode( $data['code'] )[0]) ) | 65 | if( empty($this->models->getPromoCodes()->getPromoByCode( $data['code'] )[0]) ) |
66 | { | 66 | { |
src/app/frontend/views/partial/item_group.php
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | <div class="align_bottom"> | 33 | <div class="align_bottom"> |
34 | <div class="one_item_price"> | 34 | <div class="one_item_price"> |
35 | <?= $t->_("price_from") ?> | 35 | <?= $t->_("price_from") ?> |
36 | - <?php if (isset($discount) && $discount > 0) { | 36 | + <?php if (isset($discount) && $discount > 0 && $discount <= 100) { |
37 | echo '<span style="text-decoration: line-through;"><span>'.$i['price'].'</span></span> грн<br/>'; | 37 | echo '<span style="text-decoration: line-through;"><span>'.$i['price'].'</span></span> грн<br/>'; |
38 | echo '<span>'.round($i['price']*(1-$discount/100), 1).'</span> грн'; | 38 | echo '<span>'.round($i['price']*(1-$discount/100), 1).'</span> грн'; |
39 | } | 39 | } |