Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Get Customer Custom Attribute Value

Tags:

php

magento

When I run the following two lines of code, I get returned the value 161. Now if I dig through customer_eav, I see 161 relates to attribute_id 477, and then if I dig further into customer_entity_varchar I find a row with field['attribute_id']=477 and the value is USD. How can I get this attribute string value using magento's models / methods...

$customer = $session->getCustomer();
$attributes = $customer->getDefaultCurrency(); // returns 161... not USD
like image 633
mprototype Avatar asked Sep 18 '12 00:09

mprototype


People also ask

What are the customer attributes?

When we talk about customer attributes, we are referring to non-personal labels that can be used to group behavioral data into persona groups or categories (e.g. gender, loyalty level, age group, propensity to buy, etc.) Personal data should not be onboarded to the Marketing Cloud.

How can I get customer data using customer ID in Magento 2?

Use the following code to load Customer by ID using Object Manager in your Magento store. $customerId=1; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerData = $objectManager->create('Magento\Customer\Model\Customer')->load($customerId);


1 Answers

echo $customer->getResource()
              ->getAttribute('default_currency')
              ->getFrontend()
              ->getValue($customer);
like image 78
benmarks Avatar answered Sep 23 '22 03:09

benmarks