$_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if (isset($_SESSION["sess_artistid"]) and $_SESSION["sess_artistid"] != "") {
    $artistid = $_SESSION["sess_artistid"];
} else {
    header("Location:login.php");
    exit;
}
include "../includes/htmltop.php";
$select_product = "SELECT product_id,product_name FROM " . $tableprefix . "products WHERE product_artist_id = " . $artistid . " ORDER BY product_name ASC";
$result_product = mysql_query($select_product) or die(mysql_error());
/*taken from the general site settings table*/
$check_product_image_count = array('nproduct_images');
$settings_product_image_count = getSiteGeneralSettings($check_product_image_count);
$invalid_image_flag = 0;
if (isset($_GET["pname"]) and $_GET["pname"] != "") {
    $pname = $_GET["pname"];
}
if (isset($_GET["productid"]) and $_GET["productid"] != "") {
    $productid = $_GET["productid"];
}
if (isset($_POST['product']) and $_POST['product'] != "") {
    $productid = $_POST['product'];
}
if (!empty($productid)) {
    $select_bulk_images = "SELECT nproduct_image_id FROM " . $tableprefix . "product_view_images \n\t\t\t\t\t\t   WHERE nimage_productid = " . GetSQLValueString($_POST['product'], "text");
    $result_bulk_images = mysql_query($select_bulk_images) or die(mysql_error());
    $total_image_count = mysql_num_rows($result_bulk_images);
}
$display_product_price = number_format($converted_price, 2, ".", "");
// End Set Currency Value
// Item Description
$product_description_format = $prow["product_description"];
// End Item Description
// Setting Referer
if (strstr(basename($_SERVER['HTTP_REFERER']), "categorydetail.php") || strstr(basename($_SERVER['HTTP_REFERER']), "index.php")) {
    if (function_exists('session_unregister')) {
        isset($_SESSION['SESS_url_back']) ? session_unregister('SESS_url_back') : session_register('SESS_url_back');
    }
    //end if
    $_SESSION['SESS_url_back'] = basename($_SERVER['HTTP_REFERER']);
}
// End Setting Reffer
$check_array = array('more_images', 'ndisplay_stock');
$settings = getSiteGeneralSettings($check_array);
// Disply Sller Rating Details
$showSellerRating = '';
$showProductReviewLink = '';
//checking logged user buy the product atleast one
$prodStatus = mysql_query("select od.product_name from " . $tableprefix . "orders o left join " . $tableprefix . "order_details od\n\t\t\t\t\t\t\ton o.order_id=od.order_id where user_id='" . $_SESSION["sess_userid"] . "' and\n\t\t\t\t\t\t\tproduct_id='" . $_GET['productid'] . "'") or die(mysql_error());
if (mysql_num_rows($prodStatus) > 0) {
    $showProductReviewLink = '<a style="cursor:pointer" href="#">Post Product Review</a>';
    $showSellerRating = "<br><a style='cursor:pointer' onClick=";
    $showSellerRating .= '"javascript:';
    $showSellerRating .= "window.open('seller_rating.php?artist_id=" . $artistid . "', 'SellerRating','menubar=0,resizable=0,width=250,height=200');";
    $showSellerRating .= '">Seller Rating</a>';
    $showProductReview = "&nbsp;&nbsp;|&nbsp;&nbsp;<a style='cursor:pointer' onClick=";
    $showProductReview .= '"javascript:';
    $showProductReview .= "window.open('product_review.php?pid=" . $_GET['productid'] . "', 'SellerRating','menubar=0,resizable=0,width=450,height=300');";
    $showProductReview .= '">Post Product Review</a>';
switch ($worldpaytestmode) {
    case "100":
        $worldpayserver = "https://select-test.worldpay.com/wcc/purchase";
        break;
    case "0":
        $worldpayserver = "https://select.worldpay.com/wcc/purchase";
        break;
    default:
        $worldpayserver = "https://select.worldpay.com/wcc/purchase";
        break;
}
//---------------------------------------------------------------------------------------//
$myPlanID = $_SESSION['SESS_insertQry'][1];
/*function call to fetch details from site settings*/
$google_payment_array = array('vgoogle_check_enable', 'vyourpay_enable', 'vauthorize_enable', 'venable_gift_payment');
$google_payment_settings = getSiteGeneralSettings($google_payment_array);
if ($google_payment_settings[0] == "Y") {
    $google_block = "";
} else {
    $google_block = "none";
}
if ($google_payment_settings[1] == "Y") {
    $yourpay_block = "";
} else {
    $yourpay_block = "none";
}
include "../includes/htmltop.php";
?>
<script>

$check_shipping_enable = checkShippingEnable();
if ($check_shipping_enable == "Y" && $hide_shipping_division == 1) {
    $shipping_cost = $_SESSION['SHIPPING_TOTAL'];
    $totaltopay = number_format($totaltopay, 2, ".", "");
    $totaltopay = $totaltopay + $shipping_cost;
}
require_once 'gc/library/googlecart.php';
require_once 'gc/library/googleitem.php';
require_once 'gc/library/googleshipping.php';
require_once 'gc/library/googletax.php';
require_once 'gc/library/googleresponse.php';
require_once 'gc/library/googlemerchantcalculations.php';
require_once 'gc/library/googleresult.php';
/*function call to fetch google checkout details from site settings*/
$google_check_array = array('vgooglecheck_id', 'vgooglecheck_key', 'vgooglecheck_mode');
$google_checkout_settings = getSiteGeneralSettings($google_check_array);
$google_id = $google_checkout_settings[0];
$google_key = $google_checkout_settings[1];
$sandbox = $google_checkout_settings[2];
$total_amount = $totaltopay;
/*-------Clearing the cart after returning from Google Checkout------*/
if ($_GET['google_check'] != "" && $_GET['google_check'] == 1) {
    $check_shipping_enable = checkShippingEnable();
    if ($check_shipping_enable == "Y") {
        session_unregister('SESS_upstype');
        session_unregister('SESS_upscost');
        session_unregister('SESS_upsweight');
    }
    adjustStock($_SESSION["sess_userid"], "-");
    emptyCart($_SESSION["sess_userid"]);
    $_SESSION["sess_addresses_collected"] = false;