Magento catalog product collection ausgeben mit Filterung von Attributen (AttributeToFilter)

Gepostet am Mai 14, 2014

Wie folgt liest man die product-collection eines Magento Shops aus:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$collection = Mage::getModel('catalog/product')
            ->getCollection()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('visibility', 4)
            ->addAttributeToFilter('status', array('eq' => '1'));
$collection->addAttributeToFilter(
    array(
        array('attribute'=>'sku', 'like'=>'blw-%'),
        array('attribute'=>'sku', 'like'=>'bli-%')
    )
);
 
foreach($collection as $product) {
    //code
}

Leave a Reply

 

Posts of Current Category



Facebook: