- $_productCollection = $this ->getLoadedProductCollection() ->addAttributeToFilter(‘type_id’,’configurable’);
- <?php if($_product->getTypeId() == “configurable”): ?> <?php $_configurable = $_product->getTypeInstance()->getUsedProductIds(); ?> <?php foreach ($_configurable as $_config): ?> <?php $_simpleproduct = Mage::getModel(‘catalog/product’)->load($_config); ?> <?php //Magic php with a $_simpleproduct. ?> <?php endforeach; ?> <?php endif; ?>
- $_productCollection = $this->getLoadedProductCollection(); foreach ($_productCollection as $_product) { if ($_product->_data[‘type_id’] == ‘configurable’) { … } }
- $collectionConfigurable = Mage::getResourceModel(‘catalog/product_collection’) ->addAttributeToFilter(‘type_id’, array(‘eq’ => ‘configurable’));
The problem with getLoadedProductCollection() is it's already loaded - the products' data has already been retrieved from the database.
Вот поэтому 4-й вариант — самый правильный (и самый экономный).