<center><h3><?=$title?></h3></center>
      <? if ($this-> session-> flashdata('message')): ?>
    <div class='warning'>
      <?=$this-> session-> flashdata('message');?>
    </div>
    <? endif; ?>
                  <div class="subcolumns">
        <div class="c50l">
          <div class="subcl">
    <h4><?=anchor("admin/categories/add_product", 'Προσθήκη νέου προϊόντος')?></h4>
    <h4><?=anchor("admin/categories/export_product_price", 'Export products/price in excel')?></h4>
              </div>
        </div>
        <div class="c50r">
          <div class="subcr">
<? $attributes=array('class'=>'search-form', 'autocomplete'=>'off');?>
<? $data = array("name" => "term", "id" => "term", "maxlength" => "128", 'id'=>'masthead-search-term', 'class'=>'search-term');?>
<div id="masthead-search">
	<?=form_open("admin/categories/search_prd",$attributes); ?>
    <?="Αναζήτηση Προϊόντων"?>
    <?=form_input($data);?>
    <input id="submit" type="submit" value="Search" name="submit" class="yt-button yt-button-primary"/>
	<?=form_close();?>
</div>
    </div>
  </div>
</div>
<br />
<? if ($search==false) { ?>
<? if ($products) { ?>
    <table cellspacing="0" cellpadding="0" border="1" class="full">
      <thead>
        <tr>
          <th colspan="100%" scope="col">Current Content</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="col">Εικόνα</th>
          <th scope="col">Όνομα</th>
          <th scope="col">Κατηγορία</th>
          <th scope="col">Ενέργειες</th>
     </tr>
        <? foreach($products as $products=>$product){ ?>
        <? //$company_details = $this->MAdmins->getHotelDetailsUnique($hotel['h_id']); ?>
        <? $categories = $this->MAdmins->getProductCategories($product['p_id']); ?>
        <? $subcategories = $this->MAdmins->getProductSubCategories($product['p_id']); ?>
        <tr>
          <td><a  title="<?=$product['name']?>"  href="<?=base_url().'images/prds/'.$product['image']?>" rel="shadowbox[];options={counterType:'skip',continuous:true,animSequence:'sync'}"> <img class="center" src="<?=base_url().'images/prds/thumb/'.$product['image']?>" style="max-width:120px; max-height:200px;" /> </a></td>
          <td><?=$product['name']?></td>
          <td><? foreach($categories as $categories=>$category){ ?>
           <? $category_name = $this->MAdmins->getCategoryName($category['cat_id'], 1); ?>
		  <? if ($category_name) { ?><?=$category_name['cat_name']?><br /><? } ?>
          <? } ?><? if ($subcategories) { ?>
          <? foreach($subcategories as $subcategories=>$subcategory){ ?>
           <? $subcategory_name = $this->MAdmins->getSubCategoryName($subcategory['subcat_id'], 1); ?>
		 <? if ($subcategory_name) { ?> <?=$subcategory_name['name']?><br /><? } ?>
          <? } }?></td>
          <td><?=anchor("admin/categories/view_product/".$product['p_id'], 'Προβολή προϊόντος')?><br /><?=anchor("admin/categories/delete_product/".$product['p_id'],  'Διαγραφή εγγραφής', array( 'onclick'=>'return confirm(\''.'Είστε σίγουροι πως θέλετε να προχωρήσετε στη διαγραφή?'.'\');', 'title' => '','class' => ''))?></td>
       </tr>
       <? } ?>
      </tbody>
    </table>
<?    } ?>
<? } elseif ($search==true) { ?>
<? if ($products) { ?>
    <table cellspacing="0" cellpadding="0" border="1" class="full">
      <thead>
        <tr>
          <th colspan="100%" scope="col">Current Content</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="col">Εικόνα</th>
          <th scope="col">Όνομα</th>
          <th scope="col">Κατηγορία</th>
          <th scope="col">Ενέργειες</th>
     </tr>
        <? foreach($products as $products=>$product){ ?>
        <? //$company_details = $this->MAdmins->getHotelDetailsUnique($hotel['h_id']); ?>
        <? $categories = $this->MAdmins->getProductCategories($product['p_id']); ?>
        <? $subcategories = $this->MAdmins->getProductSubCategories($product['p_id']); ?>
        <tr>
          <td><a  title="<?=$product['name']?>"  href="<?=base_url().'images/prds/'.$product['image']?>" rel="shadowbox[];options={counterType:'skip',continuous:true,animSequence:'sync'}"> <img class="center" src="<?=base_url().'images/prds/thumb/'.$product['image']?>" style="max-width:120px; max-height:200px;" /> </a></td>
          <td><?=$product['name']?></td>
          <td><? foreach($categories as $categories=>$category){ ?>
           <? $category_name = $this->MAdmins->getCategoryName($category['cat_id'], 1); ?>
		  <?=$category_name['cat_name']?><br />
          <? } ?><? if ($subcategories) { ?>
          <? foreach($subcategories as $subcategories=>$subcategory){ ?>
           <? $subcategory_name = $this->MAdmins->getSubCategoryName($subcategory['subcat_id'], 1); ?>
		  <?=$subcategory_name['name']?><br />
          <? } }?></td>
          <td><?=anchor("admin/categories/view_product/".$product['p_id'], 'Προβολή προϊόντος')?><br /><?=anchor("admin/categories/delete_product/".$product['p_id'],  'Διαγραφή εγγραφής', array( 'onclick'=>'return confirm(\''.'Είστε σίγουροι πως θέλετε να προχωρήσετε στη διαγραφή?'.'\');', 'title' => '','class' => ''))?></td>
       </tr>
       <? } ?>
      </tbody>
    </table>
<?    } ?>
<? } ?>