@@ -303,11 +303,13 @@ protected function _processRule($condition = array())
303
303
if ($ attribute == 'category_ids ' ) {
304
304
$ categoryIds = explode (', ' , $ value );
305
305
$ values = array ();
306
- foreach ($ categoryIds as $ categoryId ) {
307
- $ category = Mage::getModel ('catalog/category ' )->load ($ categoryId );
308
- $ values [] = $ category ->getName ();
309
- }
310
- $ value = implode (', ' , $ values );
306
+
307
+ //get collection and filter by cat ids
308
+ $ catCollection = Mage::getModel ('catalog/category ' )->getCollection ();
309
+ $ catCollection ->addAttributeToFilter ('entity_id ' , array ('in ' => $ categoryIds ));
310
+
311
+ $ categoryIds = $ catCollection ->load ()->getColumnValues ('name ' );
312
+ $ value = implode (', ' , $ categoryIds );
311
313
}
312
314
313
315
// product attributes
@@ -327,9 +329,12 @@ protected function _processRule($condition = array())
327
329
$ collection = Mage::getResourceModel ('eav/entity_attribute_option_collection ' )// TODO: better way?
328
330
->setAttributeFilter ($ attributeId )
329
331
->setStoreFilter ($ storeId , false )
330
- ->addFieldToFilter ('tsv.option_id ' , array ('in ' => $ value ));
331
- if ($ collection ->getSize () > 0 ) {
332
- $ value = $ collection ->getFirstItem ()->getValue ();
332
+ ->addFieldToFilter ('tsv.option_id ' , array ('in ' => $ value ))
333
+ ->getSelect ()
334
+ ->limit (1 );
335
+
336
+ if ($ collection ->getSize ()) {
337
+ $ value = $ collection ->getResource ()->fetchOne ($ collection ->getSelect ());
333
338
}
334
339
}
335
340
}
0 commit comments