0

I need to extract the higher and lower price in category page.

My script:

<?php if($_product->isConfigurable()) { 

//get associative (child) products
                    $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$_product);
                    $childPriceLowest = "";    
                    $childPriceHighest = "";  
                    $prezzo_pieno="";        
                    foreach($childProducts as $child){

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


                    $prezzo_scontato =  $_child->getFinalPrice();
                    $prezzo_pieno_down=$_child->getPrice();

                    $price_array[] = array($prezzo_scontato);
                    $prezzo_pieno[]= array($prezzo_pieno_down); 

                    }
        asort($price_array);
        asort($prezzo_pieno);
        echo $price_array[0];
        echo $prezzo_pieno[0];

 }

does not work.

Print:

arrayarray

why? where is my error?

3
$price_array[] = array($prezzo_scontato);
$prezzo_pieno[]= array($prezzo_pieno_down);

should be

$price_array[] = $prezzo_scontato;
$prezzo_pieno[]= $prezzo_pieno_down;

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.