If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Categories, Products, Attributes / Disable Product Images in one TOP category to affect all subcategories

Disable Product Images in one TOP category to affect all subcategories

Started by sbbemn on 17 Jul 2012, 6:46 PM · Views: 865

Results 1 to 5 of 5
17 Jul 2012, 6:46 PM
#1
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Disable Product Images in one TOP category to affect all subcategories

The below closed thread explains nicely how to disable images in a category.
http://www.zen-cart.com/showthread.php?102439-Disable-product-images-in-just-one-category

In your css folder, add a file called c_x_x.css

In that file, I added only the following and chose not to remove the heading.

/**
 * CSS remove Images in product listing
*/

.listingProductImage {
 	display: none;
}

In order to keep the Heading, which is nice for a sortable list, I simply went into includes/languages/english/index.php and removed Product Images (between single quotes).

BUT - I am after disabling Product Images in one TOP category to affect all subcategories to avoid creating 50+ css files per bottom category.

I tried for example c_3.css and c_3_175.css but was forced to use c_3_175_845.css

Any way around this? Thanks!

17 Jul 2012, 7:49 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Disable Product Images in one TOP category to affect all subcategories

A quick dirty trick:

Create the following new file: /includes/templates/YOUR_TEMPLATE_FOLDER/jscript/jscript_categories_children_css.php
containing:```

<?php /** * custom category handling for a parent and all its children ... works for any c_XX_XX_children.css where XX_XX is any parent category */ $tmp_cats = explode('_', $cPath); $value = ''; foreach($tmp_cats as $val) { $value .= $val; $perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/c_' . $value . '_children.css'; if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n"; $perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . $_SESSION['language'] . '_c_' . $value . '_children.css'; if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n"; $value .= '_'; } ``` Then in your css folder put your new css file as "c_3_children.css" and it'll apply to all children below cPath=3 Similarly, if you want to only affect the children of cPath=3_175 then make the filename be c_3_175_children.css instead. ** THIS CODE IS NOW INCLUDED IN v1.5.1**

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Jul 2012, 8:31 PM
#3
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Disable Product Images in one TOP category to affect all subcategories

Dirty little trick worked like a charm - hand sanitizer anyone?!

17 Jul 2012, 9:16 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Disable Product Images in one TOP category to affect all subcategories

PS: You REALLY should be upgrading to a newer more secure version of Zen Cart. Yours has security holes.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Jul 2012, 9:36 PM
#5
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Disable Product Images in one TOP category to affect all subcategories

DrByte:

PS: You REALLY should be upgrading to a newer more secure version of Zen Cart. Yours has security holes.

Oh don't I know it. We have taken a few directions to band-aid it, yet we have SOOO many customizations we're a little apprehensive on upgrading. I do know it is mandatory and have it on the plate for upcoming projects. We may outsource to someone who has done this many times. I wonder if it is easier than I'm making it out to be.