Jump to content

[SOLVED] Subcategory Pictures


Recommended Posts

Hi,

When you click a category the subcategory pictures display then when you click the subcategory picture the products are listed with the subcategory picture at the top of the listings.

Is there anyway to remove the picture at the top of the subcategory listings??

If i don't use a subcategory picture at all then nothing displays, but as soon as i pop a picture in it displays.

How can i remove the subcategory picture from the top of the listings but have the picture remain on subcategory listings in the categories??

Thanks
Ian

Link to comment
Share on other sites

Hi Rocky,

Thanks for your reply

If i comment out the following
<!-- if%7D-medium.jpg -->

Yes it works, however it also removes the subcategory pictures under category, I want the subcategory pictures under category to remain, I just to remove subcategory top picture from the listings under subcategory??

I hope that makes sense.

Thanks
Ian

Link to comment
Share on other sites

I think you commented out the wrong code. You should comment out the code further up instead. Replace:

<!-- Category image -->
{if $category->id_image}
  <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" />
{/if}



with:

{*
  <!-- Category image -->
  {if $category->id_image}
     <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" />
  {/if}
*}

Link to comment
Share on other sites

  • 4 months later...

The code above only removes the category image. If you want to remove the subcategory images, you must {* comment out *} the following lines 30-37 of category.tpl:

<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>


  • Like 2
Link to comment
Share on other sites

  • 1 month later...

I have a similar delima...I only want subcategories with images to show the images and those without images will be bullet listed.

Here is my code:


{l s='Subcategories'}

       {foreach from=$subcategories item=subcategory}
           {if $subcategory.id_image}

getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" />



getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}            

           {else}

getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}

           {/if}
       {/foreach}









The issue im having is it still is only showing the no-bg class on all my subcategories even though they have no image applied to them.

Link to comment
Share on other sites

  • 4 weeks later...
Rusty, Did you ever figure this out? I am wanting to do the same thing, if there is not an image for something than just have it be a bullet list.

Thanks.


Yup here is my code

{if isset($subcategories)}
   <!-- Subcategories -->

{l s='Choose A Sub Category'}

       {foreach from=$subcategories item=subcategory}
0}class="no-bg"{/if}>
               {if $subcategory.id_image>0}
               <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" /></a>

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

       {/foreach}







{/if}



Then use css to control your lists with the 'no-bg' class for images without bullets.

Link to comment
Share on other sites

Rusty, Thanks for the code. Anyways I added that to my themes category.tpl and now when i go to refresh my page im getting the following.

* getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">2003
* getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">2004


Any Ideas?

Thanks,
Jake

Link to comment
Share on other sites

Rusty, Thanks for the code. Anyways I added that to my themes category.tpl and now when i go to refresh my page im getting the following.

* getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">2003
* getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">2004


Any Ideas?

Thanks,
Jake


Looks like some of the code was removed when I posted it...must be filtering the html I have attached the code in a text file.

code.txt

Link to comment
Share on other sites

  • 1 year later...
  • 11 months later...

{if $subcategory.id_image}
   {if $subcategory.id_image>0}<img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />{/if}
  {else}
   <img src="{$img_cat_dir}default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
  {/if}

with this code work

Link to comment
Share on other sites

  • 2 years later...

Hello, I would like to have Category Picture narrower, e.g. 217x217px, so not so wide like original is. When I remake new pictures, new picture fill the whole width, so it looks not nice.

Thank you for help. 

Link to comment
Share on other sites

×
×
  • Create New...