public static function addtoNewsLetterSubscriptionList($email = '')
 {
     global $tableprefix;
     if (!empty($email)) {
         // Check email address exists in subscribers list
         $resCat = DbHelper::execute("SELECT nId FROM " . $tableprefix . "newsletter_subscribers WHERE vEmail ='" . mysql_real_escape_string($email) . "' ");
         $data = DbHelper::fetchOne($resCat);
         // If alraedy exists return false
         if ($data) {
             $emailSubscribed = 'exists';
         } else {
             // Insert Email id to subscriberlist
             $resInsert = DbHelper::execute("INSERT INTO " . $tableprefix . "newsletter_subscribers\n                                                (vEmail)VALUES('" . mysql_real_escape_string($email) . "')");
             $constantcontactSettings = getconstantcontactSettings();
             $_SESSION['constantaction'] = 'Add Email';
             $userinfo = array();
             $userinfo['emailAddress'] = mysql_real_escape_string($email);
             $userinfo['firstName'] = '';
             $userinfo['lastName'] = '';
             $userinfo['lists'] = array($constantcontactSettings['constantcontactlistId']);
             $_SESSION['constantparam']['redirecturl'] = SITE_URL . '/checkout.php';
             //header("location:".$constantcontactSettings['verificationURL']);
             $emailSubscribed = 'added';
         }
         return $emailSubscribed;
     }
 }
 public static function checkCouponcodeExists($couponcode = '', $userId = "")
 {
     global $tableprefix;
     $currentDate = date('Y-m-d');
     if (!empty($couponcode)) {
         // Check email address exists in subscribers list
         $query = "SELECT o.couponCode FROM " . $tableprefix . "orders o\n                        WHERE  o.user_id = '" . mysql_real_escape_string($userId) . "' AND\n                              o.couponCode ='" . mysql_real_escape_string($couponcode) . "'  ";
         $resCat = DbHelper::execute($query);
         if (mysql_num_rows($resCat) == 0) {
             $query = "SELECT cc.* FROM " . $tableprefix . "couponcode cc WHERE cc.ccCode='" . mysql_real_escape_string($couponcode) . "' AND\n                              cc.ccStatus='Y' AND cc.subscriptionStatus='Y'\n                              AND cc.ccStartDate<='" . mysql_real_escape_string($currentDate) . "' AND\n                              cc.ccEndDate>='" . mysql_real_escape_string($currentDate) . "'";
             $resCat = DbHelper::execute($query);
             $data = DbHelper::fetchRow($resCat);
         }
         // If couopon code valid then return coupon percenatage
         if ($data) {
             return $data;
         }
     }
 }
if ($_SESSION["sess_userid"] != "") {
    productViewedReport(GetSQLValueString($productid, "text"), $_SESSION["sess_userid"]);
    $USER_ID = $_SESSION["sess_userid"];
}
/* Items Bought By */
$resIB = DbHelper::execute("SELECT od.product_id,od.product_name,op.image_small,op.image_big\n            FROM " . $tableprefix . "order_details od\n                INNER JOIN " . $tableprefix . "product_options op ON od.product_option_id = op.product_option_id\n                INNER JOIN  " . $tableprefix . "products p ON p.product_id \t = op. \tproduct_id\n                    WHERE od.order_id IN (SELECT GROUP_CONCAT(DISTINCT d.order_id ORDER BY d.order_id DESC SEPARATOR ', ') FROM " . $tableprefix . "order_details d WHERE d.product_id = '" . mysql_real_escape_string($_GET['productid']) . "')\n                     AND p.deleted = 'N'   AND od.product_id != '" . $_GET['productid'] . "'  AND od.item_status IN(1, 3, 4) GROUP BY od.product_id LIMIT 0,12");
/*$resIB = DbHelper::execute("SELECT DISTINCT od.product_id,od.product_name,op.image_small,op.image_big
  FROM ".$tableprefix."order_details od
      LEFT JOIN ".$tableprefix."product_options op
          ON
          od.product_option_id = op.product_option_id LIMIT 12");*/
$IBArr = DbHelper::fetchAll($resIB);
/* Other Intrested Items Bought By */
//$resOI = DbHelper::execute("SELECT p.product_id,p.product_name,op.image_small,op.image_big FROM ".$tableprefix."products p LEFT JOIN ".$tableprefix."product_options op ON p.product_id = op.product_id WHERE p.vIntrest='Y' AND p.product_id != '".$_GET['productid']."' GROUP BY p.product_id LIMIT 0,12");
$sql_interest = "SELECT p.product_id,p.product_name,op.image_small,op.image_big FROM " . $tableprefix . "products p\n    LEFT JOIN " . $tableprefix . "product_options op ON p.product_id = op.product_id\n    INNER JOIN " . $tableprefix . "categories c ON c.category_id  = p.product_category\n        WHERE p.vIntrest='Y' AND p.product_id != '" . mysql_real_escape_string($_GET['productid']) . "'\n         AND p.deleted = 'N' AND c.vEnable='Y' GROUP BY p.product_id LIMIT 0,12";
$resOI = DbHelper::execute($sql_interest);
$OIArr = DbHelper::fetchAll($resOI);
/* display the active template */
$active_template = displayTemplate();
include "includes/htmltop.php";
/* Top File Name */
include_once "includes/" . $active_template[0];
$quantity = getWholesaleProductCount($prow["product_option_id"]);
// Check product is whole sale item or not
$eWholesaleItem = isWholesaleItem($productid);
//Check Selected Option Added to Wish List
$wishItemCount_Product = getWishItemsCount_Product($productid, $prow["product_option_id"]);
// Current Stock Available for a product
$currentStockAvailable = getCurrentStockAvailable($productid, $prow["product_option_id"]);
?>
<!--<script
 public static function getsubCategoryIds($categoryId)
 {
     global $tableprefix;
     if (!empty($categoryId)) {
         $resSet = DbHelper::execute("SELECT category_id from " . $tableprefix . "categories cat where cat.route REGEXP '^" . $categoryId . ",|,^" . $categoryId . "|," . $categoryId . ",|," . $categoryId . "\$|^" . $categoryId . "\$' ");
         $data = DbHelper::fetchAll($resSet);
         if (count($data) > 0) {
             foreach ($data as $data_value) {
                 $category_array[] = $data_value->category_id;
             }
             $categoryString = implode("','", $category_array);
         }
     }
     return $categoryString;
 }
</div>
<div class="clear"></div>

<?php 
/* Product list carousel*/
/*$productListingFee = getSettingsValue('product_listing_fee');
$sql ="SELECT p.product_id,p.product_name,po.image_small,po.image_big FROM ".$tableprefix."products p
                INNER JOIN ".$tableprefix."product_options po ON po.product_id = p.product_id AND po.default_option='YES'
                INNER JOIN ".$tableprefix."artists s ON p.product_artist_id = s.artist_id
                WHERE p.product_artist_id='".$artistid."' AND  p.vapproved = 'Y' AND s.vapproved='Y'
                    AND s.plan_expired='N'";
    if($productListingFee > 0) {
        $sql .= " AND p.payment_status='COMPLETED' ";
    }
    $sql .= " AND p.deleted !='Y'  LIMIT 0,100";

$resOV = DbHelper::execute($sql);
$OVArr = DbHelper::fetchAll($resOV);*/
$sql = "SELECT ap.* FROM " . $tableprefix . "artists a INNER JOIN " . $tableprefix . "mybusiness ap ON a.artist_id = ap.artistid  WHERE ap.artistid = '" . addslashes($artistid) . "' LIMIT 0,100";
$resOV = DbHelper::execute($sql);
$OVArr = DbHelper::fetchAll($resOV);
if (count($OVArr) > 0) {
    ?>
<div class="txtblue">Click on thumbnail for a virtual tour of our business...</div>
<?php 
    include_once BASE_URL . '/product_details_page_carousel.php';
    clsCreateCarousel::showVendorBusinessCurozileItems($OVArr);
}
?>
</div>
 public static function getVendorNamesByOrderId($orderId = 0)
 {
     global $tableprefix;
     $query = "SELECT DISTINCT CONCAT(ar.first_name ,' ', ar.last_name) as name, ar.artist_id FROM " . $tableprefix . "order_details od\n\t\t\t\t\t\tINNER JOIN  " . $tableprefix . "artists ar ON od.artist_id = ar.artist_id\n                                                WHERE od.order_id = '" . mysql_real_escape_string($orderId) . "'";
     $resCat = DbHelper::execute($query);
     $data = DbHelper::fetchAll($resCat);
     return $data;
 }
 public static function getVendorFeedback($feedback_id)
 {
     global $tableprefix;
     $sql = " SELECT f.*, a.first_name,a.last_name  FROM " . $tableprefix . "artist_feedbacks f\n\t\tINNER JOIN " . $tableprefix . "artists a ON f.artist_id = a.artist_id\n                WHERE f.artist_feedback_id = " . $feedback_id . "";
     $result = DbHelper::execute($sql);
     $feedback = DbHelper::fetchRow($result);
     return $feedback;
 }
                $intrestCount = $intrestArr[0]->cntInt;
                if ($intrestCount < 12) {
                    //  echo "UPDATE ".$tableprefix."products SET vIntrest='Y' WHERE product_id IN ($productStr)";
                    DbHelper::execute("UPDATE " . $tableprefix . "products SET vIntrest='Y' WHERE product_id  = '" . mysql_real_escape_string($chkProductId) . "'");
                    echo 1;
                    exit;
                    /*  foreach($prodArr as $itemProd){
                            DbHelper::execute("UPDATE ".$tableprefix."products SET vIntrest='Y' WHERE product_id=".$itemProd);
                            $msg =1;
                        }*/
                } else {
                    echo 2;
                    exit;
                }
            } else {
                DbHelper::execute("UPDATE " . $tableprefix . "products SET vIntrest='N' WHERE product_id  = '" . mysql_real_escape_string($chkProductId) . "'");
                echo 4;
                exit;
            }
        } else {
            echo 3;
            exit;
        }
    }
    echo 2;
    exit;
}
if (isset($_POST['txtProductId'])) {
    $ids = $_POST['txtProductId'];
    if (empty($ids)) {
        $message .= "Please select Products which you need to delete.<br>";
        $imageurl = "<img src='" . $portfoliodir . "noimage.jpg' width='191' height='183' border='0' >";
        $sellerProfileImageURL = $imageurl;
        $sellerProfileImage = $portfoliodir . "noimage.jpg";
    } else {
        $imageurl = "<img src='" . $portfoliodir . $txtArtistPhoto . "' border='0' width='191' height='183' >";
        $sellerProfileImageURL = $imageurl;
        $sellerProfileImage = $portfoliodir . $txtArtistPhoto;
    }
    // Seller Rating
    $sellerRes = DbHelper::execute("SELECT IFNULL(ROUND(AVG(rating),0),0) as rating FROM " . $tableprefix . "artist_feedbacks WHERE published = 'Y' AND artist_id =" . $artistid);
    $sellerRatingArr = DbHelper::fetchAll($sellerRes);
    // Total rating
    $sellerRating = $sellerRatingArr[0]->rating;
    // End Seller Rating
    // User Info
    $userInfoRes = DbHelper::execute("SELECT email,user_name FROM " . $tableprefix . "users WHERE user_id = '" . $_SESSION["sess_userid"] . "'");
    $userInfoArr = DbHelper::fetchAll($userInfoRes);
    $email_address = $userInfoArr[0]->email;
    $contact_name = $userInfoArr[0]->user_name;
    if (strstr($contact_name, 'Guest') != '') {
        $contact_name = '';
    }
    // User Info
}
/*----------Multicart 2.0 Upgradation Starts------------*/
if ($enable_seller_friendly == "Y") {
    $artist_name = $row['artist_name'];
}
/*----------Multicart 2.0 Upgradation Ends------------*/
/*display the active template*/
$active_template = displayTemplate();