Jump to content

[SOLVED] Show different image for category and subcategory


Recommended Posts

I would like to be able to show a different image for the category page and another for when it is listed as a subcategory. For example, you would go to the clothing category and "women" would be listed as a subcategory (image 1), when you click on "women" to open that category, you would see different image (image 2) at the top of the page, rather than the same one.

Currently, you can only upload one image to a category. If you choose an image of a wide product, then this looks good at the top of the category, but in the subcategory picture (which is square) it gets reduced to a tiny size.

I would like to keep the sub category pictures as a square, so there's no easy way out there. As a last resort, I could disable the image at the top of a category so that images are specifically picked to look good at a small size.

I figure if I can somehow change the back office to allow two images to be uploaded to a category - one for subcategory pics and one for the main pic and then edit the category page to show the first pic for the main pic and the second as the subcategory pic......all very well said and done, except I have no idea how to do any of this!!

Can anyone help?

Link to comment
Share on other sites

This can be done using image mapping. Upload the image you want to be the category's thumbnail under Catalog > Category > Edit, then go to Catalog > Image mapping, upload the bigger image you want for the category, then link it to the category.

Link to comment
Share on other sites

I'm trying to do this with 1.2.4. Is it possible? I don't see any where to link the category to the image map. I can't figure out how to activate it. When I upload a picture I get the screen below. There's no info to link it to a category, etc.

I'd like to do the same as this guy: http://www.prestashop.com/forums/viewthread/43972/integration/subcategory_image__thumbnail_on_category_page___different_heading_image_on_subcat_page/

25969_5j3aUAPXFkPuiHyqTZOM_t

Link to comment
Share on other sites

That didn't work. You can see in the screen-shot I don't even have a "save" button. It says "update successful" but there's no image uploaded on the screen nor any of the map details such as link to category.

ETA. It does work in 1.2.4 as it works in my test cart. Does anyone know what files the Image Mapping uses? I tried AdminScenes but it didn't make a difference.

Link to comment
Share on other sites

Do you have problems uploading product images too? Your server configuration may be preventing PrestaShop from uploading images. You are right that it is admin/tabs/AdminScenes.php that contains the code for the image mapping tab.

Link to comment
Share on other sites

OK, I figured out that I didn't have the table ps_scene_category . Does anyone know the SQL prompt to create this table?

Thanks in advance and thanks Rocky, I can see you're a great help to many by all your posts!

Link to comment
Share on other sites

I'm not sure why that table is missing from your database. The SQL query to create the table is in install/sql/db.sql:

CREATE TABLE `PREFIX_scene_category` (
 `id_scene` int(10) unsigned NOT NULL,
 `id_category` int(10) unsigned NOT NULL,
 PRIMARY KEY  (`id_scene`,`id_category`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;



and the SQL query to insert the default scene category data is in install/sql/db_settings_extends.sql:

INSERT INTO `PREFIX_scene_category` (`id_scene`, `id_category`) VALUES (1, 2),(2, 2),(3, 4);



Change PREFIX to your database prefix in these queries.

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