1

$product = Mage::getModel('catalog/product') ->load($this->getProduct()->getId());

    /** 
     * Get child products id (only ids) 
     */
    $childIds = Mage::getModel('catalog/product_type_configurable')
                    ->getChildrenIds($product->getId());

    /** 
     * Get children products (all associated children products data) 
     */
    $childProducts = Mage::getModel('catalog/product_type_configurable')
                    ->getUsedProducts(null, $product);

    /** 
     * Get children products as collection
     * And, select all attributes like name, description, price, etc.
     */
    $childProducts = Mage::getModel('catalog/product_type_configurable')                        
                    ->getUsedProductCollection($product)
                    ->addAttributeToSelect('size')
                    ->addAttributeToFilter(array(array('attribute'=> 'size','eq' => 'L')));

    var_dump($childProducts->count());die;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.