<?php
$currencyrate = $currencyrate->toArray();
$queryproduct = $queryproduct->toArray();
?>


<div class="breadcrumb">
<div class="container">
<div class="row">
<div class="col-md-12">
<ul>
<li><?php echo $this->Html->link('Home', array('controller'=>'pages', 'action' => 'home'), array('escape' => false));?></li>
<li><?php echo $this->Html->link(strtolower($queryproduct[0]['category']),array('controller'=>'products','action'=>'category',strtolower(str_replace(" ","-",$queryproduct[0]['category']))),array('escape'=>false));?></li>
<li><?php echo $queryproduct[0]['name'];?></li>
</ul>
</div>
</div>
</div>
</div>

<div class="flash-message-cartadd"><i class="icon icon-checked2"></i><span class="cartaddeditem"><?php echo $queryproduct[0]['name'];?></span> was added to your shopping bag. <?php echo $this->Html->link('Go to Cart',array('controller'=>'products', 'action' => 'cart'), array('escape' => false));?></div>

<div class="product-detail">
<div class="container">
<div class="row">

<div class="col-xs-12 col-md-7">
<div class="product-panel">
<div class="banners owl-carousel">

<?php 
foreach ($querypictures as $picture) {
echo '<div class="item">'.$this->Html->link($this->Html->image($picture['picture']),'/img/' . $picture['picture'],['data-fancybox' => 'images', 'escape' => false]).'</div>';
}
?>
</div>

<div class="thumbnails">

<?php 
foreach ($querypictures as $picture) {
echo '<div class="thumb-item">'.$this->Html->image($picture['picture']).'</div>';
}
?>
</div>

<div class="product-detail-cta">
<div class="innerbox">
<div class="left"><p>Need any help?</p></div>
<div class="right"><a href="tel:09351190805" target="_new"><img src="img/call.png" alt=""/>CALL</a><a href="https://wa.me/919351190805/?text=Hello Meridio Fans" target="_new"><img src="img/whatsapp.png" alt=""/>CHAT</a></div>
<p>Mon-Sat 9:30 AM TO 6:00 PM (IST)</p>
</div>


<div class="clearfix"></div>
<p><strong>Manufactured & Packaged By</strong></p>
<p>107 First Floor hitavalas Prabhu Shri Apartment Bhuwana Road Near R.K. Circle Mahaveer Colony Park Udaipur Rajasthan 313001</p>
<p><strong>Country of Origin</strong> - India</p>
</div>
</div>
</div>

<div class="col-xs-12 col-md-5">
<div class="productdescription">

<h1><?php echo $queryproduct[0]['name'];?></h1>
<div class="price-panel">
<div class="price-replace">
<?php if($queryproduct[0]['discount']=='0'){?>
<div class="new-price"><?php echo $this->request->getsession()->read('currencysymbol');?><?php echo intval($queryproduct[0]['mrp']*$currencyrate[0][$this->request->getsession()->read('currency')]);?></div>
<?php } ?>
<?php if($queryproduct[0]['discount']!='0'){?>
<div class="new-price"><?php echo $this->request->getsession()->read('currencysymbol');?><?php echo intval($queryproduct[0]['price']*$currencyrate[0][$this->request->getsession()->read('currency')]);?></div>
<div class="old-price"><?php echo $this->request->getsession()->read('currencysymbol');?><?php echo intval($queryproduct[0]['mrp']*$currencyrate[0][$this->request->getsession()->read('currency')]);?></div>
<div class="discount"><?php echo $queryproduct[0]['discount'];?>% Off</div>
<?php
}
?>
<span>(Incl. of all taxes)</span>
</div>
<div class="wish-button">
<div class="add-to-wishlist" id="<?php echo $queryproduct[0]['mykey'];?>">
<?php if(!empty($wishadded)){ echo $this->Html->image('wishlist-fill.png'); } ?>
<?php if(empty($wishadded)){ echo $this->Html->image('wishlist-empty.png'); } ?>


</div>
</div>
</div>

<div class="clearfix"></div>
<?php echo $this->Form->create(null, array('id'=>'cart-submit-form','method'=>'post','url'=>array('controller'=>'products', 'action'=>'addcart')));?>
<input type="hidden" id="maxquantity" value="<?php echo $queryproduct[0]['stock'];?>">
<input type="hidden" id="mykey" name="mykey" value="<?php echo $queryproduct[0]['mykey'];?>">

<div class="quantity-panel">
<div class="quantity">
<span class="minus-btn"><i class="icon-minus">-</i></span>
<input id="qty" name="qty" type="text" value="1" readonly>
<span class="plus-btn"><i class="icon-plus">+</i></span>
</div>

<div class="product-share">
<p>
<?php echo $this->Html->link($this->Html->image('share-facebook.png'),'https://www.facebook.com/sharer.php?u=https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], array('escape' => false));?>
<?php echo $this->Html->link($this->Html->image('pinterest.png'),'https://pinterest.com/pin/create/button/?url=' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '&media=' . $_SERVER['HTTP_HOST'] . '/img/' . $queryproduct[0]['picture1'] . '&description=' . $queryproduct[0]['name'],array('escape' => false));?>
<?php echo $this->Html->link($this->Html->image('share-whatsapp.png'),'https://api.whatsapp.com/send?media='.$_SERVER['HTTP_HOST'].'/img/'.$queryproduct[0]['picture1'].'&description='.$queryproduct[0]['name'].'&text='.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], array('escape' => false));?>
</p>
</div>
<div class="share-button" onclick="toggleOpacity()"><?php echo $this->Html->image('share.png');?></div>
</div>
<?php
if($queryproduct[0]['stock']>1)
{
?>
<div class="cartbutton">
<button type="submit" class="cart-submit-button">Add to cart &#x2022; Rs. <?php echo $queryproduct[0]['price'];?></button>
</div>
<?php
}else{
	echo "Out of stock";
}
?>

<?php echo $this->Form->end();?>

<div class="clearfix"></div>

<div class="order-whatsapp"><?php echo $this->Html->link($this->Html->image('whatsapp.png').' Order By Whatsapp','https://wa.me/919351190805/?text=Meridio Luxury Fans I am Interested in %0A'.$queryproduct[0]['name'].'%0A', array('target'=>'_blank','escape' => false));?></div>


<div class="other-main-info">
<p>SKU <?php echo $queryproduct[0]['sku'];?></p>
<p>Color <?php echo $queryproduct[0]['color'];?></p>
<p class="ship-detail">Ships in : 3-4 Days</p>
</div>


<div class="clearfix"></div>
<p><strong>Product Summary</strong></p>
<?php echo nl2br($queryproduct[0]['description']);?>
<div class="clearfix"></div>


</div>
</div>
</div>
</div>
</div>



<div class="clearfix"></div>

<?php 
if ($querysimilarcollection->count() > 0) {
?>
<section class="new-collections visible-effect">
<div class="container">
<div class="row">
<h2 class="heading-animation">Similar Product</h2>
<div class="category">
<?php
foreach($querysimilarcollection as $product){
?>
<div class="product-box">
<div class="img-box">
<?php echo $this->Html->link($this->Html->image($product['picture1']), array('controller'=>'details', 'action' => 'detail',$product['url']), array('escape' => false));?>

<?php
$found='no';
foreach($querywishlists as $wishadded)
{
	if($product['mykey']==$wishadded['mykey']){ 
	$found='yes';
	}
}
?>	

<?php 
if($found=='yes')
{
?>
<div class="add-to-wishlist" id="<?php echo $product['mykey'];?>"><?php echo $this->Html->image('wishlist-fill.png');?></div>
<?php
}
else{
?>
<div class="add-to-wishlist" id="<?php echo $product['mykey'];?>"><?php echo $this->Html->image('wishlist-empty.png');?></div>

<?php
}
?>
</div>
<div class="product-summary">
<div class="name"><?php echo $this->Html->link($product['name'], array('controller'=>'details', 'action' => 'detail',$product['url']), array('escape' => false));?></div>
<div class="price"><div class="new-price">Rs. <?php echo $product['price'];?></div>	
<?php
if($product['discount']!='0'){
?>
<div class="old-price">Rs. <?php echo $product['mrp'];?></div>
<?php
}
?>

</div>
</div>
</div>
<?php
}
?>

</div>
</div>
</div>
</section>
<?php
}
?>

<div class="clearfix"></div>


<?php 
if ($querysimilarcategory->count() > 0) {
?>
<section class="new-collections visible-effect">
<div class="container">
<div class="row">
<h3 class="heading-animation">more from this category</h3>
<div class="category">
<?php
foreach($querysimilarcategory as $product){
?>
<div class="product-box">
<div class="img-box">
<?php echo $this->Html->link($this->Html->image($product['picture1']), array('controller'=>'details', 'action' => 'detail',$product['url']), array('escape' => false));?>
<?php
if($product['discount']!='0'){
?>
<span><?php echo $product['discount'];?>% Off</span>
<?php
}
?>
<?php
$found='no';
foreach($querywishlists as $wishadded)
{
	if($product['mykey']==$wishadded['mykey']){ $found='yes';}
}
?>	
<?php 
if($found=='yes')
{
?>
<div class="add-to-wishlist" id="<?php echo $product['mykey'];?>"><?php echo $this->Html->image('wishlist-fill.png');?></div>
<?php
}
else{
?>
<div class="add-to-wishlist" id="<?php echo $product['mykey'];?>"><?php echo $this->Html->image('wishlist-empty.png');?></div>
<?php
}
?>
</div>
<div class="product-summary">
<div class="name"><?php echo $this->Html->link($product['name'], array('controller'=>'details', 'action' => 'detail',$product['url']), array('escape' => false));?></div>

<?php
if($product['discount']!='0'){
?>
<div class="price">
<div class="new-price"><?php echo $this->request->getsession()->read('currencysymbol');?><?php echo intval($product['price']*$currencyrate[0][$this->request->getsession()->read('currency')]);?></div>
<div class="old-price"><?php echo $this->request->getsession()->read('currencysymbol');?><?php echo intval($product['mrp']*$currencyrate[0][$this->request->getsession()->read('currency')]);?></div>
</div>
<?php
}else{
?>
<div class="price">
<div class="new-price"><?php echo $this->request->getsession()->read('currencysymbol');?><?php echo intval($product['price']*$currencyrate[0][$this->request->getsession()->read('currency')]);?></div>
</div>	
<?php
}
?>
</div>
</div>
<?php
}
?>

</div>
</div>
</div>
</section>
<?php
}
?>


<div class="clearfix"></div>
<?php
if($this->request->getsession()->check('recentviewed') AND count($this->request->getsession()->read('recentviewed'))>0)
{
?>

<section class="new-collections visible-effect">
<div class="container">
<div class="row">
<h4 class="heading-animation">Recent Viewed</h4>
<div class="category">
<?php
foreach ($this->request->getsession()->read('recentviewed') as $product){
if(!empty($product[0]['picture'])){
?>
<div class="product-box">
<div class="img-box">
<?php echo $this->Html->link($this->Html->image($product[0]['picture']), array('controller'=>'details', 'action' => 'detail',$product[0]['url']), array('escape' => false));?>

<?php
$found='no';
foreach($querywishlists as $wishadded)
{
	if($product[0]['mykey']==$wishadded['mykey']){ $found='yes';}
}
?>	
<?php 
if($found=='yes')
{
?>
<div class="add-to-wishlist" id="<?php echo $product[0]['mykey'];?>"><?php echo $this->Html->image('wishlist-fill.png');?></div>
<?php
}
else{
?>
<div class="add-to-wishlist" id="<?php echo $product[0]['mykey'];?>"><?php echo $this->Html->image('wishlist-empty.png');?></div>
<?php
}
?>
</div>
<div class="product-summary">
<div class="name"><?php echo $this->Html->link($product[0]['name'], array('controller'=>'details', 'action' => 'detail',$product[0]['url']), array('escape' => false));?></div>
<div class="price">
<div class="new-price"><?php echo $this->request->getsession()->read('currencysymbol');?><?php echo intval($product[0]['price']*$currencyrate[0][$this->request->getsession()->read('currency')]);?></div>
</div>	
</div>
</div>
<?php
}
}
?>
</div>
</div>
</div>
</section>
<?php
}
?>
