Magento offers the opportunity for item x can set up many attributes and maintain. Now this is an attribute (from the same Attributset) However, for an article of interest and not for the other. It follows therefore, attributes that are, which are filled with an article and not the other. The statement “Unavailable” is for a client but not really purposeful, but rather confusing.
Thus, a solution needs her, by attributes with no value or. “Unavailable” hide. A code along the lines of “If not available, then display nothing. When available, then display”.
This code must be in the attributes.phtml in the folder app / design / frontend /[base or default]/[IhrTemplate]/template/catalog/product/view.
Namely, the following code replaces:
<?php foreach ($_additional as $_data): ?>
<tr>
<th class=”label”><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class=”data”><?php echo $_helper->productAttribute($_product, $_product->getName(), ‘name’) ?></h1>
Dies aber natürlich nur Vorschläge >productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php endforeach; ?>
as. in line 43. Instead of these lines of code is then used in the following snippet:
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != ”)) { ?>
<tr>
<th class=”label”>
<?php echo $this->htmlEscape($this->__($_data['label'])) ?>
</th>
<td class=”data”>
<?php echo $_helper->productAttribute($_product, $_product->getName(), ‘name’) ?></h1>
Dies aber natürlich nur Vorschläge >productAttribute($_product, $_data['value'], $_data['code']) ?>
</td>
</tr>
<?php } ?>
<?php endforeach; ?>
This code is then achieved just that: If attribute “Unavailable” then completely hide.
Used in Magento Version 1.5.1.0 Comments? Additions? Notes? Gladly!





Hallo Commercers,
I would like to know how to link attributes. In additionaldata table one can e.g.. “blue” the attribute “Color” can spend. Well I would but the value “blue” link so that it appears on click gets all the blue items. I guess, it works if you are embedding in the attributes.phtml attribute the output into a link, e.g.. the color attribute with “/catalogsearch/advanced/result/?color[]=154″ where in this example 154 the ID for “blue” is.
Can you help me?
Kind regards,
Marcus
Hi!
Geht das auch mit 1.7.0.2???
Bekomme das leider nicht hin!
Ich wäre für Hilfe sehr dankbar!
Das ist der richtige Code für Magento 1.7.0.2:
getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != ”)) { ?>
htmlEscape($this->__($_data['label'])) ?>
productAttribute($_product, $_data['value'], $_data['code']) ?>
Danke für die Mitteilung, wie es auch bei Magento 1.7.0.2 goes!