echo "idorder=" . $idorder; if ($idorder > 0) { //$idUnit[1] = addUnit($idproduct, 0, $units[1]['AmountPerUnit'], $units[1]['NameUnit'], $units[1]['price'], $units[1]['type']); for ($i = 1; $i <= count($products); $i++) { //$under_unit = $units[$i]['under_unit']; //$underIdUnit = $idUnit[$under_unit]; $idProduct = $products[$i]['productName']; $amount = 1; $idunit = $products[$i]['idUnit']; $getDiff = getDiffBathaction($idProduct, $idunit); foreach ($getDiff as $value) { $val_amount_unit = $value['amount_unit']; $val_price = $value['price_unit']; $amount = $val_amount_unit * $amount; } $idproduct[$i] = addProductRefunds($idorder, $products[$i]['idUnit'], $products[$i]['AmountProduct'], $products[$i]['price'], $products[$i]['type_factory'], $products[$i]['diff'] / $amount); echo "555"; } echo "555"; unset($_SESSION["idshopP"]); unset($_SESSION["productR"]); unset($_SESSION["countProductR"]); header("location: ../product_refunds.php?p=product_refunds&action=addCompleted"); } else { unset($_SESSION["idshopP"]); unset($_SESSION["productR"]); unset($_SESSION["countProductR"]); header("location: ../product_refunds.php?p=product_refunds&action=addError"); } } else { unset($_SESSION["idshopP"]);
<?php require_once dirname(__FILE__) . '/function/func_addorder.php'; session_start(); $z = 1; if ($_GET['p'] == "addProduct") { $idorder = $_GET['idorder']; $idUnit = $_GET['idUnit']; $productName = $_GET['productName']; $factoryName = $_GET['factoryName']; $AmountProduct = $_GET['AmountProduct']; $price = $_GET['price']; $total_price = $_GET['total_price']; $total_price_all = $_GET['total_price_all'] + $price * $AmountProduct; $diff = $_GET['diff']; $type_factory = $_GET['type_factory']; $idProduct = $productName; $amount = 1; $idunit = $products[$i]['idUnit']; $getDiff = getDiffBathaction($idProduct, $idUnit); foreach ($getDiff as $value) { $val_amount_unit = $value['amount_unit']; $val_price = $value['price_unit']; $amount = $val_amount_unit * $amount; } $idproduct = addProductRefunds($idorder, $idUnit, $AmountProduct, $price, $type_factory, $diff / $amount); $Edit = editTotal_order($idorder, $total_price_all); //header("location: ../edit_product_refunds.php");*/ echo "1"; }