Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Product API - Filtering Multiselect Attributes? 
 
bcelenza
Member
 
Avatar
Total Posts:  44
Joined:  2008-08-27
 

Hey guys. Let me set up the scenario for you.

I have a multiselect attribute called ‘events,’ with options for different social events the products in question might be good for. For instance, if I have a candle product, I might select ‘Holidays’,’Outdoor Parties’,’Relaxation’.

Now in the magento API, I’d like to filter my products collection and tell it to grab products where ‘Holidays’ and ‘Relaxation’ are selected options for this attribute. My assumption is this would use a statement similar to “select * from products where events IN(’Holidays’,’Relaxation’)”, but when applying these filters I do not get the expected results. The real filter arrangement is below:

2009-01-28T20:36:47+00:00 INFO (6): Array
(
    
[type] => Array
        (
            
[eq] => configurable
        
)

    
[status] => Array
        (
            
[eq] => 1
        
)

    
[events] => Array
        (
            
[in] => Array
                (
                    
[0] => 570
                    [1] 
=> 571
                
)

        )

)

The product API seems to only select products where the multiselect option is the FIRST one in the collection of selected options.

Am I doing this wrong? Should I be using something besides the ‘in’ directive?

Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bcelenza
Member
 
Avatar
Total Posts:  44
Joined:  2008-08-27
 

Anyone have any ideas?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top