Magento Core: Remove layered navigation attributes per category

Send Snippet To: Save this snippet to Code Collector Pro -- view all tamburra's snippets
language: Other
license: Other

Code for Snippet:

                    <dt><?php echo $this->__($_filter->getName()) ?></dt>
                    <dd><?php echo $_filter->getHtml() ?></dd>
Changed To:
                $tmpTitle = $this->htmlEscape($this->__($_filter->getName()));
                $tmpTitle = strtolower($tmpTitle);
                $tmpTitle = preg_replace("/[\s]+/", "-", $tmpTitle);
                $tmpTitle = str_replace("/", "-", $tmpTitle);
                <dt class="<?=$tmpTitle?>"><?php echo $this->__($_filter->getName()) ?></dt>
                <dd class="<?=$tmpTitle?>"><?php echo $_filter->getHtml() ?></dd>
What the first part does is take the “title” of the attributes (set in the Manage Attributes section in the back) and changes the “title” to lower case and places “-” in place of spaces (in case your attribute name is more than 1 word). 
The second part then injects the $tmpTitle variable as a “class” tag for use with some CSS magic! 
Add To Category Description:
<style type="text/css">
.block-layered-nav .attribute-label { display: none; } 
comments powered by Disqus


Tags: Core CE 1.6

Link to this snippet:

Download to Code Collector

To use the direct link to your snippet on either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 2708
Date Added: 2012-01-24 05:53:34
Last Modified: 0000-00-00 00:00:00

Web Analytics