Jump to content

Changing positions of Subcategories in Search Result


Recommended Posts

Hi Community,

 

today i got a wired problem i spent a lot of time to solve but didn`t get it.

 

I try to describe as good as possible. Presta Version 1.5.5

 

I included the subcategory view in the bottom of the Category.tpl. This worked great.

If you in the home of the shop it spawns a Subcategory view at the bottom of the page as expected.

 

I use a module for filter. If i get back the filtered / searched results the Subcategory view now spawns at the top of the list. I asked the developer of the module where to change that. There is a section within the module i can change the result.tpl from that module. Changes are affecting everything except the position of the Subcategory view. Still is on top.

 

I guess this is because the result spawns in the categorie.tpl.

 

Any Ideas on how to get this work? The need is to always spawn the Subcategory view in the bottom.

 

I post the two main code sections here and mark the parts grey in order to better understanding for you.

___________________________________________

category.tpl from the /themes/default

___________________________________________

 

{include file="$tpl_dir./breadcrumb.tpl"}
{include file="$tpl_dir./errors.tpl"}

{if isset($category)}
    {if $category->id AND $category->active}
        <h1>
            {strip}
                {$category->name|escape:'htmlall':'UTF-8'}
                {if isset($categoryNameComplement)}
                    {$categoryNameComplement|escape:'htmlall':'UTF-8'}
                {/if}
            {/strip}
        </h1>
        {if $category->id > 2}
        <div class="resumecat category-product-count">
            {include file="$tpl_dir./category-count.tpl"}
        </div>
        {/if}
        
        {if $scenes || $category->description || $category->id_image}
        <div class="content_scene_cat">
            {if $scenes}
                <!-- Scenes -->
                
            {else}
                <!-- Category image -->
                {if $category->id_image}
                <div class="align_center">
                    <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" />
                </div>
                {/if}
            {/if}

            {if $category->description}
                <div class="cat_desc">
                {if strlen($category->description) > 120}
                    <p id="category_description_short">{$category->description|truncate:120}</p>
                    <p id="category_description_full" style="display:none">{$category->description}</p>
                    <a href="#" onclick="$('#category_description_short').hide(); $('#category_description_full').show(); $(this).hide(); return false;" class="lnk_more">{l s='More'}</a>
                {else}
                    <p>{$category->description}</p>
                {/if}
                </div>
            {/if}
        </div>
        {/if}
                    
            {include file="./product-list.tpl" products=$products}
            {if $products}
            <div class="content_sortPagiBar">
                <div class="sortPagiBar clearfix">
                    {include file="./product-sort.tpl"}
                    {include file="./product-compare.tpl"}
                    {include file="./nbr-product-page.tpl"}
                </div>
            
            </div>
                {include file="./pagination.tpl"}
            
        {/if}
        {if isset($subcategories)}
        <!-- Subcategories -->
        <div id="subcategories">
            <h3>{l s='Subcategories'}</h3>
            <ul class="inline_list">
            {foreach from=$subcategories item=subcategory}
                <li class="clearfix">
                    <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}" class="img">
                        {if $subcategory.id_image}
    <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html'}" alt="{if $subcategory.description}{$subcategory.description}{/if}" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{else}
    <img src="{$img_cat_dir}default-medium_default.jpg" alt="{if $subcategory.description}{$subcategory.description}{/if}" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{/if}

                    </a>
                    <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" class="cat_name">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>
                    {if $subcategory.description}
                        <p class="cat_desc">{$subcategory.description}</p>
                    {/if}
                
                </li>
            {/foreach}
            </ul>
            <br class="clear"/>
        </div>
        {/if}

        {elseif $category->id}
        <p class="warning">{l s='This category is currently unavailable.'}</p>
    {/if}
{/if}
___________________________________________

 

___________________________________________

pm_advancedsearch_result.tpl from the /themes/default

___________________________________________

 

<div id="PM_ASearchResults">
<div id="PM_ASearchResultsInner" class="PM_ASearchResultsInner_{$as_searchs.0.id_search}">

{if isset($css_files_result_search)}
    {foreach from=$css_files_result_search key=css_uri item=media}
    <link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" />
    {/foreach}
{/if}
{if isset($js_files_result_search)}
    {foreach from=$js_files_result_search item=js_uri}
    <script type="text/javascript" src="{$js_uri}"></script>
    {/foreach}
{/if}
{if !isset($smarty.request.keep_category_information) || !$smarty.request.keep_category_information}
    {if isset($as_seo_title)}
        {capture name=path}{$as_seo_title|escape:'htmlall':'UTF-8'}{/capture}
    {else}
        {capture name=path}{$as_searchs.0.title|escape:'htmlall':'UTF-8'}{/capture}
    {/if}
    {include file="$tpl_dir./breadcrumb.tpl"}
{/if}
{include file="$tpl_dir./errors.tpl"}

{if isset($as_searchs[0])}
    {if $as_searchs.0.id_search AND $as_searchs.0.active}
        {if isset($as_seo_title)}
            <h1 id="PM_ASearchResultsTitle">{strip}{$as_seo_title|escape:'htmlall':'UTF-8'}{/strip}</h1>
            {if $as_seo_description}
                <div class="cat_desc">{$as_seo_description}</div>
            {/if}
        {else}
            {if !isset($smarty.request.keep_category_information) || !$smarty.get.keep_category_information}
                {strip}
                <h1 id="PM_ASearchResultsTitle">{$as_searchs.0.title|escape:'htmlall':'UTF-8'}</h1>
                {if $as_searchs.0.description}
                    <div class="cat_desc">{$as_searchs.0.description}</div>
                {/if}
                <div class="nb_results">
                    <strong>
                    {if $as_searchs.0.total_products == 0}{l s='There is no product.' mod='pm_advancedsearch4'}
                    {else}
                        {if $as_searchs.0.total_products == 1}{l s='There is' mod='pm_advancedsearch4'}{else}{l s='There are' mod='pm_advancedsearch4'}{/if} 
                        {$as_searchs.0.total_products|intval} 
                        {if $as_searchs.0.total_products == 1}{l s='product.' mod='pm_advancedsearch4'}{else}{l s='products.' mod='pm_advancedsearch4'}{/if}
                    {/if}
                    </strong>
                </div>
                {/strip}
            {/if}
        {/if}
        {include file="$tpl_dir./errors.tpl"}
        {if $as_searchs.0.remind_selection == 3 OR $as_searchs.0.remind_selection == 1}
            {include file=$as_obj->_getTplPath("pm_advancedsearch_selection_results.tpl")}
        {/if}
        {if $as_searchs.0.products}
            {assign var='tplCompareExists' value="$tpl_dir./product-compare.tpl"|file_exists}
            {if $tplCompareExists}
                {include file="$tpl_dir./product-compare.tpl"}
            {/if}
            {include file="$tpl_dir./product-sort.tpl"}
            {include file="$tpl_dir./product-list.tpl" products=$as_searchs.0.products}

            {if $tplCompareExists}
                {include file="$tpl_dir./product-compare.tpl"}
            {/if}
            {include file="$tpl_dir./pagination.tpl"}
        {else}
            <p class="warning">{l s='There are no result.' mod='pm_advancedsearch4'}</p>
        {/if}
        {if isset($as_cross_links) && $as_cross_links && sizeof($as_cross_links)}
            <br />
            <br />
            <div id="PM_ASearchSeoCrossLinks" class="block">
                <h4>{l s='See also' mod='pm_advancedsearch4'}</h4>
                <div class="block_content">
                    <ul class="bullet">
                    {foreach from=$as_cross_links item=as_cross_link}
                        <li><a href="{$base_dir}{$lang_iso}/s/{$as_cross_link.id_seo|intval}/{$as_cross_link.seo_url|escape:'htmlall':'UTF-8'}">{$as_cross_link.title|escape:'htmlall':'UTF-8'}</a></li>
                    {/foreach}
                    </ul>
                </div>
            </div>
        {/if}
    {/if}
    {if $as_searchs.0.share}
    <div class="clear"></div>
    <a href="javascript:void(0);" class="button_large" id="pm_share_link"><b>{l s='Share this results' mod='pm_advancedsearch4'}</b></a><br />
    <input type="hidden" name="ASSearchUrl" id="ASSearchUrl" value="{$ASSearchUrl}" />
    <input type="hidden" name="ASSearchTitle" id="ASSearchTitle" value="{$as_searchs.0.title|escape:'htmlall':'UTF-8'}" />
    <div class="asShareBlock" id="asShareBlock">

    </div>
    {/if}
    <script type="text/javascript">
    if(typeof(ASParams[{$as_searchs.0.id_search|intval}]) == 'undefined') {ldelim}
        ASParams[{$as_searchs.0.id_search|intval}] = {ldelim}
            'keep_category_information' : 0,
            'search_results_selector'    : '{$as_searchs.0.search_results_selector}',
            'insert_in_center_column'    : '{$as_searchs.0.insert_in_center_column}',
            'seo_criterion_groups'        : '{if isset($as_searchs.0.seo_criterion_groups) && is_array($as_searchs.0.seo_criterion_groups)}{","|implode:$as_searchs.0.seo_criterion_groups}{/if}',
            'as4_productFilterList'        : '{if isset($as4_productFilterList) && !empty($as4_productFilterList)}{$as4_productFilterList}{/if}',
            'scrollTopActive'            : {if isset($as_searchs.0.scrolltop_active) && $as_searchs.0.scrolltop_active}true{else}false{/if}
        {rdelim};
    {rdelim}
        $jqPm('#asShareUrl').unbind('click').click(function() {ldelim}$jqPm(this).select();{rdelim});
        initSearch({$as_searchs.0.id_search|intval},{$as_searchs.0.search_method|intval},{$as_searchs.0.step_search|intval},{$as_searchs.0.dynamic_criterion|intval});
    </script>
{/if}

</div>
</div>
 

___________________________________________

 

Maybe i need to place the Subcategory view section somewhere else.

 

So thanx a lot!!!

Greetz

SM5K

 

Link to comment
Share on other sites

×
×
  • Create New...