core/api/modules/cart/ajax.php

20 lines
671 B
PHP
Raw Normal View History

2022-12-11 13:55:49 +05:00
<?php
2022-12-24 21:12:23 +05:00
switch( @$_POST['act'] ) {
case 'change-kolvo':
$session_id = ( $_SESSION['user_id'] ) ? $_SESSION['user_id'] : session_id();
\DB::set( "UPDATE `cart` SET `kolvo`=? WHERE `id`=? AND `user_id`=?", array( $_POST['kolvo'], $_POST['id'], $session_id ) ) ;
$res=\core::getCart();
echo $res['summ'];
2022-12-11 13:55:49 +05:00
break;
2022-12-24 21:12:23 +05:00
case 'del-from-cart':
$session_id = ( $_SESSION['user_id'] ) ? $_SESSION['user_id'] : session_id();
\DB::set( "DELETE FROM `cart` WHERE `id`=? AND `user_id`=?", array( $_POST['id'], $session_id ) ) ;
$res=\core::getCart();
echo $res['summ'];
2022-12-11 13:55:49 +05:00
break;
2022-12-24 21:12:23 +05:00
2022-12-11 13:55:49 +05:00
default:
}
?>