0

please visit link

using Ctrl + F, please search for text "Product Lengthh"

It is multi-select attribute .you can see "605" , But we gave value : "mobile" . I guess its displaying array of ids.

Is there anything missing in database, as it not displaying the value present in backend. attribute code : mobile_design

app/design/frontend/default/em0113/template/catalog/product/view/Attributes.phtml

    <?php
    $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct();
?>
<?php if($_additional = $this->getAdditionalData()): ?>
    <div class="fp1"><?php $Pro_name = $_product->getName();?>
    <h2><?php echo $this->__('Specifications Of '."$Pro_name") ?></h2><br/><br/>


    <table class="data-table" id="product-attribute-specs-table">
        <col width="25%" />
        <col />
        <tbody>
        <?php foreach ($_additional as $_data): ?>  
            <?php $_attribute = $_product->getResource()->getAttribute($_data['code']);

            /* hide abc */
            if($_attribute->getFrontend()->getValue($_product) == 'no') {
                continue;
            }           

            /* hide no abd*/
            if (!is_null($_product->getData($_attribute->getAttributeCode())) && (trim((string)$_attribute->getFrontend()->getValue($_product)) != ''))
            {
                if ($_data['code'] == 'gendernew'): 
                ?>              
                <tr><th colspan="3"><?php echo $this->__('') ?></th></tr>
        <th class = "tablehead" colspan="3" > GENERAL </th>
                <?php elseif ($_data['code'] == 'productweight'): ?>
                <tr><th class = "tablehead" id="prod_dim" colspan="3"><p style="background: rgb(255, 255, 255) none repeat scroll 0% 0% ! important; color: rgb(255, 255, 255); width: 100%; padding-top: 10px; padding-right: 10px; padding-left: 10px; padding-bottom: 0px ! important;" class="Product_dim">Product Dimension</p><?php echo $this->__('PRODUCT DIMENSION') ?></th></tr>
                <?php endif; ?>
            <tr>
                <th class="label"><?php echo $this->escapeHtml($this->__($_data['label'])) ?></th>
                <?php 
                if (/*stripos($_data['code'],',') === true &&*/ $_data['code'] == 'age')
                { ?>
                    <td class="data">
                        <?php
                            $_ageValues = $_product->getAttributeText($_data['code']);
                            $count = 1;
                        ?>
                        <?php if(is_array($_ageValues)): foreach($_ageValues as $_ageValue): ?>
                         <?php if($count > 1) { echo ","; } ?>
                            <?php echo $_ageValue; ?>
                            <?php $count++; ?>
                        <?php endforeach; 
                        else: echo $_product->getAttributeText($_data['code']);
                        endif; ?>
                    </td>
                <?php } else { ?>
                    <td class="data"><?php echo $_helper->productAttribute($_product, $_product->getData($_data['code']), $_data['code']); ?></td>
                <?php
                }
                ?>
            </tr>

            <!-- mobile -->

            <tr>
            <?php echo $_product->getResource()->getAttribute('mobile_design')->getFrontend()->getValue($_product); ?>
            </tr>

            <!-- mobile -->


            <?php            
            }
            ?>
        <?php endforeach; ?>
        </tbody>
    </table>
    </div>
    <script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
<?php endif;?>
  • plz show your file to check more reference. – Rakesh Jesadiya Feb 15 '16 at 11:51
  • i updated the question – Baby in Magento Feb 15 '16 at 11:55
  • i used this code in attributes.phtml [ <?php echo $_product->getResource()->getAttribute('mobile_design')->getFrontend()->getValue($_product); ?> ], but its not working – Baby in Magento Feb 15 '16 at 12:07
  • is mobile_design text type or select attribute? – Abdul Feb 15 '16 at 12:11
  • its a multiselect attribute , attribute code : mobile_design – Baby in Magento Feb 15 '16 at 12:13
1

Try this:

<?php
if($_product->getMobileDesign()) {
    foreach($_product->getAttributeText('mobile_design') as $type) {
        echo $type;
    }
}
?>

OR

<?php
 if($_product->getMobileDesign()) { 
$mobileDesigns = explode(",",$_product->getResource()->getAttribute('mobile_design')->getFrontend()
->getValue($_product));

    foreach($mobileDesigns as $key => $value){
            echo $value;
    }
}
?>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.