<?php
if ($parentId == false)
{
    $title = $breadcrumbs[0]['title'] . " купить в Уфе, бесплатная доставка по РБ";
    $desc = "Купить " . $breadcrumbs[0]['title'] . " в Уфе. Широкий выбор, более " . $productCount . " видов. Бесплатная доставка. Привлекательные цены.";
}
else
{
    try
    {
        $morphy = new phpMorphy(sfConfig::get('sf_data_dir') . '/phpmorphy_vocabulary', 'ru_ru', array('storage' => PHPMORPHY_STORAGE_FILE));
    } catch(phpMorphy_Exception $e)
    {
        die('Error occured while creating phpMorphy instance: ' . $e->getMessage());
    }

    $rod = $morphy->castFormByGramInfo(mb_strtoupper($breadcrumbs[1]['title']), null, array('МН', 'РД'), true);

    $title = $breadcrumbs[0]['title'] . " " . mb_strtolower($breadcrumbs[1]['title']) . " купить в Уфе, бесплатная доставка по РБ";
    $desc = "Купить " . $breadcrumbs[0]['title'] . " в Уфе. Широкий выбор " . mb_strtolower($rod[0]) . ". Бесплатная доставка. Привлекательные цены.";
}
slot('default_meta_description', $desc);
slot('title', $title);
?>

<div class="er_rows" style="padding-bottom: 0;">
    <div class="breadcrumbs">
        <div class="breadcrumbs">
            <span><a href="/" title="Главная">Главная</a>&nbsp;/&nbsp;</span><!--
         --><span><a href="<?php echo url_for('@catalog') ?>">Каталог</a></span><!--
         --><?php

            if ($breadcrumbs)
            {
                $lastBreadcrumbsCounter = 1;
                foreach ($breadcrumbs as $crumb)
                {
                    if ($crumb['title'] && $crumb['id'])
                    {
                        if ($lastBreadcrumbsCounter == count($breadcrumbs))
                        {
                            echo '<span>&nbsp;/&nbsp;' . Page::niceTitleView($crumb['title']) . '</span>';
                        }
                        else
                        {
                            echo '<span>&nbsp;/&nbsp;<a href="' . url_for('@catalog_show_cat?alias=' . $crumb['alias']) . '">' . Page::niceTitleView($crumb['title']) . '</a></span>';
                        }
                    }
                    $lastBreadcrumbsCounter++;
                }
            }

            ?>

            <div>
                <h1 style="margin-bottom: 10px"><?php echo Page::niceTitleView($breadcrumbs[0]['title']) ?></h1>
            </div>

        </div>

        <?php
        if ($parentId)
        {
            include_component('catalog', 'catChildren', array('parentId' => $parentId));
        }
        else
        {
            include_component('catalog', 'catChildren', array('parentId' => $cat_id));
        }
        ?>

        <style type="text/css">
            .er_content__main__search{display: block;}
            .js_cat_view__ct__tr td {
                height: 99px !important;
            }
        </style>
    </div>
</div>


<div class="pl_20">
    <div class="catalog-item-sorting__new">
        <a href="<?php echo url_for('@catalog_show_cat?alias=' . $alias) ?>?sort=title&order=<?php echo $order == 'asc' ? 'desc' : 'asc' ?>&inPage=<?php echo $inPage ?>" class="<?php echo $sort == 'title' ? 'sort_selected sort_' . $order : '';  ?>" rel="nofollow">по алфавиту</a>
        <a href="<?php echo url_for('@catalog_show_cat?alias=' . $alias) ?>?sort=price&order=<?php echo $order == 'asc' ? 'desc' : 'asc' ?>&inPage=<?php echo $inPage ?>" class="<?php echo $sort == 'price' ? 'sort_selected sort_' . $order : '';  ?>" rel="nofollow">цене</a>
        <a href="<?php echo url_for('@catalog_show_cat?alias=' . $alias) ?>?sort=product_code&order=<?php echo $order == 'asc' ? 'desc' : 'asc' ?>&inPage=<?php echo $inPage ?>" class="<?php echo $sort == 'product_code' ? 'sort_selected sort_' . $order : '';  ?>" rel="nofollow">артикулу</a>
    </div>
</div>
<div style="position:absolute;right:20px;margin-top:-17px;">

    <?php

    $div_active = "";
    $td_active  = "";
    if ($view_type == "table")
    {
        $td_active = "viewtype_td_active";
    }

    if ($view_type == "block")
    {
        $div_active = "viewtype_div_active";
    }

    ?>

    <div class="viewtype viewtype_div <?php echo $div_active ?>">
        <a href="<?php echo url_for('@catalog_show_cat?alias=' . $alias) ?>?view=block"></a>
    </div>
    <div class="viewtype viewtype_td <?php echo $td_active ?>">
        <a href="<?php echo url_for('@catalog_show_cat?alias=' . $alias) ?>?view=table"></a>
    </div>
</div>