I have added a customer attribute for customers to select languages that they are fluent in using a multiselect input. I’m trying to get them to display on the frontend but can only get the ID’s to display.
Right now I’m using a query in the block to grab the actual labels, but would much prefer if there were an easier way to grab the values instead.
What I’m doing currently:
$ langattrA = $ customer->getData('customer_languages'); $ resource = Mage::getSingleton('core/resource'); $ readConnection = $ resource->getConnection('core_read'); $ attTable = $ resource->getTableName('eav_attribute_option_value'); $ query = "SELECT value FROM $ attTable WHERE option_id in ($ langattrA)"; $ result = $ readConnection->fetchAll($ query);
The downfall of this is also that using fetchAll()
returns “Array” instead of the actual list of selected languages.
Using print_r($ result)
is also messy.