$attributeSetNames = array('Sko', 'beklaedning', 'Banz_solhat', 'Soltoj', 'solhat', 'fodtoj');
$quote = Mage::getSingleton('checkout/session')->getQuote();
$itemCollection = Mage::getModel('sales/quote_item')->getCollection();
$itemCollection->getSelect()
->joinLeft(
array('cp' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
'cp.entity_id = main_table.product_id',
array('cp.attribute_set_id'))
->joinLeft(
array('eas' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_set')),
'cp.attribute_set_id = eas.attribute_set_id',
array('eas.attribute_set_name'))
;
$itemCollection->setQuote($quote);
foreach($itemCollection as $item) {
if (in_array($item->getData('attribute_set_name'), $attributeSetNames)) {
//... Match
}
}
Alternatively…
Use the attribute set ids instead of names. This would avoid any potential issues with wording and also clean the code up a little…
$attributeSetIds = array(1, 2, 3, 4, 5, 6);
$quote = Mage::getSingleton('checkout/session')->getQuote();
$itemCollection = Mage::getModel('sales/quote_item')->getCollection();
$itemCollection->getSelect()
->joinLeft(
array('cp' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
'cp.entity_id = main_table.product_id',
array('cp.attribute_set_id'))
;
$itemCollection->setQuote($quote);
foreach($itemCollection as $item) {
if (in_array($item->getData('attribute_set_id'), $attributeSetIds)) {
//... Match
}
}