<?php
//error_reporting(E_ALL);
//ini_set("display_errors", 1);
require('../head2Alts.php');

  if(  isset($_POST['shopid']) && isset($_POST['owniD']))
     {

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

?>

<center><table border="0" width="95%">
<tr>
	<td colspan="2" height="50px" valign="top">
		

	  <label id="main_title"><?php echo $shop['shopname'];?></label>

	</td>
 </tr>
 <tr>
 	<td colspan="2" height="80px" valign="top">
    <?php
    require_once('shopNavLink.php');
    ?>
 		<!--<ul id="lipad">
        
                <li>
                 <form action="selectedShopItemDetail.php" method="post">

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


                     <input class="hi" type="hidden" name="shopid"  value="<?php// echo $shop['shopid'];?>">

                    <input  class="spos" type="submit" value="<?php //echo $shop['shopname'];?>" name="post">

                 </form>

                </li>
                <li>
                 <form action="myShopIemListView.php" method="post">

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


                     <input class="hi" type="hidden" name="shopid"  value="<?php //echo $shop['shopid'];?>">

                    <input  class="spos" type="submit" value="My stock" name="post">

                 </form>

                </li>
              <li >
        
                <form action="newshopitempost.php" method="post">

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


                      <input class="hi" type="hidden" name="shopid"  value="<?php //echo $shop['shopid'];?>">

 

                      <input  class="spos" type="submit" value="New item" name="post">

                 </form>

          </li>

          <li>
        
                <form action="OrderToMyShop.php" method="post">

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


                      <input class="hi" type="hidden" name="shopid"  value="<?php //echo $shop['shopid'];?>">

 

                      <input  class="spos" type="submit" value="New order" name="post">

                 </form>

       </li>
        <li >
        
                <form action="shopWorkersProfile.php" method="post">

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


                      <input class="hi" type="hidden" name="shopid"  value="<?php //echo $shop['shopid'];?>">

 

                      <input  class="spos" type="submit" value="Workers" name="post"  >

                 </form>

       </li>
  </ul>-->

 		
 	</td>
 </tr>
<?php
 $shopid=$shop['shopid']; 
  ///////
$pm=$scon->getShopItemPrices($shopid,$ownID);

if($pm->rowCount()>0){
   $pim=$pm->fetchAll();
   ?>
    <ul>
    <?php
   foreach ($pim as $key => $pi) {
   $itemid=$pi['itemID'];
/// 
  
  $item=$scon->getThisItem($itemid);
  if($item->rowCount()>0){
   $it=$item->fetch(); 
	 
   $itemid=$it['itemid'];
   
   
   ?>
  <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="itemMoreDetailOtherIn.php" method="post">

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


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


                      <input class="hi" type="text" 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'] ?></b><br/>
				<img src="<?php echo $D['directory'] ?>" id="itemimage"><p/>
                <i><small>Posted:<?php echo $D['posteddate'] ?></small></i>
				</li>
		<?php
		 }
   	    
          }
   else
          {
             ?>
				<li> 
				No more images for the items!..<p/>
				</li>
		<?php
		 
          } 
		?>
		

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

                         <?php echo  $it['description'];?>

                 </form>
				 
		</td>
	</tr>
<?php
}
}
?>
</ul>
<?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!..";
}

 
 require_once('../footerIns.php');
?>