Created
March 29, 2012 16:55
-
-
Save luads/2239878 to your computer and use it in GitHub Desktop.
Show product attributes in magento wishlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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