Skip to content

Instantly share code, notes, and snippets.

@luads
Created March 29, 2012 16:55
Show Gist options
  • Save luads/2239878 to your computer and use it in GitHub Desktop.
Save luads/2239878 to your computer and use it in GitHub Desktop.
Show product attributes in magento wishlist
<?php
// the $item var is a Mage_Wishlist_Model_Item instance, used in the wishlist pview.html
function getOptionsWithValues()
{
$attributes = $item->getOptionByCode('attributes')->getValue();
if (!$attributes)
{
return null;
}
$attributes = unserialize($attributes);
$options = array();
foreach ($attributes as $attr_id => $attr_value)
{
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attr_id);
$attr_options = $attribute->getSource()->getAllOptions(false);
foreach ($attr_options as $option)
{
if ($option['value'] == $attr_value)
{
$options[$attribute->getFrontendLabel()] = $option['label'];
}
}
}
return $options;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment