core/api/modules/cart/ajax.php

20 lines
671 B
PHP
Executable File

<?php
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'];
break;
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'];
break;
default:
}
?>