1

I need to show custom attributes for the products selected to compare in the same fashion I can show them on the Product View page. The code that I have been using in the Compare List page to return the attributes is

<?php $attribute = Mage::getSingleton('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'blade_length'); ?>
<span class="left-label">
<?php echo $attribute->getFrontend()->getLabel(); ?></span>
<span class="right-info">
<?php echo$this->helper('catalog/output')->productAttribute($_item, $_item->getBladeLength(),'blade_length') ?></span>

Unfortunately, this does not provide me with the necessary access to all of the attributes for the selected products. Any help would be much appreciated.

Cheers

  • have you tried loading the product first? If that's too expensive I remember doing something like this Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId); – develophper Oct 30 '13 at 17:07
  • Thanks Thomas for the suggestion. I am not sure how I would go about loading the product on the Compare List template. I tried to do it a few different ways but was unsuccessful. I am going to try you other suggestion and post my results. – user1387639 Oct 30 '13 at 20:22
  • I could be misunderstanding the situation but loading a product usually works by ---- $product->load() and then it pulls all of it's attributes. Only down side is that it can slow the thing down – develophper Nov 1 '13 at 10:20
2

You can just mark the attribute blade_length as Comparable on Front-end from the backend (Catalog->Attributes->Manage attribtues) and reindex.
This should make it appear in the list of attributes in the compare page.

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.