Commit 4988ce853b89334eb16e7252cacc71339d77c741
1 parent
8ac8b542
rework
Showing
1 changed file
with
17 additions
and
17 deletions
Show diff stats
src/lib/models/basket.php
| ... | ... | @@ -160,22 +160,6 @@ class basket extends \db |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | - * @param array $data | |
| 164 | - * @return string | |
| 165 | - */ | |
| 166 | - public function addData($data) { | |
| 167 | - | |
| 168 | - $query_basket = $this->addUser($data['user_id'], $data['letter']); | |
| 169 | - | |
| 170 | - foreach ($data['items'] as $item) { | |
| 171 | - $this->addItem($data['user_id'], $item['item_id'], $item['count_items']); | |
| 172 | - } | |
| 173 | - | |
| 174 | - return 'User #'.$query_basket[0]['user_id'].' added'; | |
| 175 | - | |
| 176 | - } | |
| 177 | - | |
| 178 | - /** | |
| 179 | 163 | * @param $user_id |
| 180 | 164 | * @return bool |
| 181 | 165 | */ |
| ... | ... | @@ -232,6 +216,22 @@ class basket extends \db |
| 232 | 216 | } |
| 233 | 217 | |
| 234 | 218 | /** |
| 219 | + * @param array $data | |
| 220 | + * @return string | |
| 221 | + */ | |
| 222 | + public function addData($data) { | |
| 223 | + | |
| 224 | + $query_basket = $this->addUser($data['user_id'], $data['letter']); | |
| 225 | + | |
| 226 | + foreach ($data['items'] as $item) { | |
| 227 | + $this->addItem($data['user_id'], $item['item_id'], $item['count_items']); | |
| 228 | + } | |
| 229 | + | |
| 230 | + return 'User #'.$query_basket[0]['user_id'].' added'; | |
| 231 | + | |
| 232 | + } | |
| 233 | + | |
| 234 | + /** | |
| 235 | 235 | * @param $data |
| 236 | 236 | * @return string |
| 237 | 237 | */ |
| ... | ... | @@ -246,7 +246,7 @@ class basket extends \db |
| 246 | 246 | foreach ($data['items'] as $item) { |
| 247 | 247 | |
| 248 | 248 | //add items 1 by 1 |
| 249 | - addItem($data['user_id'], $item['item_id'], $item['count_items']); | |
| 249 | + $this->addItem($data['user_id'], $item['item_id'], $item['count_items']); | |
| 250 | 250 | |
| 251 | 251 | } |
| 252 | 252 | return 'User #'.$query_basket[0]['user_id'].' updated'; | ... | ... |