1

I would print just some custom attributes in a custom module block.

I used this code in custom block:

{{block type="core/template" name="attributesView" template="catalog/product/view/short_attributes.phtml"}}

I've created short_attributes.phtml with this code (took by attributes.phtml):

<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
?>
<?php if($_additional = $this->getAdditionalData()):
if (!($_product->isGrouped())) :
?>
<div class="col-lg-4 col-md-4 col-sm-12">
  <div class="right_col_features">
    <div class="title_features">DIMENSIONI IMBALLO</div>
        <?php foreach ($_additional as $_data):
            if (($this->htmlEscape($this->__($_data['code'])) == "pesoart") 
            ){
                ?><p class="p_features"><span class='subtitle_features'>Peso articolo (kg):</span> <?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></p>
            <?php
            }
            if (($this->htmlEscape($this->__($_data['code'])) == "volume") ){
            ?><p class="p_features"><span class='subtitle_features'>Volume (mc):</span> <?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></p>
            <?php
            }
        endforeach; ?>
        <?php foreach ($_additional as $_data): 
            if (($this->htmlEscape($this->__($_data['code'])) == "inf01") && $_helper->productAttribute($_product, $_data['value'], $_data['code'])== "3"):
        ?><p class='ord24h'>Acquistabile in 30 gg</p>
        <?php
            endif;
        endforeach; ?>
   </div>
</div>
<?php endif;
endif;
?>

But I see nothing...

1 Answer 1

2

Use below block code to show your attributes.

{{block type="catalog/product_view_attributes" name="attributesView" template="catalog/product/view/short_attributes.phtml"}}
2
  • @GiovanniFossati, Check updated block code. I have checked and its working on Magento 1.9 Commented May 25, 2017 at 6:58
  • Yeah, great! @JaiminSutariya you're my hero! Thanks a lot! Commented May 25, 2017 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.