Jump to content

Hide category image

Recommended Posts

I have a small mod written by BSmither, where the first product image in a category is the one used by the category itself.

This works flawlessly.

However, If I have a sub category, then I have to assign an image manually. (not much of an issue)

Its when I have nested categories, (categories within categories) where I'm having a small issue.

Take a look at the following https://www.beal.org.uk/stainless-steel-cable-ties.html

And note how, when you're inside the category, that the manually assigned category image is shown above the sub categories.

Is there any way I can hide this image from this view.

Link to post
Share on other sites

Every category has a parent category. Even the top-most categories have a "parent category ID" of "0".

So, if the category being shown has a parent category ID that is not "0", then it must be a sub-category. And if that is the case, you are wanting to suppress the display of any image - manually assigned or otherwise.

The admin can assign no image to the sub-categories, or
An edit to the code can be made in the PHP script, or
An edit can be made to the skin.

Please refer us to the prior work so that it can be determined if this edit can be put into effect at that location.

Link to post
Share on other sites

As my sub cats may contain multiple products, in most cases, I'd like to be able to assign a manual image.

So If I could somehow supress the image from appearing at the top of the inside of the category, I think would be my preferred choice.


Note how fuses has a manual image applied https://www.beal.org.uk/electrical-products/fuses.html

and fuse holders doesn't https://www.beal.org.uk/electrical-products/fuse-holders-boxes.html

I don't believe that the image would cause any confusion, when in the fuses (sub, sub category,) but may do when in the category above.



As for the original mod, does this help.




Edited by keat
Link to post
Share on other sites

The images helps.

In admin, Manage Hooks, Code Snippets tab, click Add Snippet.

Enabled: Check
Unique_ID: if_subcat_suppress_cat_image
Execution Order: 1
Description: If viewing a subcat, then do not use it's image.
Trigger: class.cubecart.pre_display_category
Version: 1.0
Author: https://forums.cubecart.com/topic/54672-hide-category-image/
PHP Code:
  if(!empty($catData['cat_parent_id'])) { unset($catData['cat_image']); }


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...