Jump to content

Subcategories


Recommended Posts

I would like to configure subcategories to do the following.

1) I would like the subcategories to centre align on the page.
2) I would like to remove the images from some selected subcategories.
3) I would like to remove the text from some selected categories.
4) I would like to increase the spacing between the subcategories.

Can anyone help?

Thanks in advancnce :)

Link to comment
Share on other sites

Hi

You need to edit or add some styles to global.css for centering and spacing.
Link to your website could help if you are not on local server.

But for 2 and 3 I have a question.
What is condition of remove text/images of some subcategories ?
Because this is done in loop in category.tpl.

Link to comment
Share on other sites

Link to Site is http://www.camerakingdom.com.au/

For 2. I would like to remove the text for some subcategories and just have the image displayed, in my case this is the manufacturers logo.

For 3. I would like to just list text for my various lens subcategory types like Wide, Zoom, Telephoto Zoom, Fixed focal lenght etc etc without having to put an image.

If possible, in some areas I would also like to remove both image and text for some subcategories and just have the subcategory displayed in the Products menu.

Link to comment
Share on other sites

Ok try this.
Backup category.tpl and then find this code

    <div id="subcategories">
       <h3>{l s='Subcategories'}
       <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="" />
                   {else}
                       <img src="{$img_cat_dir}default-medium.jpg" alt="" />
                   {/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>


and replace it with

    <div id="subcategories">
       <h3>{l s='Subcategories'}
       <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="" />
                   {else}
                       {$subcategory.name|escape:'htmlall':'UTF-8'}
                   {/if}
               </a>
           </li>
       {/foreach}
       </ul>
       <br class="clear"/>
   </div>



That way if subcategory have image it will display it and text is hidden.
And if there is no image only text will be displayed.

Link to comment
Share on other sites

Thanks for the fast reply :)

That way if subcategory have image it will display it and text is hidden.
And if there is no image only text will be displayed.


What you have explained is exactly what I am trying to do.

I have tried your edit and it removes the text for all subcategories but does not show text when there is no image added. See: http://www.camerakingdom.com.au/category.php?id_category=60
Link to comment
Share on other sites

Regarding point 4, I have spaced the categories out so that is all ok..

I still need to find out how to center the subcategories. Its ok when there are 5 items as I have added left and right margin to find centre but if there are not 5 they are still aligned left. I cant figure out where to adjust it.

Any help is appreciated :)

Example: http://www.camerakingdom.com.au/category.php?id_category=6 (Top row is centered but second row is left justified)

Link to comment
Share on other sites

Ok for text and images found one solution, maybe there are better one but this works.
Replace

    {if $subcategory.id_image}


with

{if !$subcategory.id_image|stripos:"default"}



And for centering don't know easy fix. You could try with

body#category #subcategories li {
margin-left:15px;
margin-right:15px;
width:18%;
}


global.css (line 1404) but if there 5 then 1 will also be aligned to left.
And increasing width so it will show 3 in row makes to many space.

Will let you know it I figure something better.

Link to comment
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...