Commit a487dfddd82c5bed35834c289baa9a2cc45fc214
1 parent
b504d880
update record using XHR 'delete_item'
Showing
1 changed file
with
11 additions
and
0 deletions
Show diff stats
src/app/frontend/controllers/MenuController.php
@@ -533,6 +533,17 @@ class MenuController extends \controllers\ControllerBase | @@ -533,6 +533,17 @@ class MenuController extends \controllers\ControllerBase | ||
533 | $this->session->set( 'in_cart', $in_cart ); | 533 | $this->session->set( 'in_cart', $in_cart ); |
534 | 534 | ||
535 | $count = count($in_cart); | 535 | $count = count($in_cart); |
536 | + | ||
537 | + //save basket in DB | ||
538 | + $user_id = $this->session->get('id'); | ||
539 | + if ($this->session->get('isAuth')) { | ||
540 | + $data = [ | ||
541 | + 'user_id' => $user_id, | ||
542 | + 'letter' => '0', | ||
543 | + 'items' => $in_cart | ||
544 | + ]; | ||
545 | + $this->models->getBasket()->updateBasket($user_id, $data); | ||
546 | + } | ||
536 | } | 547 | } |
537 | 548 | ||
538 | die( json_encode( $count ) ); | 549 | die( json_encode( $count ) ); |