<?php
$this->load->view('site/templates/header');
$this->load->model('product_model');
$this->load->model('user_model');

?> 



<script type="text/javascript" src="js/jcarousellite_1.0.1.pack.js"></script>
<script type="text/javascript">
		$(function() {
    		$(".slider_4").jCarouselLite({
        		btnNext: ".next_4",
        		btnPrev: ".prev_4",
				auto: false,
    			speed: 100,
        		visible: 2
    		});
		});

		$(function() {
    		$(".slider_11").jCarouselLite({
        		btnNext: ".next_11",
        		btnPrev: ".prev_11",
				auto: true,
    			speed: 4000,
        		visible: 2
    		});
		});
</script>






<section>
    
    	<div class="main">
        
        	<div class="container home">
            
            		<div class="left_side">
                
                	<div class="browse">
                    
                    	<h2><?php if($this->lang->line('comm_browse') != '') { echo stripslashes($this->lang->line('comm_browse')); } else echo "Browse"; ?></h2>
                        
                        <ul>
                        <?php  foreach ($this->data['mainCategories']->result() as $row){
							if ($row->cat_name != ''){ $commentData = $this->category_model->get_all_counts($row->id,''); if($commentData[0]['disp']>0){
                      	?>
                        <li><a href="category-list/<?php echo $row->id;?>-<?php echo $row->seourl;?>"><?php echo $row->cat_name;?></a></li>
                      <?php 
                      	} }
                      }
                      ?>
                        </ul>
                    </div>
                    
                    <form method="post" action="site/user/loginsubscribeUser" name="subscribe">
                    <div class="email_subscribe">
                    
                    	<h2><?php echo $this->config->item('email_title'); ?> <?php if($this->lang->line('user_finds') != '') { echo stripslashes($this->lang->line('user_finds')); } else echo "Finds"; ?></h2>
                        
                        <p><?php if($this->lang->line('land_trendsinbox') != '') { echo stripslashes($this->lang->line('land_trendsinbox')); } else echo "Get gift ideas, editors' picks & fresh trends in your inbox"; ?>.</p>
                        <input type="submit" value="<?php if($this->lang->line('land_subscribe') != '') { echo stripslashes($this->lang->line('land_subscribe')); } else echo "Subscribe"; ?>" class="subscribe_btn" />                        
                        <!--<a class="newsletter_links" href="#">See our other newsletters.</a>-->
                    
                    </div>
                    </form>
                    
                    <div class="left_shop">
                    	<h2><?php if($this->lang->line('land_waystoshop') != '') { echo stripslashes($this->lang->line('land_waystoshop')); } else echo "More Ways to Shop"; ?></h2>
                        <ul>
                        	<li><a href="category"><?php if($this->lang->line('shop_categories') != '') { echo stripslashes($this->lang->line('shop_categories')); } else echo "Categories"; ?></a></li>
                            <?php if($GiftCardList->num_rows() >0){ ?>
                            <li><a href="gift-cards"><?php if($this->lang->line('giftcard_cards') != '') { echo stripslashes($this->lang->line('giftcard_cards')); } else echo "Gift Cards"; ?></a></li>
                            <?php } ?>
                            
                            <li><a href="find/local"><?php if($this->lang->line('land_shoplocal') != '') { echo stripslashes($this->lang->line('land_shoplocal')); } else echo "Shop Local"; ?></a></li>
                            <li><a href="find/shop"><?php if($this->lang->line('land_shopsearch') != '') { echo stripslashes($this->lang->line('land_shopsearch')); } else echo "Shop Search"; ?></a></li>
                            <li><a href="find/people"><?php if($this->lang->line('land_psearch') != '') { echo stripslashes($this->lang->line('land_psearch')); } else echo "People Search"; ?></a></li>
                        </ul>
                    </div>
                </div>
                
                <div class="right_side">
                
		<div class="product_box">
                        
			<ul class="product_listing">                              
			<?php  
				$i=1;  
				if(!empty($productDetails)){ 
				foreach($productDetails as $proddetails){
                  	$imgSplit = explode(",",$proddetails['image']); 
					if($i == 13) { break; } else { 
			?>
            	<li>     
                    <div class="product_img">
                                <div class="product_hide">                                    
                                    <div class="product_fav">                             
										<?php if($loginCheck !=''){
                                        $favArr = $this->product_model->getUserFavoriteProductDetails(stripslashes($proddetails['id']));
                                        #print_r($favArr); die;
                                        if(empty($favArr)){ ?>
                                        <a href="javascript:void(0);" onclick="return changeProductToFavourite('<?php echo stripslashes($proddetails['id']); ?>','Fresh');">
                                            <input type="submit" value="" class="hoverfav_icon" />
                                        </a>
                                        <?php  } else { ?>                        
                                        <a href="javascript:void(0);" onclick="return changeProductToFavourite('<?php echo stripslashes($proddetails['id']); ?>','Old');">
                                            <input type="submit" value="" class="hoverfav_icon1" />
                                        </a>
                                        <?php }} else { ?>
                                        <form action="login" method="get" id="my_form">
                                            <input type="hidden" value="<?php echo base_url(); ?>" name="action">
                                            <a class="favorites" onclick="document.getElementById('my_form').submit();"><input type="submit" value="" class="hoverfav_icon"></a>
                                        </form>
                                        <?php  } ?> 
                                    </div>  
                                     
                                    <div class="hoverdrop_icon">
                                    	<a href="javascript:hoverView('<?php echo $i; ?>');">  </a>
                                        	<div class="hover_lists" id="hoverlist<?php echo $i; ?>">
                                               	<h2><?php if($this->lang->line('user_your_lists') != '') { echo stripslashes($this->lang->line('user_your_lists')); } else echo "Your Lists"; ?></h2>
                                                <div class="lists_check">
                                                	<?php foreach($userLists as $Lists){ 
													$haveListIn = $this->user_model->check_list_products(stripslashes($proddetails['id']),$Lists['id'])->num_rows();
													#echo $haveListIn;
													if($haveListIn>0){$chk='checked="checked"';}else{ $chk='';}
													?>
                                                    <input type="checkbox" class="check_box" onclick="return addproducttoList('<?php echo $Lists['id']; ?>','<?php echo stripslashes($proddetails['id']); ?>');" <?php echo $chk; ?> />
                                                    <label><?php echo $Lists['name']; ?></label>
                                                    <?php } ?>
                                                    <?php if(!empty($userRegistry)){ 
														$haveRegisryIn = $this->user_model->check_registry_products($proddetails['id'],$userRegistry->user_id)->num_rows();
														if($haveRegisryIn>0){$chk='checked="checked"';}else{ $chk='';}
													?>
													<input type="checkbox" class="check_box" onclick="return manageRegisrtyProduct('<?php echo $userRegistry->user_id; ?>','<?php echo $proddetails['id']; ?>');" <?php echo $chk; ?> />
													<label><span class="registry_icon"></span>Wedding Registry</label>
													<?php }  ?>
                                                    </div>                                                    
                                                    <div class="new_list">
                                                    <form method="post" action="site/user/add_list">
                                                        <input type="hidden" value="1" name="ddl" />
                                                        <input type="hidden" value="<?php echo $proddetails['id']; ?>" name="productId" />
                                                        <input type="text" placeholder="<?php if($this->lang->line('user_new_list') != '') { echo stripslashes($this->lang->line('user_new_list')); } else echo 'New list'; ?>" class="list_scroll" name="list" id="creat_list_<?php echo $i; ?>" />
                                                        <input type="submit" value="<?php if($this->lang->line('user_add') != '') { echo stripslashes($this->lang->line('user_add')); } else echo 'Add'; ?>" class="primary-button" onclick="return validate_create_list('<?php echo $i; ?>');" />
                                                    </form>
                                                </div>
                                        	</div>
                                    	
                                   	</div>  
                               </div>
                      
                        <a href="products/<?php echo $proddetails['seourl']?>">
                            <img  src="<?php if(!empty($imgSplit[0])){ ?>images/product/thumb/<?php echo stripslashes($imgSplit[0]); } else { echo "images/dummyProductImage.jpg";  }?>" 
                              alt="<?php echo stripslashes($proddetails['product_name']);?>" title="<?php echo stripslashes($proddetails['product_name']);?>" width="350px" height="400px" />
                        </a>
                    </div>
                                
                    <div class="product_title"><a href="products/<?php echo $proddetails['seourl']?>"><?php echo $proddetails['product_name']?></a></div>
                    <div class="product_maker"><a href="shop-section/<?php echo $proddetails['shop_seourl']; ?>"><?php echo $proddetails['shop_name']?></a></div>
                    <div class="product_price">
						<?php if($proddetails['price'] != 0.00) {?>
                        <span class="currency_value"><?php echo $currencySymbol; echo number_format($currencyValue*$proddetails['price'],2)?></span>
                        <span class="currency_code"><?php echo $currencyType;?></span>
                        <?php } else { ?> 
                        <span class="currency_value"><?php echo $currencySymbol; echo number_format($currencyValue*$proddetails['pricing'],2); echo '+';?></span>
                        <span class="currency_code"><?php echo $currencyType;?></span>
                        <?php }?>
                    </div>
                            
                </li> 
			<?php  
				$i++; 
				}	} 	} else{ ?>
					<h2 style="text-align:center; width:100%;"><?php if($this->lang->line('seller_noprod') != '') { echo stripslashes($this->lang->line('seller_noprod')); } else echo "No Product Found"; ?></h2>'; 	
			<?php } ?>
            
			</ul>
        </div>
                    <?php #echo $featuredShopDetails->row()->user_id; ?>
                    <?php if($featuredShopDetails->num_rows() > 0){ ?>
                    <div class="product_box">
                    
                        <div class="product_title_box">
                        
                            <h2><?php if($this->lang->line('land_featuredshop') != '') { echo stripslashes($this->lang->line('land_featuredshop')); } else echo "Featured Shop"; ?></h2>
                            
                            <a class="see_more" href="blog/tag/featured-shop" target="_blank"><?php if($this->lang->line('see_more') != '') { echo stripslashes($this->lang->line('see_more')); } else echo "See more"; ?></a>
                            
                        </div>
                        
                        <div class="featured_shop">
                        
                        	<div class="featured_img">
                                <a href="shop-section/<?php echo $featuredShopDetails->row()->shopurl;?>"  target="_blank">
                                <img src="images/users/thumb/<?php echo $featuredShopDetails->row()->thumbnail;?>" alt="<?php echo $featuredShopDetails->row()->seller_businessname;?>" title="<?php echo $featuredShopDetails->row()->seller_businessname;?>" />
                                </a>
                            </div>
                            
                            <div class="featured_right">
                           
                            	<h3><a href="<?php echo $featuredShopDetails->row()->guid;?>" target="_blank"><?php echo $featuredShopDetails->row()->seller_businessname;?></a></h3>
                                 
                                <p>"<?php echo $featuredShopDetails->row()->post_content;?>"</p>
                                
                                <a class="read_post" href="<?php echo $featuredShopDetails->row()->guid;?>" target="_blank"><?php if($this->lang->line('land_readinterview') != '') { echo stripslashes($this->lang->line('land_readinterview')); } else echo "Read the interview"; ?></a>
                            
                            </div>
                        	
                        
                        </div>
                        
                        <ul class="featured_listing">
                        <?php $i=1; foreach($featuredShopProducts->result_array() as $pList) { 
						$Img=explode(',',$pList['image']);
						?>
                        	<li>
                            
                            	<div class="product_img"><a href="products/<?php echo $pList['seourl'];?>"><img src="images/product/<?php echo $Img[0];?>" alt="<?php echo $pList['product_name'];?>" title="<?php echo $pList['product_name'];?>" /></a></div>
                                
                                <div class="product_title"><a href="products/<?php echo $pList['seourl'];?>"><?php echo $pList['product_name'];?></a></div>
                                
                                <div class="product_maker"><a href="shop-section/<?php echo $pList['shop_seourl'];?>"><?php echo $pList['shop_name'];?></a></div>
                            
                            	<div class="product_price">
                                <?php if($pList['price'] != 0.00) {?>
                        <span class="currency_value"><?php echo $currencySymbol; echo number_format($currencyValue*$pList['price'],2)?></span>
                        <span class="currency_code"><?php echo $currencyType;?></span>
                        <?php } else { ?> 
                        <span class="currency_value"><?php echo $currencySymbol; echo number_format($currencyValue*$pList['pricing'],2); echo '+';?></span>
                        <span class="currency_code"><?php echo $currencyType;?></span>
                        <?php }?>
                                
                                </div>
                            
                            </li>
                            <?php $i++; if($i == 3){ break;} }?>
                            
                            
                          </ul>
                        
                        
                   </div>
                   <?php } ?>
                   
                   <?php if(count($recentBlogPosts)>0){ ?>
                   <div class="product_box third onethird">
                    
                        <div class="product_title_box">
                        
                            <h2><?php if($this->lang->line('land_blog') != '') { echo stripslashes($this->lang->line('land_blog')); } else echo 'Recent Blog Posts'; ?></h2>
                            
                            <a class="see_more" href="blog"><?php if($this->lang->line('see_more') != '') { echo stripslashes($this->lang->line('see_more')); } else echo 'See more'; ?></a>
                            
                      
                            
              					<div class="next_4">
                                    <img alt="next" src="images/right_arrow.png">
                                    </div>
                                    <div class="prev_4">
                                    <img alt="prev" src="images/left_arrow.png">
                                    </div>
                                
                        </div>
                        <!-- Recent Blog Code Starts Here-->
                        <div class="slidewrap44 slider_4">
                            <ul class="" id="hambone">
                                <?php for($p=0; $p < count($recentBlogPosts)-1; $p=$p+2){?>
                                <li class="intro">
                                    <div class="featured_shop">
                                        <div class="featured_img">
                                            <a href="<?php echo $recentBlogPosts[$p]->guid;?>" target="_blank">
                                            
                              <?php $postImg1=$this->product_model->GetBlogimage(array('a.post_parent' => $recentBlogPosts[$p]->ID,'a.post_type' => 'attachment','meta_key' => '_wp_attached_file'));        if($postImg1->num_rows() > 0) {?>
                                            	<img src="blog/wp-content/uploads/<?php echo $postImg1->row()->meta_value;?>" alt="<?php echo $postImg1->row()->meta_value;?>" title="<?php echo $recentBlogPosts[$p]->post_title;?>" />
                                               <?php } else {?>
                                               <img src="images/blogpicks.jpg" alt="No Image" title="<?php echo $recentBlogPosts[$p]->post_title;?>" />
                                               <?php }?>
                                            </a>
                                        </div>
                                        <div class="featured_right">
                                            <h3><a href="<?php echo $recentBlogPosts[$p]->guid;?>" target="_blank"><?php echo $recentBlogPosts[$p]->post_title;?></a></h3>
											
                                            <p><?php echo $recentBlogPosts[$p]->post_content;?></p>
                                            <a class="read_post" href="<?php echo $recentBlogPosts[$p]->guid;?>" target="_blank">Read the post</a>
                                        </div>
                                    </div>
                                    <div class="featured_shop">
                                        <div class="featured_img">
                                            <a href="<?php echo $recentBlogPosts[$p+1]->guid;?>" target="_blank">
                                            	<?php $postImg2=$this->product_model->GetBlogimage(array('a.post_parent' => $recentBlogPosts[$p+1]->ID,'a.post_type' => 'attachment','meta_key' => '_wp_attached_file'));        if($postImg2->num_rows() > 0) {?>
                                            	<img src="blog/wp-content/uploads/<?php echo $postImg2->row()->meta_value;?>" alt="<?php echo $postImg2->row()->meta_value;?>" title="<?php echo $recentBlogPosts[$p+1]->post_title;?>" />
                                               <?php } else {?>
                                               <img src="images/blogpicks.jpg" alt="No Image" title="<?php echo $recentBlogPosts[$p+1]->post_title;?>" />
                                               <?php }?>
                                            </a>
                                        </div>
                                        <div class="featured_right">
                                            <h3><a href="<?php echo $recentBlogPosts[$p+1]->guid;?>" target="_blank"><?php echo $recentBlogPosts[$p+1]->post_title;?></a></h3>											
                                            <p><?php echo $recentBlogPosts[$p+1]->post_content;?></p>
                                            <a class="read_post" href="<?php echo $recentBlogPosts[$p+1]->guid;?>" target="_blank"><?php if($this->lang->line('land_read') != '') { echo stripslashes($this->lang->line('land_read')); } else echo 'Read the post'; ?></a>
                                        </div>
                                    </div>
                                </li>
                                <?php } ?>
                            </ul>
                        </div>
                        <!-- Recent Blog Code Ends Here-->
                         
                        
                        
                   </div>
                   <?php } ?>
                   
                   <?php if($productDetails[0]['id'] !=''){ ?>
                   <div class="product_box third onethird">
                    
                        <div class="product_title_box">
                        
                            <h2><?php if($this->lang->line('land_listeditems') != '') { echo stripslashes($this->lang->line('land_listeditems')); } else echo "Recently Listed Items"; ?></h2>
                            
                            <a class="see_more" href="search/all?order=date_desc"><?php if($this->lang->line('see_more') != '') { echo stripslashes($this->lang->line('see_more')); } else echo "See more"; ?></a>
                            
                      
                            
              					<div class="next_11">
                                    <img alt="next" src="images/right_arrow.png">
                                </div>
                                <div class="prev_11">
                                    <img alt="prev" src="images/left_arrow.png">
                                </div>
                           
                        </div>
                        
                        <div class="slidewrap44 slider_11">
                        
                        <ul class="" id="hambone">
                        <?php if($productDetails[0]['id'] != ''){?>
                        	<li style="margin-left: -11px;" class="intro">
                        
                 <div class="featured_shop" style="background: none repeat scroll 0% 0% transparent; height:180px; padding:0; border: medium none; width: 100%;">
                       
                        
                     
                     <?php //foreach($productDetails as $proddetails){
						  for($i=0; $i <= 15; $i++)  { 
						     if($productDetails[$i]['id'] != ''){
                                            $imgSplit = explode(",",$productDetails[$i]['image']); ?>
                                             <div class="list-images">
                                          <a href="products/<?php echo $productDetails[$i]['seourl'];?>"><img src="<?php if(!empty($imgSplit[0])){ ?>images/product/list-image/<?php echo stripslashes($imgSplit[0]); } else { echo "images/dummyProductImage.jpg";  }?>" alt="Listing-1" title="<?php echo stripslashes($productDetails[$i]['product_name']);?>" /></a>
                                         
                                            </div>
                                            <?php }}?>  
                        </div>
                        
                       
                        
                        </li>
                        <?php }?>
                         <?php if($productDetails[16]['id'] != ''){?>
                       <li style="margin-left: -11px;" class="intro">
                 		 <div class="featured_shop" style="background: none repeat scroll 0% 0% transparent; height:180px; padding:0; border: medium none; width: 100%;">
                       
                        
                     
                     <?php //foreach($productDetails as $proddetails){
						  for($i=16; $i <= 31; $i++)  {
                                            $imgSplit = explode(",",$productDetails[$i]['image']);
											if($productDetails[$i]['id'] != ''){
											 ?>
                                             <div class="list-images">
                                          <a href="products/<?php echo $productDetails[$i]['seourl'];?>">
                                          <img src="<?php if(!empty($imgSplit[0])){ ?>images/product/list-image/<?php echo stripslashes($imgSplit[0]); } else { echo "images/dummyProductImage.jpg";  }?>" alt="Listing-1" title="<?php echo stripslashes($productDetails[$i]['product_name']);?>" /></a>
                                         
                                            </div>
                                            <?php }}?>  
                        </div>
                        </li>
                        <?php }?>
                        
                        
                        
                        <!-- <?php if($productDetails[32]['id'] != ''){?>
                       <li style="margin-left: -11px;" class="intro">
                        
                 <div class="featured_shop" style="background: none repeat scroll 0% 0% transparent; height:180px; padding:0; border: medium none; width: 100%;">
                       
                        
                     
                     <?php //foreach($productDetails as $proddetails){
						  for($i=32; $i <= 46; $i++)  {
                                            $imgSplit = explode(",",$productDetails[$i]['image']);
											if($productDetails[$i]['id'] != ''){
											 ?>
                                             <div class="list-images">
                                          <a href="products/<?php echo $productDetails[$i]['seourl'];?>">
                                          <img src="<?php if(!empty($imgSplit[0])){ ?>images/product/list-image/<?php echo stripslashes($imgSplit[0]); } else { echo "images/dummyProductImage.jpg";  }?>" alt="Listing-1" title="<?php echo stripslashes($productDetails[$i]['product_name']);?>" /></a>
                                         
                                            </div>
                                            <?php }}?>  
                        </div>
                        
                        
                        
                        </li>
                        <?php }?>
                        -->
                        
                     
                        </ul>
                        
                        </div>
                        
                         
                        
                        
                   </div>
                   <?php } ?>
                   
  
                
                </div>
            
            
            </div>
        
        
        </div>
    
    
    </section>

<?php 
     $this->load->view('site/templates/footer');
?>