Commit 26d1e4f607ee7b7cc521c391c5be507254c693d9
1 parent
5d41bb08
add/edit
Showing
1 changed file
with
23 additions
and
1 deletions
Show diff stats
src/app/backend/controllers/DiscountController.php
| ... | ... | @@ -167,10 +167,32 @@ class DiscountController extends Controller |
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | + $data[0]['group_ids'] = $this->common->parseArray($data[0]['group_ids']); | |
| 171 | + $data[0]['catalog_ids'] = $this->common->parseArray($data[0]['catalog_ids']); | |
| 172 | + | |
| 173 | + $catalog_temp = $this->common->getTypeSubtype1(NULL, $lang_id)['catalog']; | |
| 174 | + usort($catalog_temp, $titlecmp); | |
| 175 | + | |
| 176 | + foreach($catalog_temp as &$group) { | |
| 177 | + usort($group['sub'], $titlecmp); | |
| 178 | + } | |
| 179 | + | |
| 180 | + if(!empty($data[0]['group_ids'][0])) { | |
| 181 | + $groups = $this->models->getItems()->getItemsByIds($lang_id, $data[0]['group_ids']); | |
| 182 | + usort($groups, $titlecmp); | |
| 183 | + } | |
| 184 | + | |
| 185 | + foreach($data as $k => $i) { | |
| 186 | + if(isset($i['image']) && !empty($i['image'])) | |
| 187 | + $data[$k]['image'] = $this->storage->getPhotoURL($i['image'], 'promo_codes', 'original'); | |
| 188 | + } | |
| 189 | + | |
| 170 | 190 | $this->view->pick( 'discount/addEdit' ); |
| 171 | 191 | |
| 172 | 192 | $this->view->setVars([ |
| 173 | - 'page' => $data | |
| 193 | + 'page' => $data, | |
| 194 | + 'catalog_temp' => $catalog_temp, | |
| 195 | + 'groups' => !empty($groups) ? $groups : null | |
| 174 | 196 | ]); |
| 175 | 197 | |
| 176 | 198 | } | ... | ... |