Krótkie, szybkie i proste rozwiązanie problemu „pustych atrybutów” (‚Nie‚ oraz ‚Nie dotyczy‚), które pokazują się w tabelce „product-attribute-specs-table” na karcie produktu.
Przechodzimy do pliku /app/design/frontend/default/layout/template/catalog/product/view/attributes.phtml i zamieniamy fragment kodu:
<?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, $_data['value'], $_data['code']) ?></td> </tr> <?php endforeach; ?>
na kod:
<?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, $_data['value'], $_data['code']) ?></td> </tr> <?php } ?> <?php endforeach; ?>
Zapisz plik, ‚prześlij na serwer’, odświeżenia pamięci cache i Twoje „puste” atrybuty zostaną ukryte!