Question

I have a multiselect attribute in my categories named location

How do I display the selected / saved values on the frontend?

Thanks

Was it helpful?

Solution

you have to add the attribute to the colleciton via event: "catalog_category_flat_loadnodes_before"

$observer->getSelect()->columns(
    array( 'location' )
);

OTHER TIPS

Try this:

$category->getResource()
            ->getAttribute('location')
                ->getSource()
                    ->getOptionText($category->getData('location'))

register an ovserver in magento via xml:

<events>
     <catalog_category_flat_loadnodes_before>
            <observers>
                <category_add_attribute>
                    <type>model</type>
                    <class>myModule/observer_catalog_category</class>
                    <method>addMenuAttributes</method>
                </category_add_attribute>
            </observers>
     </catalog_category_flat_loadnodes_before>
</events>

and then in your Class

    class MyModule_Namespace_Model_Observer_Catalog_Category
    {

        public function addMenuAttributes( Varien_Event_Observer $observer )
        {
            $observer->getSelect()->columns(
                    array( 'custom_attribute_name' )
            );
        }

    }

add the customAttribute

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top