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; }
$sql = "SELECT c.*, p.product_name,p.product_price,p.discount FROM " . $tableprefix . "cart c INNER JOIN " . $tableprefix . "products p ON c.product_id = p.product_id WHERE c.visitor_cart_id = '" . addslashes(session_id()) . "' "; } $res = mysql_query($sql); if (mysql_num_rows($res) > 0) { while ($rw = mysql_fetch_array($res)) { $productname = $rw["product_name"]; /*------------Multicart 2.0 Upgradation------------*/ $get_convert_price = getSellerCurrency($rw["product_id"]); $defaultCurrencyrate = getDefaultCurrencyrate(); if ($currency_attributes[2] != "USD") { if ($get_convert_price != "") { // geting currency value correspoding to USD //Below line is commented on 03-01-2010 by Ramith //$get_convert_price=1/$get_convert_price; //$converted_price = ($rw["product_price"]*$get_convert_price)/$defaultCurrencyrate; $get_convert_price = 1 / getUserCurrencyExvalue($currency_attributes[2]); $converted_price = $rw["product_price"] * $get_convert_price; //$converted_price = ($rw["product_price"]/$get_convert_price); } } else { $converted_price = $rw["product_price"]; } $rate = number_format($converted_price, 2, ".", ""); //$currency_attributes = displayCurrencyType(); //$rate = number_format(($currency_attributes[1] * $converted_price),2,".",""); /*------------Multicart 2.0 Upgradation------------*/ $qty = $rw["quantity"]; $price = $qty * $rate; $discountstr = ""; if ($rw["discount"] != "0") { $price = $price - $price * $rw["discount"] / 100;