/************************** Affilate payment block*********************************************/ //echo "sql==".$sql."<br><br>"; $product_download_details = "Product Download Details\r\n"; $product_download_details .= "-----------------------\r\n"; $product_download_flag = 0; $download_link = ""; $sql = "SELECT c.*,p.product_price,p.product_name,p.product_code,p.product_artist_id,p.discount,\n\t\t\t\t\t\t\tp.vdigital_product\t \n\t\t\t\t\tFROM " . $tableprefix . "cart c INNER JOIN " . $tableprefix . "products p ON c.product_id = p.product_id\n\t\t\t\t\tWHERE c.user_id = '" . addslashes($CustomArray[0]) . "' "; $res = mysql_query($sql); $artists = array(); if (mysql_num_rows($res) != 0) { $i = 0; while ($row = mysql_fetch_array($res)) { $productid = $row["product_id"]; $quantity = $row["quantity"]; /*product price is calculated based on currency type*/ $get_convert_price = getSellerCurrency($row["product_id"]); if ($get_convert_price != "") { $converted_price = $row["product_price"] / $get_convert_price; } else { $converted_price = $row["product_price"]; } $productprice = number_format($currency_attributes[1] * $converted_price, 2, ".", ""); //$productprice = $row["product_price"]; $productname = $row["product_name"]; $productcode = $row["product_code"]; $productdiscount = $row["discount"]; $artistid = $row["product_artist_id"]; /*========================================Gift Certificate Section=================================*/ $select_gift_code = "SELECT vgift_coupon_code,ngift_coupon_amount\n\t\t\t\t\t FROM " . $tableprefix . "giftcoupon_master \n\t\t\t\t\t WHERE ngift_product_id = " . $productid; $result_gift_code = mysql_query($select_gift_code) or die(mysql_error()); if (mysql_num_rows($result_gift_code) > 0) {
function getSellerCartTotal($userid, $sellerid) { global $tableprefix; $sql = "SELECT c.*, (p.product_price+po.additional_price) AS product_price,p.product_artist_id,po.discount\n FROM " . $tableprefix . "cart c\n INNER JOIN " . $tableprefix . "product_options po ON po.product_option_id = c.product_option_id\n INNER JOIN " . $tableprefix . "products p ON p.product_id = po.product_id\n\t WHERE c.user_id = '" . addslashes($userid) . "' and p.product_artist_id='" . $sellerid . "' "; $result = mysql_query($sql); $total = 0; $itemcount = 0; $currency_attributes = displayCurrencyType(); if (mysql_num_rows($result) != 0) { while ($row = mysql_fetch_array($result)) { $get_convert_price = getSellerCurrency($row["product_id"]); $sellercurreny = getSellerCurrencySybol($row["product_artist_id"]); if ($currency_attributes[2] != "USD" and $sellercurreny != $currency_attributes[2]) { // user selected currency equllaent USD value // 1 USD equllaent user currency $get_convert_price = 1 / getUserCurrencyExvalue($currency_attributes[2]); $converted_price = $row["product_price"] * $get_convert_price; } else { if ($sellercurreny != "USD" and $sellercurreny != $currency_attributes[2]) { if ($get_convert_price != "") { $converted_price = $row["product_price"] * $get_convert_price; } // end if } else { $converted_price = $row["product_price"]; } } // end else $price = $row["quantity"] * $converted_price; if ($row["discount"] != "0") { $price = $price - $price * $row["discount"] / 100; } $total += $price; } } return $total; }