function getStarRatingContent($txtKbSearchid)
{
    $user_id = $_SESSION['sess_userid'];
    $kb_id = $txtKbSearchid;
    $siteUrl = getSettingsValue('SiteURL');
    $kbRatingExists = checkKbRatingExists($user_id, $kb_id);
    //echo '<pre>'; print_r($kbRatingExists); echo '</pre>';
    if ($kbRatingExists == 0) {
        $classToCall = 'jqRate';
        $cursorStyle = 'cursor:pointer';
    } else {
        $classToCall = 'jqNoRate';
        $cursorStyle = 'cursor:default';
    }
    $kbRatingValue = getKbRatingValue($kb_id);
    $str = '<div class="rate_div" >
            <div class="left">' . TEXT_KNOWLEDGEBASE_RATE . ' &nbsp;&nbsp;:&nbsp;&nbsp;</div>';
    for ($i = 1; $i <= 5; $i++) {
        if ($i <= $kbRatingValue) {
            $image = "star-yellow.png";
        } else {
            $image = "star-grey.png";
        }
        $str .= '<span class="renderRate ' . $classToCall . '" style="' . $cursorStyle . '" id="renderRate_' . $i . '" rateVal="' . $i . '" ><img style="margin-top:4px;" src="' . $siteUrl . 'images/' . $image . '"  /></span>';
    }
    $str .= '</div>';
    return $str;
}
function priceSortSeller($sortBy = '')
{
    $sortSettings = getSettingsValue('vEnablePriceSort');
    if ($sortSettings == 'Y') {
        $select_status = '<div class="pcm_sort">

                <script type="text/javascript">
   function submitPrice(frm){
        $("#"+frm).submit();
   }
                 </script>

		';
        $select_status .= "<select name='txtPriceSort' id='txtPriceSort' class='sortbox' onChange = submitPrice('frmCatalog')>\n";
        $select_status .= "<option value=''>Sort by price</option>\n";
        $select_status .= "<option value='DESC'";
        if ($sortBy == 'DESC') {
            $select_status .= " selected='selected' ";
        }
        $select_status .= '>High to low </option>';
        $select_status .= "<option value='ASC' ";
        if ($sortBy == 'ASC') {
            $select_status .= " selected='selected' ";
        }
        $select_status .= '>Low to high </option>';
        $select_status .= '</select>
            <div class="clear"></div></div>';
        echo $select_status;
    }
}
    $authorize_net = "";
    $authorize_net_block = "none";
}
if ($txtEnableGoogleCheck == "Y") {
    $google_checkout = "checked";
    $google_checkout_block = "";
} else {
    $google_checkout = "";
    $google_checkout_block = "none";
}
if ($txtYourPayBuffer != "" || $txtYourPayCertificate != "") {
    $pem_file_message = "Certificate file uploaded !!";
} else {
    $pem_file_message = "Please upload certificate file !!";
}
if (getSettingsValue('enable_buyerToseller') == 'Y') {
    $sellerpaymentmode = 'checked';
    $parallel_block = "";
    $paypalpay_block = "none";
} else {
    $adminpaymentmode = 'checked';
    $parallel_block = "none";
    $paypalpay_block = "";
}
//checking buyer to selled db value
if (trim($BuyertoSeller2 != '') and $BuyertoSeller2 == 'Y') {
    $BuyertoSeller = 'checked';
}
//end if
if ($txtEnableBluePay == 'Y') {
    $blue_pay_block = 'block';
if (isset($_POST['btnSubmit'])) {
    $from_date = dateFormat($_POST['txtFromDate'], "d-m-Y", "Y-m-d");
    $to_date = dateFormat($_POST['txtToDate'], "d-m-Y", "Y-m-d");
    $query_string = "AND o.order_date >= " . GetSQLValueString($from_date, "text") . " AND o.order_date <= " . GetSQLValueString($to_date, "text") . " ";
    $query_string1 .= '&txtFromDate=' . $_POST['txtFromDate'];
    $query_string1 .= '&txtToDate=' . $_POST['txtToDate'];
} else {
    $query_string = "";
}
//get orders
$sql = "SELECT DISTINCT ot.* FROM " . $tableprefix . "order_tax ot\n\t\t\t\t\t\tINNER JOIN  " . $tableprefix . "orders o ON ot.orderid = o.order_id\n                                                INNER JOIN  " . $tableprefix . "order_details od ON od.order_id = o.order_id\n                                                WHERE o.vpayment_status ='C' AND od.artist_id = '" . mysql_real_escape_string($artistid) . "'  " . $query_string . "  ORDER BY o.order_id DESC";
//pagination
if (!isset($pagenum)) {
    $pagenum = 1;
}
$limit = getSettingsValue('npagination_limit');
$page = isset($_GET['page']) ? trim($_GET['page']) : 1;
if (empty($page)) {
    $page = 1;
}
$limit = 30;
$result = mysql_query($sql) or die(mysql_error());
$totalrows = mysql_num_rows($result);
$sql_qr = $sql;
$resultRows = @mysql_num_rows(mysql_query($sql_qr));
$limitvalue = ($page - 1) * $limit;
$query_string = " LIMIT {$limitvalue}, {$limit}";
$sql = $sql . $query_string;
//echo $sql;
$result = mysql_query($sql) or die(mysql_error());
$numofpages = ceil($totalrows / $limit);
        ?>
" height="<?php 
        echo $imgheight;
        ?>
"></a>
				</div>	
				<br>
																	
<!--banner display ends here-->																
	
<?php 
    }
}
$google_value = getSettingsValue('enable_google');
if ($google_value == "Y") {
    ?>
	
			<table cellpadding="0" cellspacing="0" width="80%">
				<tr>
					<td align="center">
						<?php 
    echo stripslashes(getSettingsValue('google_adsense_value'));
    ?>
					</td>
				</tr>		
			</table>
		
<?php 
}
include "includes/" . $active_template[2];
/* Bottom File Name */
include "../includes/session.php";
include "../includes/functions.php";
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if (isset($_SESSION["sess_adminname"]) and $_SESSION["sess_adminname"] != "") {
    $adminname = $_SESSION["sess_adminname"];
} else {
    header("Location:login.php");
    exit;
}
include "../includes/htmltop.php";
/*taken from the general site settings table*/
$banner_image_size = getSettingsValue('banner_size');
if (isset($_POST['add'])) {
    /*check whether banner with the same name exists in the database*/
    $select_banner = "SELECT * FROM " . $tableprefix . "banners WHERE LOWER(vbanner_name) = " . GetSQLValueString(strtolower($_POST['txtBannerName']), "text");
    $result_banner = mysql_query($select_banner) or die(mysql_error());
    if (mysql_num_rows($result_banner) > 0) {
        $message = "Banner Name Already Exists !!";
    } else {
        $bannerfiletype = $_FILES['txtBannerImage']['type'];
        $bannerfilename = $_FILES['txtBannerImage']['name'];
        $bannertempname = $_FILES['txtBannerImage']['tmp_name'];
        if ($_FILES['txtBannerImage']['name'][0] != "") {
            if (!isValidWebImageType($bannerfiletype, $bannerfilename, $bannertempname)) {
                $message .= " * Invalid Image !! Upload an image (jpg/gif/png)" . "<br>";
            } else {
                $imagewidth_height_type_array = explode(":", ImageTypeBanner($_FILES['txtBannerImage']['tmp_name']));
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if (isset($_SESSION["sess_userid"]) and $_SESSION["sess_userid"] != "") {
    $userid = $_SESSION["sess_userid"];
} else {
    header("Location:login.php");
    exit;
}
/*display the active template*/
$active_template = displayTemplate();
include "includes/htmltop.php";
/* Top File Name */
include_once "includes/" . $active_template[0];
$wishCount = getUserWishCount($userid);
$enable_wishlist = getSettingsValue('vEnableWishlist');
?>
<script language="JavaScript" type="text/JavaScript">
function clickSearch()
{
	document.frmFeedbacks.submit();
}

</script>

<!-- content area Right Coulumn starts-------------------------------------------------------------- -->
                <div class="pcm_content_rightcolumn">
<div class="pcm_myaccount_wrapper">
			<!--mainbody area start -->
			
		<!--center content area start-->		
        header("Location:viewcart.php");
        exit;
    }
} else {
    header("Location:viewcart.php");
    exit;
}
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
$uspsRequired_Service = array("Express Mail", "Express Mail Hold For Pickup", "Express Mail Sunday/Holiday Delivery", "Priority Mail", "Parcel Post", "Priority Mail Large Flat Rate Box", "\nPriority Mail Medium Flat Rate Box", "Priority Mail Small Flat Rate Box", "Priority Mail Flat Rate Envelope", "Media Mail", "Library Mail");
//===================Getting Currency Type=========================
$currency_attributes = displayCurrencyType();
$flatrateEnabled = getSettingsValue('enable_flatrate');
/*display the active template*/
//checking shipping gateway and doing basic settings - Santhosh
switch ($_SESSION["sessShippingMethod"]) {
    case "FDXE":
    case "FDXG":
        include_once 'fedex/fedex.php';
        $sql = "select * from " . $tableprefix . "fedexsettings ";
        $rs = mysql_query($sql) or die(mysql_error());
        if (mysql_num_rows($rs) > 0) {
            $serviceName = array();
            $row = mysql_fetch_array($rs);
            $fedexaccno = stripslashes($row['FedexAccno']);
            $fedexmeterno = stripslashes($row['FedexMeterno']);
            $weightunits = $row['FedexWeight'];
            $server = $row['FedexServer'];
                                                                            
                                                                        </table>
                                                                    </div>
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <td valign="top" align="left">More Images (jpg/gif/png) </td>
																<td valign="top" align="left">:</td>
                                                                <td >
                                                                        <?php 
    $moreImagesql = "SELECT nproduct_image_id, nimage_productid,\n                        vimage_name, vimage_description, vproduct_image_delete_status\n                   FROM " . $tableprefix . "product_view_images \n                  WHERE nimage_productid= '" . addslashes($productid) . "'";
    $result = mysql_query($moreImagesql);
    if (mysql_num_rows($result) != 0) {
    }
    $moreImageMaxLImit = getSettingsValue('more_image_limit');
    if ($moreImageMaxLImit > 0) {
        for ($iCount = 0; $iCount < $moreImageMaxLImit; $iCount++) {
            ?>
                                                                    <div class="jqMoreImageContainer" style="padding:5px;border:1px solid #D3D1D1;margin:0 15px 15px 0;float:left;width:200px; background-color:#ffffff;">
                                                                        <div style="width:180px;float:left;margin-bottom: 4px;"><b>More Image <?php 
            echo $iCount + 1;
            ?>
</b><span class="help"><a href="#" title="This image is shown in product details page "><img src="../images/question_mark.jpg" border="0" height="15"></a></span></div>
                                                                        <input type="file" name="productMoreImage[]" />
                                                                    </div>
                                                                                <?php 
        }
    }
    ?>
     </td>
   </tr>
</table>


</body>
</html>';
            $mailsent = mail($to, $subject, $mail_send_details, $headers);
            /*********************** End email section ***********************************/
        }
    }
    //end if
    //edit review
    if (isset($_POST['btnGo']) && $_POST['btnGo'] == 'Edit Review') {
        switch (getSettingsValue('vReview')) {
            case "automatic":
                $aActive = '1';
                break;
            default:
                $aActive = '0';
                break;
        }
        //end switch
        mysql_query("update " . $tableprefix . "Review set vDes='" . $_POST["txtReview"] . "',vActive='" . $aActive . "'\n\t\t\t\t\t\t\t\twhere nUserId='" . $_SESSION["sess_userid"] . "' and nProdId='" . $_POST["pid"] . "'") or die(mysql_error());
        $msg = 'Review edited successfully';
    }
    //end if
    ?>
		
		
        ?>
</td>
                                    <td align="left" valign="top"><?php 
        echo htmlentities($row["user_name"]);
        ?>
</td>
                                    <td align="left" valign="top"><?php 
        echo htmlentities(stripslashes($row["product_name"]));
        ?>
</td>
                                    <td align="center" valign="top"><?php 
        echo $act;
        ?>
</td>
                                            <?php 
        if (getSettingsValue('vReview') == 'vendors') {
            ?>
<td align="left" valign="top"><?php 
            echo $act2;
            ?>
</td>
                                                <?php 
        }
        //end if
        ?>
                                </tr>
                                        <?php 
        $i++;
    }
    ?>
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2007 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of supportpro supportdesk                 |
// +----------------------------------------------------------------------+
// | Authors: jimmy<*****@*****.**>                                  |
// |                                                                      |
// +----------------------------------------------------------------------+
require_once "./includes/applicationheader.php";
include "./includes/functions/miscfunctions.php";
include "./languages/" . $_SP_language . "/tickets.php";
$conn = getConnection();
$ticketListingOrder = getSettingsValue("OldestMessageFirst");
include "../includes/docheader.php";
?>

<title><?php 
echo HEADING_TICKETS;
?>
</title>
<?php 
include "./includes/headsettings.php";
$var_maxposts = (int) $_SESSION["sess_maxpostperpage"];
?>

<style>
    .content_search_container .rightmargin{
        margin-right:0px !important;
 public static function getShippingPriceProduct($productid = 0, $productOptionId = 0, $userId = "", $destination_country = "", $destination_state = "", $destination_zip = "")
 {
     global $tableprefix;
     $adminCurrency = GetAdminCurrency();
     if (isCartEmpty($userId)) {
         clsGenerateShippingControl::getNoShippingControl($product_option_id);
         return 0;
     }
     if (get_magic_quotes_gpc()) {
         $_POST = array_map('stripslashes_deep', $_POST);
         $_GET = array_map('stripslashes_deep', $_GET);
         $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
     }
     if ($destination_country == "" && $destination_state == "" && $destination_zip == "") {
         $userAddress = clsGenerateShippingControl::getuserAddress($userId);
         if (count($userAddress) > 0) {
             $destination_state = $userAddress['state'];
             $destination_country = $userAddress['country'];
             $destination_zip = $userAddress['zip'];
         }
     }
     $uspsRequired_Service = array("Express Mail", "Express Mail Hold For Pickup", "Express Mail Sunday/Holiday Delivery", "Priority Mail", "Parcel Post", "Priority Mail Large Flat Rate Box", "\nPriority Mail Medium Flat Rate Box", "Priority Mail Small Flat Rate Box", "Priority Mail Flat Rate Envelope", "Media Mail", "Library Mail");
     //===================Getting Currency Type=========================
     $currency_attributes = displayCurrencyType();
     $flatrateEnabled = getSettingsValue('enable_flatrate');
     /*display the active template*/
     //set shipping gateway and doing basic settings
     include_once 'fedex/fedex.php';
     $sql = "select * from " . $tableprefix . "fedexsettings ";
     $rs = mysql_query($sql) or die(mysql_error());
     if (mysql_num_rows($rs) > 0) {
         $serviceName = array();
         $row = mysql_fetch_array($rs);
         $fedexaccno = stripslashes($row['FedexAccno']);
         $fedexmeterno = stripslashes($row['FedexMeterno']);
         $weightunits = $row['FedexWeight'];
         $server = $row['FedexServer'];
         $dropoff = stripslashes($row['FedexDropOff']);
         $packageTypes = stripslashes($row['FedexPackage']);
         $sName = $row['FedexService'];
         $currency = $row['FedexCurrency'];
         if ($_SESSION["sessShippingMethod"] == "FDXE") {
             $sarry = $fedexService;
             $shippingTitle = "Fedex Express Shipping";
         } else {
             $sarry = $fedexGroundService;
             $shippingTitle = "Fedex Express Ground Shipping";
         }
     }
     // end num rows check
     switch ($server) {
         case "test":
             $fedexserver = "https://gatewaybeta.fedex.com/GatewayDC";
             break;
         case "production":
             // change this to actual server when go on live
             $fedexserver = "https://gatewaybeta.fedex.com/GatewayDC";
             break;
         default:
             $fedexserver = "https://gatewaybeta.fedex.com/GatewayDC";
             break;
     }
     //// check enabled shipping is usps or not
     include_once "usps/xmlparser.php";
     include_once 'usps/usps.php';
     $shippingTitle = "USPS";
     $sql = "select * from " . $tableprefix . "usps_settings ";
     $rs = mysql_query($sql) or die(mysql_error());
     if (mysql_num_rows($rs) > 0) {
         $row = mysql_fetch_array($rs);
         $uspsid = $row['username'];
         $server = $row['server'];
     }
     // end num rows check
     switch ($server) {
         case "test":
             $uspsserver = "http://testing.shippingapis.com/ShippingAPITest.dll";
             break;
         case "production":
             //change this line when usps is on live
             $uspsserver = "http://Production.ShippingAPIs.com/ShippingAPI.dll";
             break;
         default:
             $uspsserver = "http://testing.shippingapis.com/ShippingAPITest.dll";
             break;
     }
     // end switch
     require_once "ups.php";
     include_once "shipping.php";
     include_once 'http_client.php';
     $shippingTitle = "UPS";
     // Shipping setting for UPS Shipping
     $select_shipping_settings = "SELECT * FROM " . $tableprefix . "shipping_settings";
     $result_shipping_settings = mysql_query($select_shipping_settings);
     if (mysql_num_rows($result_shipping_settings) > 0) {
         $rs_ship = mysql_fetch_array($result_shipping_settings);
         $ups_weight = $rs_ship['nShippingweight'];
         $ups_rate = $rs_ship['ups_rate'];
         $ups_container = $rs_ship['container_type'];
         $ups_type = $rs_ship['address_quote_method'];
     }
     $upsrate = new Ups();
     // select product details
     $select_cart_details = "SELECT prd.product_id,prd.product_name,po.product_option_id,po.product_length,po.product_width,po.product_height,crt.quantity,\n                       po.product_shipping_weight,art.country AS origin_country,art.state AS origin_state,art.zip AS origin_zip,art.artist_id,\n                       art.defaultflatrate,art.additionalflatrate, prd.eUps, prd.eUsps , prd.eFedex , prd.fFlatRateShippingAmount, prd.fAdditionalItemCost\n                       FROM " . $tableprefix . "cart crt\n                       INNER JOIN " . $tableprefix . "product_options po ON crt.product_option_id = po.product_option_id\n                       INNER JOIN " . $tableprefix . "products prd ON prd.product_id = po.product_id\n                       INNER JOIN " . $tableprefix . "artists art ON art.artist_id = prd.product_artist_id\n                       WHERE crt.user_id = '" . mysql_real_escape_string($userId) . "' AND po.product_option_id = '" . mysql_real_escape_string($productOptionId) . "' ORDER BY crt.cart_id";
     $result_cart_details = mysql_query($select_cart_details) or die(mysql_error());
     $_SESSION["SHIPPING_DETAILS"] = array();
     $_SESSION["SHIPPING_TOTAL"] = 0;
     $productArray = array();
     $resultShippingArray = array();
     if (mysql_num_rows($result_cart_details) == 0) {
         //as no products there is no point in staying in shipping options
         clsGenerateShippingControl::getNoShippingControl($product_option_id);
         return 0;
     } else {
         //Now we need to take shipping rates a products
         $cart_details_row = mysql_fetch_array($result_cart_details);
         $shipping_weight = trim($cart_details_row['product_shipping_weight']);
         $origin_country = $cart_details_row['origin_country'];
         $origin_state = $cart_details_row['origin_state'];
         $origin_zip = $cart_details_row['origin_zip'];
         $product_name = $cart_details_row['product_name'];
         $artist_id = $cart_details_row['artist_id'];
         $product_id = $cart_details_row['product_id'];
         $product_option_id = $cart_details_row['product_option_id'];
         $optionsStr = "";
         $optionVal = getProductOptionsName($product_option_id);
         if ($optionVal != "") {
             $optionsStr = "<br>" . $optionVal;
         }
         $productArray[$product_option_id] = $product_name . $optionsStr;
         $quantity = trim($cart_details_row['quantity']);
         $product_length = $cart_details_row['product_length'];
         $product_height = $cart_details_row['product_height'];
         $product_width = $cart_details_row['product_width'];
         // Take product shippings
         $productShippingArray = array();
         if ($cart_details_row['eUps'] == 'Y') {
             $productShippingArray[] = 'UPS';
         }
         if ($cart_details_row['eFedex'] == 'Y') {
             $productShippingArray[] = 'FDXG';
         }
         if ($cart_details_row['eUsps'] == 'Y') {
             $productShippingArray[] = 'USPS';
         }
         if ($cart_details_row['fFlatRateShippingAmount'] > 0) {
             $productShippingArray[] = 'Flat Rate';
             $FlatRateShippingAmount = $cart_details_row['fFlatRateShippingAmount'];
             $AdditionalItemCost = $cart_details_row['fAdditionalItemCost'];
         }
         /*  echo '<br>' . $origin_state;
             echo '<br>' . $origin_country;
             echo '<br>' . $origin_zip;
             echo '<br>' . $destination_state;
             echo '<br>' . $destination_country;
             echo '<br>' . $destination_zip;*/
         //print_r($productShippingArray);
         foreach ($productShippingArray as $key => $shippingMethod) {
             //  $shippingMethod = $value; // set product shipping
             //set for ups only
             $shippingMethod = trim($shippingMethod);
             //======================Getting rates for each product from shipping gateways-Santhosh=================================
             switch ($shippingMethod) {
                 case "FDXE":
                 case "FDXG":
                     $shippingMode = $shippingMethod;
                     if (is_array($sarry)) {
                         // check service is an array or not
                         foreach ($sarry as $serviceNames) {
                             $fedex_shipping_weight = $shipping_weight * $quantity;
                             list($service, $serviceName) = split('-', $serviceNames);
                             $fedex = new Fedex();
                             $fedex->setServer($fedexserver);
                             $fedex->setAccountNumber($fedexaccno);
                             //Get your own - this will not work...
                             $fedex->setMeterNumber($fedexmeterno);
                             //Get your own - this will not work...
                             $fedex->setCarrierCode($shippingMode);
                             $fedex->setDropoffType($dropoff);
                             $fedex->setService($service, $serviceName);
                             $fedex->setPackaging($packageTypes);
                             $fedex->setWeightUnits($weightunits);
                             $fedex->setWeight($fedex_shipping_weight);
                             $fedex->setOriginStateOrProvinceCode($origin_state);
                             $fedex->setOriginPostalCode($origin_zip);
                             $fedex->setOriginCountryCode($origin_country);
                             $fedex->setDestStateOrProvinceCode($destination_state);
                             $fedex->setDestPostalCode($destination_zip);
                             $fedex->setDestCountryCode($destination_country);
                             $fedex->setPayorType("SENDER");
                             $fedexprice = $fedex->getPrice();
                             $fedexrate[] = $fedexprice->price->rate;
                             $fedexerror[] = $fedexprice->error->description;
                             if ($fedexprice->error->description == "" && $fedexprice->serviceName != "" && $fedexprice->price->rate != "") {
                                 $resultShippingArray[$product_option_id][] = array("service_name" => $fedexprice->serviceName, "rate" => $fedexprice->price->rate);
                             }
                         }
                         // end foreach
                     }
                     // end array check
                     break;
                 case "USPS":
                     $usps_shipping_weight = $shipping_weight * $quantity;
                     if ($usps_shipping_weight < 1) {
                         $usps_shipping_weight = 1;
                     }
                     $usps_shipping_weightSplit = explode(".", $usps_shipping_weight);
                     $shipping_pounds = $usps_shipping_weightSplit[0];
                     $ouncelength = count_digit($usps_shipping_weightSplit[1]);
                     if ($ouncelength == 0) {
                         $shipping_ounces = 0;
                     }
                     if ($ouncelength == 1) {
                         $shipping_ounces = $usps_shipping_weightSplit[1] / 10 * 16;
                     }
                     if ($ouncelength == 2) {
                         $shipping_ounces = $usps_shipping_weightSplit[1] / 100 * 16;
                     }
                     if ($ouncelength == 3) {
                         $shipping_ounces = $usps_shipping_weightSplit[1] / 1000 * 16;
                     }
                     if ($ouncelength == 4) {
                         $shipping_ounces = $usps_shipping_weightSplit[1] / 10000 * 16;
                     }
                     $usps = new USPS();
                     if ($server == "test") {
                         $usps->setWeight(10, 5);
                         $usps->setDestZip("20008");
                         $usps->setOrigZip("10022");
                     } else {
                         $usps->setDestZip($destination_zip);
                         $usps->setOrigZip($origin_zip);
                         $usps->setWeight($shipping_pounds, $shipping_ounces);
                     }
                     $usps->setServer($uspsserver);
                     $usps->setUserName($uspsid);
                     $uspspaswd = "";
                     $usps->setPass($uspspaswd);
                     $usps->setService("All");
                     //$usps->setContainer("Flat Rate Box");
                     $usps->setCountry("USA");
                     $usps->setMachinable("true");
                     $usps->setSize("REGULAR");
                     $uspsprice = array();
                     $uspsprice = $usps->getPrice();
                     $special_chars = "&lt;sup&gt;&amp;reg;&lt;/sup&gt;";
                     if ($uspsprice->error->description == "") {
                         foreach ($uspsprice->list as $eachItem) {
                             if ($eachItem->mailservice != "" && $eachItem->rate != "") {
                                 $eachItemServicename = str_replace($special_chars, "", $eachItem->mailservice);
                                 if (in_array($eachItemServicename, $uspsRequired_Service)) {
                                     $resultShippingArray[$product_option_id][] = array("service_name" => $eachItemServicename, "rate" => $eachItem->rate);
                                 }
                             }
                         }
                     }
                     break;
                 case "UPS":
                     $ups_types = clsGenerateShippingControl::getupsShippingTypes();
                     $ups_shipping_weight = $shipping_weight * $quantity;
                     $ups_shipping_weight = $ups_shipping_weight < 0.1 ? 0.1 : $ups_shipping_weight;
                     foreach ($ups_types as $types => $ups) {
                         $upsrate->upsProduct($types);
                         // See upsProduct() function for codes
                         $upsrate->origin($origin_zip, $origin_country);
                         // Use ISO country codes!
                         $upsrate->dest($destination_zip, $destination_country);
                         // Use ISO country codes!
                         $upsrate->rate($ups_rate);
                         // See the rate() function for codes
                         $upsrate->container($ups_container);
                         // See the container() function for codes
                         $upsrate->weight(number_format($ups_shipping_weight, 2, ".", ""));
                         $upsrate->rescom($ups_type);
                         // See the rescom() function for codes
                         $quote = $upsrate->getQuote();
                         if ($quote != "error" && $ups != "" && $quote != "") {
                             $resultShippingArray[$product_option_id][] = array("service_name" => $ups, "rate" => $quote);
                         }
                         // end price empty check
                     }
                     //end foreach
                     break;
                 case "Flat Rate":
                     $flat_rate_name = "Flat Rate";
                     $first_Item_charge = $FlatRateShippingAmount;
                     $additional_Item_charge = $AdditionalItemCost;
                     $rate = $first_Item_charge + $additional_Item_charge * ($quantity - 1);
                     $resultShippingArray[$product_option_id][] = array("service_name" => stripslashes($flat_rate_name), "rate" => $rate);
                 default:
             }
             // if the rate array is empty for other shipping Options check whether
             // admin has enabled the flat rate shipping so that customer can still
             // buy with the flat option.
             $Selected_Shipping_options = $shippingTitle;
             if (empty($selectedShippingOption)) {
                 $selectedShippingOption = $shippingTitle;
             }
             $shipping_options_availabe = count($resultShippingArray[$product_option_id]);
         }
         // end while loop
     }
     return $resultShippingArray;
 }
    }
}
?>

            <div class="clear"></div>
        </div>

        <div class="clear"></div>
    </div>





    <div class="clear"></div>
</div>
<!-- Footer Section End -->



<div class="clear"></div>
</div>
<?php 
if (getSettingsValue('enable_pinit') == 'Y') {
    ?>
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
<?php 
}
?>
</body>
</html>
function getProductsFromAdditionalCategoryId($categoryString, $sellerid = '')
{
    global $tableprefix;
    $additionalsql = "SELECT DISTINCT ac.product_id\n                        FROM " . $tableprefix . "additional_category ac\n                        INNER JOIN " . $tableprefix . "products p ON  p.product_id=ac.product_id\n                        INNER JOIN " . $tableprefix . "categories cat ON  ac.category_id=cat.category_id\n                        INNER JOIN " . $tableprefix . "product_options po ON po.product_id = p.product_id AND po.default_option = 'YES'\n                        INNER JOIN " . $tableprefix . "artists ar ON ar.artist_id =p.product_artist_id\n                        WHERE ar.vapproved ='Y' AND ar.deleted='N' AND ar.plan_expired='N'\n                        AND ac.category_id IN('" . $categoryString . "') AND  p.vapproved = 'Y' ";
    if (getSettingsValue('product_listing_fee') > 0) {
        $additionalsql .= " AND p.payment_status='COMPLETED' ";
    }
    $additionalsql .= " AND  p.deleted ='N' ";
    if ($sellerid != '') {
        $additionalsql .= " AND  ar.artist_id ='" . mysql_real_escape_string($sellerid) . "' ";
    }
    $resultAdditionalCategory = mysql_query($additionalsql) or die(mysql_error);
    if (mysql_num_rows($resultAdditionalCategory) > 0) {
        while ($rows = mysql_fetch_array($resultAdditionalCategory)) {
            $productArray[] = $rows['product_id'];
        }
    }
    return $productArray;
    echo "<pre>";
    print_r($productArray);
}
 $mylphp = new firstData();
 $myorder = array();
 if (getSettingsValue('vyourpay_mode') == 'TEST') {
     //$myorder["host"]       = "208.72.248.102";   //secure.linkpt.net for Live
     $myorder["host"] = "staging.linkpt.net";
     $myorder["result"] = "LIVE";
 } else {
     $myorder["host"] = "secure.linkpt.net";
     //secure.linkpt.net for Live
     $myorder["result"] = "LIVE";
 }
 $myorder["port"] = "1129";
 //##Merchantinfo
 $myorder["keyfile"] = "pem/" . getSettingsValue('vyourpay_certificate_file');
 # Change this to the name and location of your certificate file
 $myorder["configfile"] = trim(getSettingsValue('vyourpay_storeid'));
 # Change this to your store number
 //## Orderoptions
 $myorder["ordertype"] = "SALE";
 //The type of transaction. The possible values are SALE,PREAUTH,VOID,POSTAUTH,CREDIT, CALCSHIPPING
 $yearlen = strlen($txtYY);
 if ($yearlen > 2) {
     $CardYear = substr($txtYY, -2);
 }
 # card info
 $myorder["cardnumber"] = $txtCCNumber;
 $myorder["cardexpmonth"] = $txtMM;
 $myorder["cardexpyear"] = $CardYear;
 $myorder["cvmindicator"] = "provided";
 $myorder["cvmvalue"] = $txtCVV2;
 //## Payment
<?php

//echo '<pre>'; print_r($_REQUEST); echo '</pre>';
$var_numBegin = $_GET["numBegin"];
$var_start = $_GET["start"];
$var_begin = $_GET["begin"];
$var_num = $_GET["num"];
$txtSearchVal = $_REQUEST["txtKbTitleSearch"];
$maxPageLimit = getSettingsValue('MaxPostsPerPage');
$qryopt = "";
$txtSearch = "";
$cmbSearch = "";
?>
<script type="text/javascript">
    $(document).ready(function(){
        $(".jqRate").live("click",function(){

            var userId = "<?php 
echo $_SESSION['sess_userid'];
?>
";
            if(userId<=0){
                alert("Please login to rate");
                return;
            }
        });
        $(".jqNoRate").live("click",function(){
            alert("You have already rated this entry");
        });

    });
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';
        $adminemail = getSettingsValue('site_email');
        $mailsent = mail($adminemail, $subject_admin, $mail_send_details_admin, $headers);
        // End
        // Redirect User To View Cart Page
        // Add to constant contact
        if (isset($_POST['action']) && $_POST['action'] == 'checkout') {
            $sql_up1 = "SELECT cart_id  FROM  " . $tableprefix . "cart where visitor_cart_id ='" . session_id() . "'  ";
            $rs_up1 = mysql_query($sql_up1) or die(mysql_error());
            if (mysql_num_rows($rs_up1) > 0) {
                $sql_up_cart = "UPDATE  " . $tableprefix . "cart set user_id ='" . $_SESSION["sess_userid"] . "' where visitor_cart_id ='" . session_id() . "'  ";
                $rs_up_cart = mysql_query($sql_up_cart) or die(mysql_error());
                if ($check_news == 'Y') {
                    $constantcontactSettings = getconstantcontactSettings();
                    $_SESSION['constantaction'] = 'Add Email';
                    $userinfo = array();
                    $userinfo['emailAddress'] = $txtEmail;
        //alert(totalPrice.toFixed(2));return false;
        $("#shipping_rate").html(rate);
        //$("#ordertotal").html(parseFloat(totalPrice.toFixed(2)));
        $("#amounttopay").html( parseFloat(totalPrice.toFixed(2)));

    }

</script>
			
			<div align="left" class="main_body">
			<!--mainbody area start -->
<?php 
if ($ddlBillingCountry == '') {
    $ddlBillingCountry = 'US';
}
$enable_commentbox = getSettingsValue('enable_commentbox');
?>
<form name="frmCheckout" action="<?php 
echo $_SERVER["PHP_SELF"];
?>
" method="POST">
<!-- The id of the country field(s).  If more than one, seperate with spaces -->
<input type="hidden" value="shipCountrySelect billCountrySelect" name="cs_config_country_field" id="cs_config_country_field">
<input type="hidden" value="shipStateSelect billStateSelect"     name="cs_config_state_field"   id="cs_config_state_field">
<!-- The id of the the fields holding the default values.  If more than one, seperate with spaces -->
<input type="hidden" value="shipCountryDefault billCountryDefault" name="cs_config_country_default" id="cs_config_country_default">
<input type="hidden" value="shipStateDefault billStateDefault"     name="cs_config_state_default"   id="cs_config_state_default">
<!-- The actual default values -->
<input type="hidden" value="<?php 
echo $ddlBillingCountry;
?>
Пример #20
0
function SMTPMail($from, $to, $host, $port, $subject, $body, $attachments = "")
{
    // $from=$from;  /* Change this to your address like "*****@*****.**"; */ $sender_line=__LINE__;
    // $to="";       /* Change this to your test recipient address */ $recipient_line=__LINE__;
    if (strlen($from) == 0) {
        die("Please set the messages sender address in line " . $sender_line . " of the script " . basename(__FILE__) . "\n");
    }
    if (strlen($to) == 0) {
        die("Please set the messages recipient address in line " . $recipient_line . " of the script " . basename(__FILE__) . "\n");
    }
    $host = getSettingsValue('SMTPServer');
    $port = getSettingsValue('SMTPPort');
    $username = getSettingsValue('SMTPUsername');
    $password = getSettingsValue('SMTPPassword');
    $sslenabled = getSettingsValue('SMTPEnableSSL');
    $sslstatus = $sslenabled == '1' ? 'ssl' : '';
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // telling the class to use SMTP
    $mail->Host = $host;
    // SMTP server
    //$mail->SMTPDebug  = 2; // enables SMTP debug information (for testing)
    $mail->SMTPSecure = $sslstatus;
    $mail->SMTPAuth = true;
    // enable SMTP authentication
    $mail->Port = $port;
    // set the SMTP port for the GMAIL server
    $mail->Username = $username;
    // SMTP account username
    $mail->Password = $password;
    $mail->AddReplyTo($from);
    $mail->SetFrom($from);
    $mail->AddAddress($to);
    $mail->Subject = $subject;
    $mail->AltBody = '';
    // Optional, comment out and test.
    $mail->MsgHTML($body);
    // Send mail as html.
    // Mail attachments
    foreach ($attachments as $key => $value) {
        $split_name_url = explode("*", $value);
        $mail->AddAttachment("../attachments/" . $split_name_url[0], "Attached here is " . $split_name_url[1]);
    }
    $mailsent = $mail->Send();
    /*
        $smtp=new smtp_class;
    
        $smtp->host_name=$host;             /* Change this variable to the address of the SMTP server to relay, like "smtp.myisp.com" */
    //$smtp->host_port=$port;                /* Change this variable to the port of the SMTP server to use, like 465 */
    //$smtp->ssl=0;                       /* Change this variable if the SMTP server requires an secure connection using SSL */
    //$smtp->localhost="localhost";       /* Your computer address */
    //$smtp->direct_delivery=0;           /* Set to 1 to deliver directly to the recepient SMTP server */
    //$smtp->timeout=10;                  /* Set to the number of seconds wait for a successful connection to the SMTP server */
    //$smtp->data_timeout=0;              /* Set to the number seconds wait for sending or retrieving data from the SMTP server.
    /* Set to 0 to use the same defined in the timeout variable */
    //$smtp->debug=1;                     /* Set to 1 to output the communication with the SMTP server */
    //$smtp->html_debug=1;                /* Set to 1 to format the debug output as HTML */
    //$smtp->pop3_auth_host="";           /* Set to the POP3 authentication host if your SMTP server requires prior POP3 authentication */
    //$smtp->user="";                     /* Set to the user name if the server requires authetication */
    //$smtp->realm="";                    /* Set to the authetication realm, usually the authentication user e-mail domain */
    //$smtp->password="";                 /* Set to the authetication password */
    //$smtp->workstation="";              /* Workstation name for NTLM authentication */
    //$smtp->authentication_mechanism=""; /* Specify a SASL authentication method like LOGIN, PLAIN, CRAM-MD5, NTLM, etc..
    /* Leave it empty to make the class negotiate if necessary */
    /*
     * If you need to use the direct delivery mode and this is running under
     * Windows or any other platform that does not have enabled the MX
     * resolution function GetMXRR() , you need to include code that emulates
     * that function so the class knows which SMTP server it should connect
     * to deliver the message directly to the recipient SMTP server.
     */
    //if($smtp->direct_delivery) {
    //if(!function_exists("GetMXRR")) {
    /*
     * If possible specify in this array the address of at least on local
     * DNS that may be queried from your network.
     */
    //$_NAMESERVERS=array();
    // include("getmxrr.php");
    // }
    /*
     * If GetMXRR function is available but it is not functional, to use
     * the direct delivery mode, you may use a replacement function.
     */
    /*
    		else
    		{
    			$_NAMESERVERS=array();
    			if(count($_NAMESERVERS)==0)
    				Unset($_NAMESERVERS);
    			include("rrcompat.php");
    			$smtp->getmxrr="_getmxrr";
    		}
    */
    //}
    /*
        if($smtp->SendMessage(
        $from,
        array(
        $to
        ),
        array(
        "From: $from",
        "To: $to",
        "Subject: $subject",
        "Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
        ),$body."\n\nThank You.\n"));
    //		echo "Message sent to $to OK.\n";
        else ;
    //		echo "Cound not send the message to $to.\nError: ".$smtp->error."\n"; */
}
                <div class="detailpage_carouselheading">Customers who bought this also bought</div>
                
                <?php 
        clsCreateCarousel::showProductCurozile($IBArr);
        ?>
             
            </div>
                    <?php 
    }
}
// end check
?>
            <!-- Items Bought with this bought Area End -->
            <!-- Other items you may be intrested in Area -->
            <?php 
if (getSettingsValue('enable_otherinterested') == 'Y') {
    if (!empty($OIArr)) {
        ?>
            <div id="itemsIntrestedInContent">
                <div class="detailpage_carouselheading">Other items you may be interested in</div>

             <?php 
        clsCreateCarousel::showProductCurozileItems($OIArr);
        ?>
            </div>
                    <?php 
    }
}
?>
             <br>
            <!-- Other items you may be intrested in Area End -->
             //echopre($product);
         }
         $row++;
     }
 }
 $addedCount = 0;
 /*
  * Start to adding values after validation
  */
 if ($message == '') {
     if (!empty($inventory)) {
         /*
          * Rearrange csv data
          */
         rearrangeCSVData();
         $approveProducts = getSettingsValue('approve_products') == 1 ? 'Y' : 'N';
         foreach ($inventory as $newProduct) {
             $approveProducts = $newProduct['Publish'] == 'Y' ? 'Y' : 'NP';
             //Adding product
             $insQuery = "INSERT INTO " . $tableprefix . "products\n                                    SET product_name = '" . mysql_real_escape_string($newProduct['product_name']) . "',\n                                        product_price = '" . mysql_real_escape_string($newProduct['product_price']) . "',\n                                        product_code = '" . mysql_real_escape_string($newProduct['product_code']) . "',\n                                        product_description = '" . mysql_real_escape_string($newProduct['product_description']) . "',\n                                        product_category = '" . mysql_real_escape_string($newProduct['product_category']) . "',\n                                        product_artist_id = '" . mysql_real_escape_string($sellerid) . "',\n                                        date_added = NOW(),\n                                        deleted = 'N',\n                                        featured = 'N',\n                                        vdigital_product = 'N',\n                                        vapproved = '" . $approveProducts . "',";
             $insQuery .= "eMadetoOrder = '" . mysql_real_escape_string($newProduct['eMadetoOrder']) . "',\n                                     fFlatRateShippingAmount = '" . mysql_real_escape_string($newProduct['fFlatRateShippingAmount']) . "',\n                                     fAdditionalItemCost = '" . mysql_real_escape_string($newProduct['fAdditionalItemCost']) . "',\n                                     eProductTaxExempt = '" . mysql_real_escape_string($newProduct['eProductTaxExempt']) . "',\n                                     eUps = '" . mysql_real_escape_string($newProduct['eUps']) . "',\n                                     eUsps = '" . mysql_real_escape_string($newProduct['eUsps']) . "',\n                                     eFedex = '" . mysql_real_escape_string($newProduct['eFedex']) . "',\n                                     eCanadaPost = 'N',\n                                     eAustraliaPost = 'N',\n                                     vIntrest = '" . mysql_real_escape_string($newProduct['vIntrest']) . "',\n                                     vShipping_Policy = '" . mysql_real_escape_string($newProduct['vShipping_Policy']) . "' ";
             $insRes = mysql_query($insQuery) or die(mysql_error());
             if ($insRes) {
                 $productID = mysql_insert_id();
                 if ($productID > 0) {
                     //Adding product Option
                     addProductOption($newProduct, $productID, 'YES');
                 }
                 if (isset($newProduct['option_product'])) {
                     if (!empty($newProduct['option_product'])) {
                         foreach ($newProduct['option_product'] as $newOption) {
                      </tr>
          </table>
	</td>
  </tr>
</table>		

<br><br>

<div id="payMethod" style="display:none">
<table cellpadding="0" border="0" cellspacing="0" width="100%">
		
<?php 
$txtEnableAuthorize = getSettingsValue('vauthorize_enable');
$txtEnableBluepay = getSettingsValue('vbluepay_enable');
$txtEnableFirstData = getSettingsValue('vyourpay_enable');
$enable_buyerToseller = getSettingsValue('enable_buyerToseller');
if ($chkPaypal == "Y") {
    ?>
		
		<tr>
		  <td align="center">Click here to complete Paypal order payment</td>
		  </tr>
		<tr>
			<td align="center">

		<a href="pay.php?paymentMethod=PP"><img src="../images/pp.jpg" alt="Click here to complete Paypal order payment" border="0" title="Make payments with PayPal - it's fast, free and secure! " ></a>



<br>
[Make sure you return back to this site after payment for proper updating of your orders.]</td>
<!-- rating star script ends -->
 <?php 
if (getSettingsValue('enable_fbshare') == 'Y') {
    ?>
                                 <!-- Facebook Like Button Script -->
                                 <script>(function(d, s, id) {
                                    var js, fjs = d.getElementsByTagName(s)[0];
                                    if (d.getElementById(id)) return;
                                    js = d.createElement(s); js.id = id;
                                    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=378410118889955";
                                    fjs.parentNode.insertBefore(js, fjs);
                                }(document, 'script', 'facebook-jssdk'));</script> <!-- Facebook Like Button Script -->
                                 <?php 
}
?>
                                 </head>
            <body>
            <?php 
if (getSettingsValue('enable_fbshare') == 'Y') {
    ?>
            <div id="fb-root"></div>
            <?php 
}
?>
    <?php 
if (basename($_SERVER['PHP_SELF']) == "payment.php" || basename($_SERVER['PHP_SELF']) == "yourpay_payment.php" || basename($_SERVER['PHP_SELF']) == "success.php") {
    $site_url = SECURE_SITE_URL;
} else {
    $site_url = SITE_URL;
}
        ?>
</td>
                                    <td align="left"><?php 
        echo $link . htmlentities(stripslashes($row["category_name"])) . "</a>";
        ?>
</td>
                                    <td align="left"><?php 
        echo $link . dateFormat($row["date_added"], "Y-m-d", "m/d/Y") . "</a>";
        ?>
</td>
                                    <td align="left"><?php 
        echo $link . htmlentities($row["impression_count"]) . "</a>";
        ?>
</td>
                                            <?php 
        if (getSettingsValue('product_listing_fee') > 0) {
            ?>
                                    <td align="left"><?php 
            if ($row["payment_status"] != 'COMPLETED') {
                ?>
                                        <div class="hdr">
                                            <a href="product-listing-payment.php?&pid=<?php 
                echo $row["product_id"];
                ?>
">Pay Now&nbsp;</a>
                                        </div>
                                                        <?php 
            } else {
                echo htmlentities($row["payment_status"]);
            }
            ?>
            <li><a href="<?php 
echo SITE_URL;
?>
/viewcart.php" class="<?php 
echo $link_selected_cart;
?>
">View Cart</a></li>
            <li><a href="<?php 
echo SITE_URL;
?>
/allseller.php" class="<?php 
echo $link_selected_sellers;
?>
">Sellers</a></li>
<?php 
$enableAffiliate = getSettingsValue('enable_affiliates');
if ($enableAffiliate == 'Y') {
    ?>
            <li><a href="<?php 
    echo SITE_URL;
    ?>
/affiliates/login.php">Affiliates</a></li>
    <?php 
}
?>
            <li><a href="<?php 
echo SITE_URL;
?>
/about_us.html" class="<?php 
echo $link_selected_aboutus;
?>
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src=' . SITE_URL . '/banners/' . getSettingsValue('site_logo') . ' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>' . $mailcontent . '</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
<div class="lang_selector">

    <?php 
if ($_SESSION["sess_langchoice"] == "1") {
    $lang = getSettingsValue('DefaultLang');
    $_SESSION["sess_language"] = $lang;
    //$sql="Select vLangCode,vLangDesc from sptbl_lang order by vLangDesc ";
    //$result=mysql_query($sql,$conn);
    ?>
    <!--form name="frmLanguage" action="<?php 
    //echo SITE_URL;
    ?>
index.php" method="post">

        <label>
                <?php 
    //echo(TEXT_SELECT_LANGUAGE);
    ?>
</label>&nbsp;&nbsp;
                <select name="cmbLan" class="selectbox1" onChange="javascript:changeLanguage();" style="width:80px;">
                <?php 
    /*
                    if (mysql_num_rows($result) > 0) {
                        while($row = mysql_fetch_array($result)) {
                            echo("<option value=\"" . htmlentities($row["vLangCode"]) . "\">" . $row["vLangDesc"] . "</option>");
                        }
                    } */
    ?>
                </select>&nbsp;
        <script>
            var lc = '<?php 
} else {
    if (isset($_POST["txtSearch"]) and $_POST["txtSearch"] != "") {
        $txtSearch = $_POST["txtSearch"];
        $cmbSearchType = $_POST["cmbSearchType"];
    }
}
//echo "aaaaaaaaaaaaaaaaaa";
$txtCategoryName = trim($_POST["txtCategoryName"]);
$txtProductName = $_POST["txtProductName"];
$txtDescription = $_POST["txtDescription"];
$txtPrice = $_POST["txtPrice"];
$ddlArtist = $_POST["ddlArtist"];
$productlist = $_POST["chkproducts"];
$catid = $_GET['catid'];
$artistlist = makeArtistList();
$productListingFee = getSettingsValue('product_listing_fee');
//$madetoorder_opt = ($madetorderflag == 1) ? "AND p.eMadetoOrder = 'Y'" : '';
if (CheckGiftCertificateCategory($_GET['catid']) == 'Y') {
    $sql = "SELECT p.product_id,p.product_name,(p.product_price + po.additional_price) AS product_price,po.image_small,po.product_option_id,po.product_stock,po.discount,s.artist_name,\n                      (SELECT pm.vimage_name FROM " . $tableprefix . "product_view_images pm where pm.nimage_productid=p.product_id LIMIT 0,1)AS smallimage\n                      FROM " . $tableprefix . "products p\n                      INNER JOIN " . $tableprefix . "product_options po ON po.product_id = p.product_id AND po.default_option = 'YES'\n                      INNER JOIN " . $tableprefix . "giftcoupon_master gm oN gm.ngift_product_id=p.product_id\n                      LEFT JOIN " . $tableprefix . "artists s on p.product_artist_id=s.artist_id\n                      WHERE p.vapproved='Y' AND p.deleted ='N'  AND po.product_stock > 0 ";
    if ($productListingFee > 0) {
        $sql .= " AND p.payment_status='COMPLETED' ";
    }
    $sql .= "AND s.vapproved='Y' AND s.deleted = 'N' AND s.plan_expired='N' AND s.vacationmode = 'N' ";
} else {
    $sql = "SELECT p.product_id,p.product_name,(p.product_price + po.additional_price) AS product_price,po.image_small,po.product_option_id,po.product_stock,po.discount,s.artist_name, p.eMadetoOrder,\n                      (SELECT pm.vimage_name FROM " . $tableprefix . "product_view_images pm where pm.nimage_productid=p.product_id LIMIT 0,1)AS smallimage\n                      FROM " . $tableprefix . "products p\n                      INNER JOIN " . $tableprefix . "product_options po ON po.product_id = p.product_id AND po.default_option = 'YES'\n                      LEFT JOIN " . $tableprefix . "artists s on p.product_artist_id=s.artist_id\n\t\t      WHERE p.vapproved='Y' AND p.deleted ='N' AND s.vacationmode = 'N' AND po.product_stock > 0 ";
    if ($productListingFee > 0) {
        $sql .= " AND p.payment_status='COMPLETED' ";
    }
    $sql .= "\n                AND s.vapproved='Y' AND s.deleted = 'N' AND s.plan_expired='N' AND s.vacationmode = 'N' ";
}
$qrystring = " ";
$hide_shipping_division = hideShipping();
/*-------function call to check whether cart contains digital or gift coupon products so as to hide shipping------*/
$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;
}
$totaltaxrate = 0;
$shipping_cost = 0;
$totaltaxrate = number_format($_SESSION["TAX_TOTAL"], 2, ".", "");
//shipping cost
$shipping_cost = number_format($_SESSION['SHIPPING_TOTAL'], 2, ".", "");
$paymentMethod = "CC";
$gift_coupon_flag = 0;
$currencyCode = getSettingsValue("admin_currency");
$currencyID = urlencode($currencyCode);
$paymentsuccessful = false;
$paymenterror = "";
// Keep this as Authorization always
$paymentType = urlencode('Authorization');
// or 'Sale'
$nvpStr = "&PAYMENTACTION={$paymentType}&AMT={$totaltopay}&CREDITCARDTYPE={$txtCardType}&ACCT={$txtCardNumber}" . "&EXPDATE={$padDateMonth}{$txtExpYear}&CVV2={$txtCVV}&FIRSTNAME={$txtFirstName}&LASTNAME={$txtLastName}" . "&STREET={$txtAddress1}&CITY={$txtCity}&STATE={$txtState}&ZIP={$txtZIP}&COUNTRYCODE={$txtCountry}&CURRENCYCODE={$currencyID}";
// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = PPHttpPost('DoDirectPayment', $nvpStr);
if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
    //exit('Direct Payment Completed Successfully: <br>'.print_r($httpParsedResponseAr, true));
    $paymentsuccessful = true;
    if (isset($_SESSION['couponCode_det']) && $_SESSION['couponCode_det'] != '') {
        $nameCouponCode = ",couponCode,couponCodeDiscount";
        $valueCouponCode = ',"' . $_SESSION['couponCode_det']['ccCode'] . '",' . $_SESSION['couponCode_det']['ccDiscount'];