7
I have a foreach
that brings me all the children of an X attribute, and I need to add a specific class to the list <ul>
to be able to format by CSS according to the Y attribute. However, I am unable to add the attribute name in the class.
Below is an example taken from app/design/frontend/base/default/tempplate/Catalog/layer/filter.phtml
<ol class="filters filter-type">
<?php foreach ($this->getItems() as $_item): ?>
<li>
<?php if ($_item->getCount() > 0): ?>
<a href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a>
<?php else: echo $_item->getLabel() ?>
<?php endif; ?>
<?php if ($this->shouldDisplayProductCount()): ?>
(<?php echo $_item->getCount() ?>)
<?php endif; ?>
</li>
<?php endforeach ?>
</ol>
On a filter category page, I want that when loading product attributes these blocks have a specific class that identifies.
Example:
Size
- 38
- 39
- 40
Sex
- Masculine
- Feminine
Price
- From 30 to 40
- From 50 to 80
- From 100 to 200
Where each block receives a class: filter-size, filter-sex, filter-price, only I don’t know what attribute it will bring and I need it to be dynamic.
Friend, give us some code to better illustrate what you need.
– Guerra
Friend, if you pass what is the exact condition to enter the class and into which element, we can pass what is the best code to do this.
– Kenny Rafael