����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 18.222.188.218 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/t/sae/appsae/core/app/view/ |
Upload File : |
<?php if(isset($_POST["q"]) && !is_numeric($_POST["q"])){ Core::alert("Valor invalido!"); Core::redir("./?view=sell"); } if(!isset($_SESSION["cart"])){ $product = array("product_id"=>$_POST["product_id"],"q"=>$_POST["q"]); $_SESSION["cart"] = array($product); if($_POST["list_id"]!=""){ $precio_Selec=$_POST["list_id"]; } $cart = $_SESSION["cart"]; /////////////////////////////////////////////////////////////////// $num_succ = 0; $process=false; $errors = array(); foreach($cart as $c){ /// $q = OperationData::getQByStock($c["product_id"],StockData::getPrincipal()->id); // echo ">>".$q; if($c["q"]<=$q){ $num_succ++; }else{ $error = array("product_id"=>$c["product_id"],"message"=>"No hay suficiente cantidad de producto en inventario."); $errors[count($errors)] = $error; } } /////////////////////////////////////////////////////////////////// //echo $num_succ; if($num_succ==count($cart)){ $process = true; } if($process==false){ unset($_SESSION["cart"]); $_SESSION["errors"] = $errors; ?> <script> window.location="index.php?view=sell"; </script> <?php } }else { $found = false; $cart = $_SESSION["cart"]; $index=0; $q = OperationData::getQByStock($_POST["product_id"],StockData::getPrincipal()->id); $can = true; if($_POST["q"]<=$q){ }else{ $error = array("product_id"=>$_POST["product_id"],"message"=>"No hay suficiente cantidad de producto en inventario."); $errors[count($errors)] = $error; $can=false; } if($can==false){ $_SESSION["errors"] = $errors; ?> <script> window.location="index.php?view=sell"; </script> <?php } ?> <?php if($can==true){ foreach($cart as $c){ if($c["product_id"]==$_POST["product_id"]){ echo "found"; $found=true; break; } $index++; // print_r($c); // print "<br>"; } if($found==true){ $q1 = $cart[$index]["q"]; $q2 = $_POST["q"]; $cart[$index]["q"]=$q1+$q2; $_SESSION["cart"] = $cart; } if($found==false){ $nc = count($cart); $product = array("product_id"=>$_POST["product_id"],"q"=>$_POST["q"]); $cart[$nc] = $product; // print_r($cart); $_SESSION["cart"] = $cart; } } } print "<script>window.location='index.php?view=sell';</script>"; // unset($_SESSION["cart"]); ?>