<?php // BEGIN PHP
$tag = GETPOST('tag', 'alpha');
$cat_id = GETPOSTINT('cat');
$search = GETPOST('search_query', 'alpha');
// END PHP 
?>
<?php if (!empty($cat_id)) : ?>
  <?php
  $current_cat = new Categorie($db);
  $result = $current_cat->fetch($cat_id, "");
  if ($result <= 0) {
    redirectToContainer('404');
  }
  $current_cat_label = $current_cat->label;
  $current_cat_id = $current_cat->id;
  $parent_current_cat = new Categorie($db);
  $parent_current_cat->fetch($current_cat->fk_parent);
  $parent_current_cat_label = $parent_current_cat->label;
  $parent_current_cat_id = $parent_current_cat->id;
  ?>
  <section id="breadcrumb_section" contenteditable="true">
    <div class="breadcrumb clearfix">
      <a class="home" href="index.php" title="<?php print $weblangs->trans("backHome"); ?>"><i class="icon-home"></i></a>
      <span class="navigation-pipe">&gt;</span>
      <?php if (!empty($current_cat->fk_parent) && $parent_current_cat_id != getDolGlobalInt("MARKETPLACE_ROOT_CATEGORY_ID")) : ?>
        <a href="index.php?cat=<?php print $current_cat->fk_parent; ?>" title="<?php print $parent_current_cat_label; ?>" data-gg=""><?php print $parent_current_cat_label; ?></a>
        <span class="navigation-pipe">&gt;</span>
      <?php endif ?>

      <?php if ($current_cat_id == getDolGlobalInt("MARKETPLACE_ROOT_CATEGORY_ID")) : ?>
        <?php print $weblangs->trans("newProducts"); ?>
      <?php else : ?>
        <?php print $current_cat_label; ?>
      <?php endif ?>
    </div>
  </section>
<?php else : ?>
  <?php if (!empty($search) || !empty($tag)) : ?>
    <section id="breadcrumb_section" contenteditable="true">
      <div class="breadcrumb clearfix">
        <a class="home" href="index.php" title="<?php print $weblangs->trans("backHome"); ?>"><i class="icon-home"></i></a>
        <?php if (!empty($tag) && $tag == "Specials") : ?>
          <span class="navigation-pipe">&gt;</span> <?php print $weblangs->trans("priceDrop"); ?>
        <?php else : ?>
          <span class="navigation-pipe">&gt;</span> <?php print $weblangs->trans("Search"); ?>
        <?php endif ?>
      </div>
    </section>
  <?php endif ?>
<?php endif ?>
<!--  Breadcrumb  -->