Jump to content

How to change the size of Subcategory Images


Recommended Posts

Hi,

Any help really appreciated.

 

I have created Banner style images for my Categories, so they stretch over most of the page

 

However when you are in the Category above, these same images are used as the thumnnails to show all of the subcategory images, and do not look correct as small thin images.

 

They need to be Thumbnails proportioned images instead of banner types that I have created.

 

I can create these new thumbnails, but I need some way of using telling the code to use the thumbnails when the category is being displayed as a sub category in the parent category..

 

Any ideas on how to this?

 

Again, many thanks if anyone can enlighten.

 

Cheers

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

you can create a new "subcategory" size in preferences->images, and thene edit your category.tpl file so it displays that size (be sure to change width and height attributes in img tag, too). It's a bit boring, it's a shame prestashop doesn't include a dedicated image for subcategories

Link to comment
Share on other sites

Hi,

 

you can create a new "subcategory" size in preferences->images, and thene edit your category.tpl file so it displays that size (be sure to change width and height attributes in img tag, too). It's a bit boring, it's a shame prestashop doesn't include a dedicated image for subcategories

 

Hi, Can you please give more information, after i created a new size called subcategory how can i change category.tpl file?

 

Thanks

Link to comment
Share on other sites

  • 1 month later...

Hi,

Any help really appreciated.

 

I have created Banner style images for my Categories, so they stretch over most of the page

 

However when you are in the Category above, these same images are used as the thumnnails to show all of the subcategory images, and do not look correct as small thin images.

 

They need to be Thumbnails proportioned images instead of banner types that I have created.

 

I can create these new thumbnails, but I need some way of using telling the code to use the thumbnails when the category is being displayed as a sub category in the parent category..

 

Any ideas on how to this?

 

Again, many thanks if anyone can enlighten.

 

Cheers

 

I am having the same problem, if you solved this please share a solution. Thanks

Link to comment
Share on other sites

Hi,

 

you can create a new "subcategory" size in preferences->images, and thene edit your category.tpl file so it displays that size (be sure to change width and height attributes in img tag, too). It's a bit boring, it's a shame prestashop doesn't include a dedicated image for subcategories

 

A step by step for this solution will be appreciated. I am new to prestashop and would appreciated any and all help. Thanks.

Link to comment
Share on other sites

  • 2 months later...

yes please... I found this solution but it doesn't work:

 

To re-size subcategories images in prestashop 1.4 follow this instructions

 

1. Go to Back Office Preferences/Image and create new image with the desired size

 

2. Edit /themes/YOURTHEME/category.tpl subcategories section and change ALL MEDIUM instances

 

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

{if $subcategory.id_image}

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

{else}

 

{/if}

 

 

 

 

TO

 

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

{if $subcategory.id_image}

getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'YOUR-NEW-IMAGE-NAME')}" alt="" width="{$YOUR-NEW-IMAGE-NAMESize.width}" height="{$YOUR-NEW-IMAGE-NAMESize.height}" />

{else}

 

{/if}

 

 

 

 

3. Edit /themes/YOURTHEME/css/category.css subcategories section and change

 

body#category #subcategories li { height: 136px; width: 108px; margin-right: 3px }

 

 

 

TO

 

body#category #subcategories li { height: NEW-SIZE-IN-PIXELSpx; width: NEW-SIZE-IN-PIXELSpx; margin-right: 3px }

 

 

 

The height should be higher then the actual image height in order to display the hyperlinks correctly

 

4. Edit /controlers/CategoryController.php go to section self::$smarty->assign(array(

and add

 

'YOUR-NEW-IMAGE-NAMESize' => Image::getSize('YOUR-NEW-IMAGE-NAME'),

 

 

 

adding this line will fix the problem of images not displayed in Internet Explorer

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...
  • 3 months later...

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