سؤال

i made a custom template for homepage on my magento theme (working on CE 1.8.1.0) in which i get a filtered collection of products :

$selections_products = $modelCatalogProduct->getCollection()
   ->setPageSize(32)
   ->addAttributeToSelect(array('name','selection_moment','selection_rouge','selection_blanc','selection_cdc','selection_champagne','selection_exception'))
   ->addAttributeToFilter(
        array(
          array('attribute'=>'selection_moment', array('eq' => '1')),
          array('attribute'=>'selection_rouge', array('eq' => '1')),
          array('attribute'=>'selection_blanc', array('eq' => '1')),
          array('attribute'=>'selection_cdc', array('eq' => '1')),
          array('attribute'=>'selection_champagne', array('eq' => '1')),
          array('attribute'=>'selection_exception', array('eq' => '1'))
        )
    );

these are custom attributes created in back-office. I managed to get them correctly on the same page with multiple getCollection and single filter, but i'm trying to get all product in one call, because of performance issues.

Flat catalog is enabled for products and categories, and all the custom attributes are configured with "show in product page" and "show in product list" to true

EDIT :

forgot tu put the call loop :

foreach($selections_products as $product){
    $product = mage::getModel('catalog/product')->load($product->getId());
    echo '<pre>';
    var_dump($product->getName());
    var_dump($product->getData('selection_moment'));
    var_dump($product->getData('selection_rouge'));
    var_dump($product->getData('selection_blanc'));
    var_dump($product->getData('selection_cdc'));
    var_dump($product->getData('selection_champagne'));
    echo '</pre>';
}

The followings only return 0

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top