开发者

Magento: Getting the Value of an EAV Attribute Option/Select

开发者 https://www.devze.com 2023-03-19 08:05 出处:网络
I Have an object of Mage_Customer_Model_Customer and ran the following code: $customer->loadByEmail($customer->getEmail());

I Have an object of Mage_Customer_Model_Customer and ran the following code:

$customer->loadByEmail($customer->getEmail());
$customer->getGender();  //returns the EAV attribute option_id's of 1 or 2

I am trying to get the eav_attribute_option_value.value of those option_id's which is the word "Male" or the word "Female"

I am not sure how to do this and spent quite a bit of time debugging the account form select widget with no success. I am also curious o开发者_如何学Gon how you figured this out.

Thanks in advance

Sincerly, Tired Dev


$attributeOptions = $customer->getSource()->getAllOptions(false);
echo "<pre>"; print_r($attributeOptions); echo "</pre>";

http://blog.chapagain.com.np/magento-how-to-get-attribute-name-and-value/

EDIT: From Link:

$entityType = Mage::getModel('eav/config')->getEntityType('invoice');
$entityTypeId = $entityType->getEntityTypeId();

$attribute = Mage::getResourceModel('eav/entity_attribute_collection')
                ->setCodeFilter('order_id')
                ->setEntityTypeFilter($entityTypeId)
                ->getFirstItem();
0

精彩评论

暂无评论...
验证码 换一张
取 消