1

I created the one custom dropdown attribute in customer side. I need to show in frontend phtml all the dropdown list because a user can select any one of this. can anyone help me.

2 Answers 2

0

Well, you can create a customer attribute of dropdown type using the procedure shown here: How to add dropdown attribute to custom module in magento 2.0

After this, if you are can create a dropdown to the phtml where you want to show the dropdown with the values being shown here.

If you use proper values for the index used_in_forms, then it will be automatically shown on those forms. For more details, refer: http://excellencemagentoblog.com/blog/2018/04/17/add-customer-attributes-programmatically-in-magento-2/

0

I resolved this

$yourAttribute=$this->eavConfig->getAttribute('customer','YOUR_ATTRIBUTE_CODE');

if($yourAttribute->getSource()){
    $options = $yourAttribute->getSource()->getAllOptions();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.