<table width="770" align="left" style="padding-left:10px;"><tr height="10"><td></td></tr><tr><td align="left">
<link rel="stylesheet" type="text/css" href="catalog/template/beststoreitems/css/general.css" />

<script>
 function sort_by()
 {
 	var sort_by=$("#sort_by").val();
 	location='https://www.beststoreitems.com/index.php?controller=gallery&path=<?php echo $path?>&sort_by='+sort_by;
 }
</script>
<style type="text/css">
.reviews{
	height:30px;
	line-height:27px;
}
.reviews a{
	color:gray;
    font-weight: normal;
    text-decoration: underline;
}
.reviews a:hover {
    color: #FF5A00;
    text-decoration: none;
}
<!--
     .highlight1 {
	 	background-color:#FFFFFF;
	 }	
     #page_box {
	 	width:28px;
		height:16px;
		vertical-align:middle;
		TEXT-ALIGN:center;
	 	background-color:#F0F0F0;
        BORDER-RIGHT: #555 1px solid;
		BORDER-TOP: #555 1px solid; 
		BORDER-LEFT: #555 1px solid;
		BORDER-BOTTOM: #555 1px solid;	
	 } 
	 #page_box A {
	 	 COLOR: #000; 
		 TEXT-ALIGN:center;
		 text-decoration:none;
		 font-weight:bolder;
		 font-size:12px;
	 } 
	 #page_box A:hover {
	     COLOR: #F00;  
		 text-decoration:none;
		 font-weight:bolder;
		 font-size:12px;
		 background-color:#ffffff;
	 }
-->
</style>

<div style="border:1px solid #CCCCCC; background:#F8EEE2; height:80px; padding:10px;">
	<div class="heading"><?php echo $heading_title; ?></div>
	<div class="breadcrumb">
	  <?php foreach ($breadcrumbs as $breadcrumb) { ?>
	  <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
	  <?php } ?>	
	</div> 
	 <span style="float:right;">
	    <label><a href="index.php?controller=showall&path=<?php echo $path?>&amount=98"><img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/showall_1.gif" style="vertical-align:middle"></a></label>&nbsp;&nbsp;
	    <label ><a href="index.php?controller=list&path=<?php echo $path?>" style="color:#999999;"><img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/thing_ico_1.gif" style="vertical-align:middle"></a></label>&nbsp;&nbsp;
	    <label ><a href="index.php?controller=category&path=<?php echo $path?>" style="color:#999999;"><img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/thing_ico_2.gif" style="vertical-align:middle"></a></label>&nbsp;&nbsp;
	    <label ><img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/thing_ico_6.gif" style="vertical-align:middle"></label>&nbsp;&nbsp;&nbsp;
	    Sort by:
	    <select name="sort_by" id="sort_by" onchange="sort_by()">
	      <option value="1"<?php if($sort_by==1) echo 'selected'?>>Bestselling</option>
	      <option value="2"<?php if($sort_by==2) echo 'selected'?>>Price:lowest first</option>
	      <option value="3"<?php if($sort_by==3) echo 'selected'?>>Price:highest first</option>
	    </select>
	 </span>
</div>
<br><br>
<?php if ($categories) { ?>
<?php foreach ($categories as $category) { ?>
<div class="categories" style="height:180px;"><a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" title="<?php echo $category['name']; ?>" alt="<?php echo $category['name']; ?>" /></a><br />

  <a href="<?php echo $category['href']; ?>"><strong><?php echo $category['name']; ?></strong></a></div>

<?php } ?>

<?php } ?>

<?php if ($products) { ?>

<?php if ($categories) { ?>

<div class="heading"><?php echo $text_product; ?></div>

<?php } ?>



</td></tr><tr><td align="left">

<table width="700">

        <tr><td align="left"><?php echo $text_results; ?></td>

        <td align="right">

        

    <form action="<?php echo $action; ?>" method="post" name="pageform" enctype="multipart/form-data">

    <input type="hidden" name="page" value="1" />

    <script language="javascript" defer="defer">

		 function SelectPage(page)

		 {

		    document.pageform.page.value = page;

		 	document.pageform.submit();

			return false;

         };

	</script>

      <table cellspacing="8px" cellpadding="0" hspace="0" vspace="0">

        <tr>

        <?php if ($page>1) { ?>

        <td id="page_box"><a href="#" onclick="return SelectPage(<?php echo ($page-1); ?>);"><?php echo '<<'?></a></td>

        <?php };
        foreach ($pages as $pageentry) {   

                if ( $pageentry['value'] > ($page + max(9-$page,4)) ) {?>

                           <td id="page_box"><a href="#" onclick="return SelectPage(<?php echo ($page+1); ?>);"><?php echo '>>'?></a></td>

                <?php 

                     break;

                 } ;

                

                if ( $pageentry['value'] < ($page - 4) ) {continue; }

                ?>

                                          

                <?php if ($pageentry['value'] == $page) { ?>

                <td width="20" height="16" align="center" valign="middle"><b><font color="#555555;"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></font><B></td>

                <?php } else { ?>

                <td id="page_box" >

                <a href="#" onclick="return SelectPage(<?php echo $pageentry['value']; ?>);"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></a></td>

                <?php } ?>   

        <?php } ?>
        <td>Go to page
        	<select onchange="return SelectPage(this.value)">
        		<?php foreach ($pages as $pageentry){?>
        			<option value="<?php echo $pageentry['value']?>" <?php if ($pageentry['value'] == $page){echo 'selected';}?>><?php echo $pageentry['value']?></option>
        		<?php };?>
        	</select>
        </td>
      </tr></table>

    </form>

</td></tr></table>



</td></tr><tr><td  align="left">

<div style="width:100;float:left;clear:both;"></div>

<div class="B_Categories Gallery_pic">
     <ul>     
      <?php foreach ($products as $product) { ?>
         <li class="goods_list box_shadow">
            <div class="goods_picture"> <div></div>	      
            <a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>"><img  width="230" alt="<?php echo $product['name']; ?>" src="<?php echo $product['thumb']; ?>"></a></div>
            <strong class="goods_name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></strong>
            <span class="Reference_Price"><span class="red fontbold"><?php echo $product['price']; ?></span><label style="color:blue;">(Sold:&nbsp;<?php if($product['sold']==1) {echo $product['sold'].' '.'pc';} else{echo $product['sold'].' '.'pcs';} ?>)</label></span>
            <div class="list_stars">
                 <?php if($product['reviews_count']>0){?>
	       <span> 
	         	<?php if($product['reviews_rating']/$product['reviews_count'] == 1){?>
		      		<img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/stars_1.gif" />
		      		<a href="<?php echo $product['href']; ?>#cmt" rel="nofollow"><?php echo $product['reviews_count']?> reviews</a>
		  		<?php }elseif ($product['reviews_rating']/$product['reviews_count'] == 2){?>
		  			<img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/stars_2.gif" />
		  			<a href="<?php echo $product['href']; ?>#cmt" rel="nofollow"><?php echo $product['reviews_count']?> reviews</a>
		  		<?php }elseif ($product['reviews_rating']/$product['reviews_count'] == 3){?>
		  			<img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/stars_3.gif" />
		  			<a href="<?php echo $product['href']; ?>#cmt" rel="nofollow"><?php echo $product['reviews_count']?> reviews</a>
		  		<?php }elseif ($product['reviews_rating']/$product['reviews_count'] == 4){?>
		  			<img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/stars_4.gif" />
		  			<a href="<?php echo $product['href']; ?>#cmt" rel="nofollow"><?php echo $product['reviews_count']?> reviews</a>
		  		<?php }else {?>
		  			<img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/stars_5.gif" />
		  			<a href="<?php echo $product['href']; ?>#cmt" rel="nofollow"><?php echo $product['reviews_count']?> reviews</a>
		  		<?php }?>
	       </span>
	       <?php } else{?>
	        <span> 
	        <img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/stars_0.gif" />
		      		<a href="<?php echo $product['href']; ?>#cmt" rel="nofollow">0 reviews</a>
	        </span> 
	        <?php }?>
	       <?php if($product['quantity']==0){?>
	  	       <span style="position:relative;top:-190px; margin-right:34px;"><img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/soldout_pending.jpg"></span>
	       <?php }?>
             </div>
         </li>   
      <?php }?>      
     </ul>
     <div class="hei20"></div>
   </div>
</td></tr><tr><td  align="left">

    

      

      <br />



     <table width="700">

            <tr><td align="left"><?php echo $text_results; ?></td>

            <td align="right">

          <table cellspacing="8px" cellpadding="0" hspace="0" vspace="0">

            <tr>

            <?php if ($page>1) { ?>

            <td id="page_box"><a href="#" onclick="return SelectPage(<?php echo ($page-1); ?>);"><?php echo '<<'?></a></td>
            <?php };

            foreach ($pages as $pageentry) {   

                    if ( $pageentry['value'] > ($page + max(9-$page,4)) ) {?>

                               <td id="page_box"><a href="#" onclick="return SelectPage(<?php echo ($page+1); ?>);"><?php echo '>>'?></a></td>

                    <?php 

                         break;

                     } ;

                    

                    if ( $pageentry['value'] < ($page - 4) ) {continue; }

                    ?>

                                              

                    <?php if ($pageentry['value'] == $page) { ?>

                    <td width="20" height="16" align="center" valign="middle"><b><font color="#555555"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></font><B></td>

                    <?php } else { ?>

                    <td id="page_box" >

                    <a href="#" onclick="return SelectPage(<?php echo $pageentry['value'];?>)"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></a></td>

                    <?php } ?>   

            <?php } ?>
			<td>Go to page
	        	<select onchange="return SelectPage(this.value)">
	        		<?php foreach ($pages as $pageentry){?>
	        			<option value="<?php echo $pageentry['value']?>" <?php if ($pageentry['value'] == $page){echo 'selected';}?>><?php echo $pageentry['value']?></option>
	        		<?php };?>
	        	</select>
	        </td>
          </tr></table>

    </td></tr></table>

              <br /><br />

              

<?php } ?>

</td></tr></table>
<a href="#" rel="bb"></a>
