Commit 57323b666149a3cc8dca3c09e8a2e14c8affdffa

Authored by Alex Savenko
2 parents 2d4af51f 78a40784

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

Showing 1 changed file with 18 additions and 4 deletions   Show diff stats
src/app/backend/controllers/DiscountController.php
... ... @@ -88,17 +88,27 @@ class DiscountController extends Controller
88 88 $data['group_ids'] = $this->request->getPost('items', 'string', NULL );
89 89 //$data['all_items'] = $this->request->getPost('all_items', 'int', NULL);
90 90  
91   - if(!empty($data['group_ids']) && $this->models->getDiscount()->addData( $data )) {
  91 + if ($data['discount'] > 100) {
92 92  
93   - $this->flash->success( 'Сохранение прошло успешно' );
94   - return $this->response->redirect([ 'for' => 'discount_index' ]);
  93 + $this->flash->error( 'Размер скидки не может привышать 100' );
95 94  
96 95 }
97 96 else {
98 97  
99   - $this->flash->error( 'Выберите товары на которые распространяется скидка' );
  98 + if(!empty($data['group_ids']) && $this->models->getDiscount()->addData( $data )) {
  99 +
  100 + $this->flash->success( 'Сохранение прошло успешно' );
  101 + return $this->response->redirect([ 'for' => 'discount_index' ]);
  102 +
  103 + }
  104 + else {
  105 +
  106 + $this->flash->error( 'Выберите товары на которые распространяется скидка' );
  107 +
  108 + }
100 109  
101 110 }
  111 +
102 112 }
103 113  
104 114 $catalog_temp = $this->common->getTypeSubtype1(NULL, $lang_id)['catalog'];
... ... @@ -160,6 +170,10 @@ class DiscountController extends Controller
160 170 $data[0]['end_date'] = $this->request->getPost('end_date');
161 171 $data[0]['description'] = $this->request->getPost('description');
162 172  
  173 + //$data['catalog_ids'] = $this->request->getPost('catalog', 'string', NULL );
  174 + $data['group_ids'] = $this->request->getPost('items', 'string', NULL );
  175 + //$data['all_items'] = $this->request->getPost('all_items', 'int', NULL);
  176 +
163 177 if ($data[0]['discount'] > 100) {
164 178  
165 179 $this->flash->error( 'Размер скидки не может привышать 100' );
... ...