Per qualche strana ragione, gli sviluppatori di Magento hanno deciso che un attributo vuoto non deve essere vuoto, ma piuttosto “No” o “N/A”, a seconda del suo tipo. Questo non è solo fastidioso, ma in alcuni casi può far vedere informazioni errate il che confonderebbe i visitatori e le vendite potenzialmente perse.
Fortunatamente, c’è una soluzione rapida che risolve il problema. Aprite il file /app/design/frontend/default/template/catalog/product/view/attribute.phtml in un editor e trovare le seguenti righe:
1 2 3 4 5 6 7 8 |
<?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; ?> |
e sostituirle con:
1 2 3 4 5 6 7 8 9 10 11 |
<?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; ?> |
Salva il file e hai finito.