I want to get the value of a custom dropdown attribute however its proving more difficult that i anticipated. I have tried:
return $this->_customerSession->getCustomer()->getCp_permissions();
return $this->_customerSession->getCustomer()->getCp_permissions()->getValue();
return $this->_customerSession->getCustomer()->getCp_permissions()->getLabel();
No luck any ideas?
asked Nov 30, 2017 at 14:28
harri
5,5656 gold badges48 silver badges105 bronze badges
1 Answer 1
Ok typical i solved this instantly after posting:
$customer = $this->_customerSession->getCustomer();
return $customer->getResource()->getAttribute('cp_permissions')->getFrontend()->getValue($customer);
This will pull the label not the ID of the attributes value.
answered Nov 30, 2017 at 14:30
harri
5,5656 gold badges48 silver badges105 bronze badges
default