(<?php
require('../headers.php');

  if(isset($_POST['shopid']))
     {
    
 $shopid=$_POST['shopid'];
 
 $getS=$scon->getSelectedShopOther($shopid);
 if ($getS->rowCount()>0) {
  $shop=$getS->fetch();
 $ownID=$shop['ownerid'];
?>

<center><table border="0" width="80%">
<tr>
	<td colspan="2" height="190px" align="center" valign="center">
		

	 <b>  <form action="shopShelf.php" method="post">
                 <!--<form action="selectedShopItemDetailout.php" method="post">-->
 
                     <input class="hi" type="hidden" name="shopid"  value="<?php echo $shop['shopid'];?>">

                <input class="hi" type="hidden" name="owniD"  value="<?php echo $shop["ownerid"];?>">
                    <input  class="pos" type="submit" value="<?php echo $shop['shopname'];?>" name="post"  >

                 </form> 
     <i>(Contact:
	  <?php echo $shop['phoneno'];?>)</i> 
	  </b>

	</td>
 </tr>
  <tr>
  <td colspan="2">
<ul>
  <li style="padding-right:3%;">
  <label id="lab"><a  href="defaultShopingCenter.php">Shop view</a></label> 
  </li>
<li style="padding-right:55%;">
  <label id="lab"><a  href="buda_shoping_centerout.php">Shop detail view</a></label> 
</li>
 
  <li>

  <label id="lab"><a  href="itemViewOut.php">Item view</a></label> 
 </li>
</ul>
</td>
</tr>
 <tr>
  <td colspan="2" align="center">
    
      <form action="selectedShopItemDetailout.php" method="post">

            <label id="search_lab">
                       <i>
                          Search shop item here:-
                      </i> 
             </label>
                      <input type="text" class="hotel_info" height="25px" name="searchValue" id="searchValue" onkeyup ="submision()">
                       <input type="hidden"   name="shopid" id="shopid" value="<?php echo $shop['shopid'];?>">
                       <input type="hidden"   name="owniD" id="owniD" value="<?php echo $shop['ownerid'];?>" >


                      <input class="subs" type="submit" value="Search" name="search" id="search" ><br>
                      <i>You can search by name or category or description..</i>
            
      </form>
     
      <div  id="result" >
       <?php
      if(isset($_POST['search']))
        {

        $searchValue=$_POST['searchValue'];
       if ($searchValue!=""){
         require_once('searchThisShopItem.php');
        } 
      }
        ?>
      </div>
  </td>

</tr>
<?php

$pm=$scon->getShopItemPrices($shopid,$ownID);

if($pm->rowCount()>0){
   $pim=$pm->fetchAll();
   foreach ($pim as $key => $pi) {
   $itemid=$pi['itemID'];
$item=$scon->getThisItem($itemid);
if($item->rowCount()>0){
   $it=$item->fetch(); 
	  
   
   
   ?>
  <tr>
		<td width="20%" height="auto" valign="top" align="center">
		<b><?php echo  $it['itemname'];?> profile image</b><p/>
		 
	       
					<img src="<?php echo $it['profileimages']; ?>" width="100%" id="pic">
		 
     
		</td>


		<td width="80%" valign="top"   align="justify">
			
            <b><?php echo  $it['itemname'];?></b>
                <p/>  

             <form id="order" action="../home.php" method="post">

                      <!--<input class="hi" type="text" name="owniD"  value="<?php// echo $ownID;?>">-->


                      <input class="hi" type="hidden" name="shopid"  value="<?php echo $shopid;?>">


                      <input class="hi" type="hidden" name="itemid"  value="<?php echo $it['itemid'];?>">

 
                    
                      <input  id="item" type="submit" value="Order Now" name="post"><b>Price: <?php echo $pi['currency']. $pi['price'];?></b>

                 </form>
 

                       <b>Other images</b><p/>
		            <?php
	   $profile=$it['profileimages'];
	   $itD=$scon->getThisItemImage($shopid,$itemid,$profile);
       if ($itD->rowCount()>0)
         {
   	        $itmD=$itD->fetchAll();
			?>
			<ul style="padding-top:0%">
			<?php
        foreach ($itmD as $key => $D)
         {
	 

	     ?>
				<li style="padding-top:0%; text-align:top; padding-left:0%;">
				<b><?php echo $D['imagename'] ?><br/>
				<img src="<?php echo $D['directory'] ?>" id="itemimage"><p/>
                <i><small>Posted:<?php echo $D['posteddate'] ?></small></i></b>
				</li>
		<?php
		 }
   	    
          }
   else
          {
             ?>
				<li> 
				No more images for the items!..<p/>
				</li>
		<?php
		 
          } 
		?>
		</ul>

                         <b>Description</b><p/>

                        <label style="font-size:12px;"> <?php echo  $it['description'];?></label>

                 </form>
				 
		</td>
	</tr>
<?php
 
}
 
}
}
 else
{
  ?>
  <tr>
    <td colspan="2">
    Item not yet uploaded!..
      
    </td>
  </tr>
  <?php
}
?>
</table> </center>

<?php
}
else{
	echo "NETWORK ERROR!..";
    }
}
 else
{
 	 echo "Some thing went wrong while processi the page!..";
}

?>
<script>

  function submision(){
    
    var searchValue=$('#searchValue').val();

    var shopid=$('#shopid').val();
    var ownID=$('#owniD').val();
    $('#result').empty();
    $.post('searchThisShopItem.php',{searchValue:searchValue,shopid:shopid,owniD:ownID},function(data){
      $('#result').html(data);

    });
  }
</script>
<?php
require_once('../footers.php');
?> 