Jump to content

Custom category page or another trick.


Recommended Posts

Hi everyone,

 

I use prestashop_new theme + many customizing modification. Now I need display special category page. For all product-list i use only product view but for this one I need show:

 

1. for parrent category-> subcategories images

2. for subcategories-> standard product-list.

 

Ok, this is example what I mean:

https://www.mrporter.com/whattowear

 

I have two ideas:

 

maybe i can display subcategories images only when products inside parrent category don't extist

 

or

 

get custom_category.tpl to category with special id

 

This solusion works but show subcategories image on all of page, even subcategories image doesn't add.

and show product from parrent category.

{if isset($subcategories)}

<!-- Subcategories -->

<div id="subcategories">

<h3>{l s='Subcategories'}</h3>

<ul class="inline_list">

{foreach from=$subcategories item=subcategory}

<li>

<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">

{if $subcategory.id_image}

<img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />

{else}

<img src="{$img_cat_dir}default-medium.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />

{/if}

</a><br />

<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>

</li>

{/foreach}

</ul>

<br class="clear"/>

</div>

{/if}

 

and this solution has a bug:

 

 

public function displayContent()

{

parent::displayContent();

self::$smarty->assign('categoryNameComplement', '');

if($this->category->id_category=1234)

{

self::$smarty->display(_PS_THEME_DIR_.'category1234.tpl');

}

else

{

self::$smarty->display(_PS_THEME_DIR_.'category.tpl');

}

 

Do you have any idea?

Share this post


Link to post
Share on other sites

Hey,

I created a little module to do it some time ago. basically, I set up a database table with category "levels". Every level had a number of category ids associated to it.

I hooked the module into the footer, then, it performed a db query when in a category page, t know the category level.

With a conditional statement, i then showed the template I wanted, like:

{if $category_level == 1} {include template 1....}

{else if $category_level == 2} {include template 2...}

{/if}

 

 

Hope this can help! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More