I'm using attributes to a product, availablepostalcodes
. This is a multi-select, there are 3 options per product:
1234
2345
3456
Now after a post (form) on the categorypage i've $_POST['postalcode']
, this contains 2345. But when i do this nothing will filter:
$_productCollection=$this->getLoadedProductCollection();
$_productCollection->addAttributeToFilter("availablepostalcodes", array("finset"=>"5021"));
echo $_productCollection->load()->count();
The echo still shows 5, however it should be 1, cause one product has that available postalcode.
This is the product-list view /catalog/product/list.phtml
What do i miss or don't see?
Edit:
$_productCollection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('availablepostalcodes')
->addAttributeToFilter('entity_id', array('in' => $_productCollection->getAllIds()));
Then i get all the products again.
But when i do $_productCollection->addAttributeToFilter("availablepostalcodes", array("in" => array(5021')));
it still doesn't work