$query = "UPDATE sohorepro_checkout_guest\n\t\t\tSET quantity = '" . $quantity . "',\n unit_price = '" . $guest_price . "' WHERE\n product_id = '" . $product_id . "' AND \n ip = '" . $ip . "' "; } $sql_result = mysql_query($query); if ($sql_result) { echo '1'; } else { echo '0'; } } if (isset($_POST['guest_qty_fav']) && $_POST['guest_qty_fav'] != '') { $product_id = $_POST['id_fav']; $qty = $_POST['guest_qty_fav'] == '' ? '0' : $_POST['guest_qty_fav']; $guest_price = $_POST['guest_price_fav']; $ip = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']); //$ip = gethostbyaddr($_SERVER['REMOTE_ADDR']); $exist_qty = ExistQuantityGuest($product_id, $ip); $quantity = count($exist_qty) > 0 ? $exist_qty + $qty : $exist_qty; $exist_product = ExistProductOrderGuest($product_id, $ip); if ($exist_product < 1) { $query = "INSERT INTO sohorepro_checkout_guest\n\t\t\tSET product_id = '" . $product_id . "',\n quantity = '" . $qty . "',\n unit_price = '" . $guest_price . "',\n ip = '" . $ip . "' "; } else { $query = "UPDATE sohorepro_checkout_guest\n\t\t\tSET quantity = '" . $quantity . "',\n unit_price = '" . $guest_price . "' WHERE\n product_id = '" . $product_id . "' AND \n ip = '" . $ip . "' "; } $sql_result = mysql_query($query); if ($sql_result) { echo '1'; } else { echo '0'; } } //if ($_POST['guest_qty'] == '') {
foreach ($favorites as $fav){ $rowColor = ($i % 2 != 0) ? '#ffeee1' : '#fff6f0'; $id = $fav['id']; $product_name = getProName($fav['product_id']); $super_id = getsuper($fav['product_id']); $cat_id = getcat($fav['product_id']); $sub_id = getsub($fav['product_id']); $super_name = (getsuperN($super_id) != '') ? getsuperN($super_id) : ''; $cat_name_pre = (getcatN($cat_id) != '') ? getcatN($cat_id) : ''; $cat_name = ($cat_name_pre != '') ? '>>'.$cat_name_pre : $cat_name_pre ; $sub_name_pre = (getsubN($sub_id) != '') ? getsubN($sub_id):''; $sub_name = ($sub_name_pre != '') ? '>>'.$sub_name_pre : $sub_name_pre; $spl_price = GetSplFav($_SESSION['sohorepro_companyid'],$fav['product_id']); $price = $fav['sell_price']; $ip = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']); $exist_qty = ExistQuantityGuest($fav['product_id'], $ip); $exist_list = ExistUnitGuest($fav['product_id'], $ip); $qty_entered = ($exist_qty != '') ? $exist_qty : '' ; $price_pre = ($qty_entered * $exist_list); $price_fav = ($price_pre != '') ? $price_pre : '0.00'; $totalAddedCart = totalCartfav($ip); $totalAddedord = totalOrderfav($ip); // echo '<pre>'; // print_r($spl_price); // echo '</pre>'; // echo '<pre>'; // print_r($_SESSION); // echo '</pre>'; ?> <tr bgcolor="<?php echo $rowColor; ?>">