Commit 7313686a417f36bae98b9a59c9a1c63d2038be6a
Merge branch 'discount' of gitlab.artweb.com.ua:Alex/semena
Showing
2 changed files
with
8 additions
and
4 deletions
 
Show diff stats
src/app/backend/controllers/DiscountController.php
| ... | ... | @@ -84,9 +84,9 @@ class DiscountController extends Controller | 
| 84 | 84 | $data['status'] = 1; | 
| 85 | 85 | |
| 86 | 86 | |
| 87 | - $data['catalog_ids'] = $this->request->getPost('catalog', 'string', NULL ); | |
| 87 | + //$data['catalog_ids'] = $this->request->getPost('catalog', 'string', NULL ); | |
| 88 | 88 | $data['group_ids'] = $this->request->getPost('items', 'string', NULL ); | 
| 89 | - $data['all_items'] = $this->request->getPost('all_items', 'int', NULL); | |
| 89 | + //$data['all_items'] = $this->request->getPost('all_items', 'int', NULL); | |
| 90 | 90 | |
| 91 | 91 | if(!empty($data['group_ids']) && $this->models->getDiscount()->addData( $data )) { | 
| 92 | 92 | ... | ... | 
src/lib/models/discount.php
| ... | ... | @@ -142,7 +142,8 @@ class discount extends \db | 
| 142 | 142 | description, | 
| 143 | 143 | start_date, | 
| 144 | 144 | end_date, | 
| 145 | - status | |
| 145 | + status, | |
| 146 | + group_ids | |
| 146 | 147 | ) | 
| 147 | 148 | VALUES | 
| 148 | 149 | ( | 
| ... | ... | @@ -152,6 +153,7 @@ class discount extends \db | 
| 152 | 153 | :start_date, | 
| 153 | 154 | :end_date, | 
| 154 | 155 | :status | 
| 156 | + :group_ids | |
| 155 | 157 | ) | 
| 156 | 158 | RETURNING id | 
| 157 | 159 | ', | 
| ... | ... | @@ -161,7 +163,9 @@ class discount extends \db | 
| 161 | 163 | 'description' => $data['description'], | 
| 162 | 164 | 'start_date' => $data['start_date'], | 
| 163 | 165 | 'end_date' => $data['end_date'], | 
| 164 | - 'status' => $data['status'] | |
| 166 | + 'status' => $data['status'], | |
| 167 | + 'group_ids' => !empty($data['group_ids']) ? '{'. implode(', ', $data['group_ids']) . '}' : null, | |
| 168 | + 'catalog_ids' => !empty($data['catalog_ids']) ? '{'. implode(', ', $data['catalog_ids']) . '}' : null | |
| 165 | 169 | ], | 
| 166 | 170 | -1 | 
| 167 | 171 | ); | ... | ... | 
