<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";
include_once "classes/cls_user.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_userid"]) and $_SESSION["sess_userid"]!= ""){
	$userid = $_SESSION["sess_userid"];
}else{
	header("Location:login.php");
	exit;
}

$adminCurrency	= GetAdminCurrency();
$currency_attributes = displayCurrencyType();

$Query_Wish_Products = "SELECT DISTINCT(f.nSellerId),f.dDate,f.nId,ar.company,ar.storename,ar.artist_name,ar.first_name,ar.last_name,ar.artist_id
                                        FROM ".$tableprefix."seller_favourites f
                                        INNER JOIN ".$tableprefix."artists  ar ON ar.artist_id = f.nSellerId
					WHERE f.nUserId = '".addslashes($userid)."' AND ar.is_vacation_mode = 'N' AND f.status ='Y' group by f.nSellerId  ";

//echo $Query_Wish_Products;
$wishListResult = mysql_query($Query_Wish_Products);
//echo "<pre>";print_r($result);
$totalrows = mysql_num_rows($wishListResult);

$limit=getPaginationLimit();

if($limit==0) {
    $limit=10;
}	

if(!(isset($pagenum)))
{
	$pagenum = 1;
} 



$page = isset($_GET['page'])? trim($_GET['page']):1;

if(empty($page))
{
	$page = 1;
}

$sql_qr=dopaging($Query_Wish_Products,'',$limit);
//echo $sql_qr;
$resultWishItems    =   mysql_query($sql_qr);

/*display the active template*/

$wishListNumRows = mysql_num_rows($wishListResult);

$active_template = displayTemplate();


/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);

?>
<script src="<?php echo SITE_URL?>/js/common.js"></script>
<link href="<?php echo $site_url; ?>/themes/<?php echo $active_template[5] ?>/jquery-confirm.css" rel="stylesheet" type="text/css">
<script src="<?php echo SITE_URL?>/js/jquery-confirm.js"></script>
<!--mainbody area start -->
<div class="main_body">
	<div class="container">
		<div class="row">			

		<!--center content area start-->		

		<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" name="frmFeedbacks">
		
		<section class="sec_marg">
		<div class="col-sm-12 col-lg-12 col-md-12 ">
			<h3><?php echo MY_FAVOURITES_SELLER_TEXT;?></h3>
		</div>
		</section>
		<div class="clear"></div>
		
		<div class="col-sm-12 col-lg-12 col-md-12 ">
		<!--items display area start -->
		
		<div>&nbsp;</div>
		<div class="text_information" align="center"><?php echo $message?></div>
		<div>
			
			<div class="order_listings">
			
			
			 <table width="100%"  border="0" cellpadding="0" cellspacing="0" align="center" class="responsive">
                            <tr class="ordheads_heads">
                                <th width="6%">#</th>
                                <th width="30%" align="left"><b><?php echo MY_FAVOURITES_SELLER;?></b> </th>
                                <th width="12%" align="left" ><b><?php echo FAVOURITES_DATE_ADDED;?> </b></th>
                                <th width="20%" align="center"><b><?php echo FAVOURITES_ACTION_TEXT;?> </b></th>
                            </tr>

                            <?php $ct = 1;?>
                            <?php if($totalrows > 0) {?>
                                <?php while ($wishlistRow =  mysql_fetch_array($resultWishItems)) { ?>
                                    <?php

                                  if($wishlistRow['storename']!='')
                                      {
                                            $sellerName         =    $wishlistRow['storename'];
                                      }else{
                                            $sellerName         =    $wishlistRow['artist_name'];
                                      }

                                    if ($enable_seller_friendly == "Y") {
                                        $sellerLink = (!empty($wishlistRow['storename'])) ? SITE_URL . "/stores/" . $wishlistRow['storename'] : SITE_URL . "/store/".$wishlistRow['artist_name'];
                                    } else {
                                        $sellerLink = (!empty($wishlistRow['storename'])) ? SITE_URL . "/showportfolio.php?storename=" . $wishlistRow['storename'] : SITE_URL . "/showportfolio.php?artistid=".$wishlistRow['artist_id'];
                                    }
                                  
                                    ?>

                            <tr id="jQwish<?php echo $wishlistRow["nId"];?>">
                                <td><?php echo (($page*$limit)+$ct-$limit)?></td>
                                <td>
                       
                                     <a href="<?php echo $sellerLink; ?>" target="_blank"><?php echo stripslashes($sellerName); ?></a>
       
                                </td>

                                
                                <td><span class="item_price"><?php  echo dateFormat($wishlistRow["dDate"], "Y-m-d", "m/d/Y"); ?>
                                    </span></td>
                                <td class="wishlist_actions">
                                   
                                    <a href="<?php echo $sellerLink; ?>" target="_blank"> <?php echo MY_FAVOURITES_SELLER_VIEW_STORE;?></a>
                                    
                                   | &nbsp; <a href="#"  id="delete" onclick ="return deletefavouritesellerentry(<?php echo $wishlistRow['nId'];?>);"><?php echo FAVOURITES_DELETE;?></a>
                                </td>
                            </tr>
                                    <?php $ct++;?>
                                    <?php } ?>
                                <?php } else {  ?>
                            <tr>
                                <td colspan="4" class="text_information" align="center"><?php echo FAVOURITES_SELLER_NOT_FOUND;?></td>
                            </tr>
                                <?php } ?>
                           

                        </table>
			<div class="clear"></div>
			</div>
			<div class="row">
			<div class="col-sm-12 col-lg-6 col-md-6">
				<input type="button" value="<?php echo ACCOUNT_BACK_BUTTON;?>" name="btnBack"  class="button" onClick="window.location.href='myaccount.php'">
			</div>  	
			<div class="col-sm-12 col-lg-6 col-md-6">
				<?php 
				if($totalrows>$limit)
				{
				
				?>	
										<div  class="pagination"> <?php echo rightpaging();?></div>
				<?php } ?>					
			</div>
			</div>
			<div class="clear"></div>
		  
							
							
						
																										
		</div>	
	
	
		<div align="left" class="float_clear1"></div>
					
					
		 <!--items display area end -->
		  </div>
		
			</form>
		<!--center content area end-->	

	</div>
	</div>
</div>
<!--mainbody area end -->
<div class="clear"></div>
<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>																										
																										
																										
																									