0

Some of my attributes has no data, but shows as na, n/a and no. How can i remove that.

enter image description here

0

By Admin Panel:

To solve this issue, you need to set that attribute to don't show on the frontend detail page. To configure this please follow given below steps:

Step1: Go to admin > Caralog > Manage Attribute.

Step2: Click on attribute name which you need to configure.

Step3: Now under 'Frontend Properties' you need to set the option : 'Visible on Product View Page on Front-end' to 'No'.

Step4: Finally, save your configuration.

Or By code:

One solution is to override the template file: you can find it here :

app/design/frontend/base/default/template/catalog/product/view/attributes.phtml
<?php foreach ($_additional as $_data): ?>
    <?php if ($_helper->productAttribute($_product, $_data['value']) == 'Black'):?>
        <?php continue;?>
    <?php endif; ?>
        <tr>
            <th class="label"><?php echo $this->escapeHtml($this->__($_data['label'])) ?></th>
            <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
        </tr>
<?php endforeach; ?>

Note: For more details go through this URL:

Only display attributes that are visible on product view page on front-end if a value exists

| improve this answer | |
0

which type of input do you choose? "Dropdown" with no default value and no value required should allow you not to show in the list attributes with no data assigned

| improve this answer | |
  • 1
    My attribute list like Drop-down and text – user51361 Apr 8 '17 at 9:21
0

Find and open the attributes.phtml file. This file can be found here: /app/design/frontend/[YOUR PACKAGE]/[YOUR THEME]/template/catalog/product/view/attribute.phtml

Open the file and search for the following lines:

<?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; ?>

Replace the entire foreach loop with the following lines of code:

<?php foreach ($_additional as $_data): ?>
    <?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
    if (!is_null($_product->getData($_attribute->getAttributeCode())) && (trim((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; ?>
| improve this answer | |
  • No steps, I have tested it before posting here. – Vinod Kumar Apr 12 '17 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy