Retrieve Simple Product Price for Configurable Product

configurable-productprice

We have a configurable product called with sku TEST and under it are simple products (for example) red-ven1, red-ven2, blue-ven3, etc. The configurable product itself does not have a price but each simple product does. I need to retrieve the price for the simple product based on the attributes that are selected. So I need the price for red product with vendor 2. How do I get this specific price? I am currently trying to dynamically display the price next to the vendor attribute (so vendor attribute is not selected). Will I have to "invisibly" select the vendor attribute value to get the price? Please advise.

Currently Trying:

<?php $_product    = $this->getProduct(); ?>
<?php $_price = $_taxHelper->getPrice($_product, $_product->getPrice()) ?>

<script>
var price = <?=$_price ?>;

            /...lots of non-applicable code
            for(var i=0; i < IDs.length; i++)//traversing the vendor detail nodes
            {   
                //Invisibly make selection of vendor so as to gather correct price
                var optionToSelect = $j('option', '#attribute136').filter(function() {
                    return $j(this).text().indexOf(data[i].vendor_id) != -1;
                }).val();
                var vals = $j('#attribute136').val() || [];
                vals.push(optionToSelect);
                $j('#attribute136').val(vals);

            $j('.details'+data[i].vendor_id).append('<li class="priceBlock">$'+price+'</li>');
            }

        }); 
</script>

Best Answer

There are two extension which does this for you:

Simple Configurable Products

http://www.magentocommerce.com/magento-connect/simple-configurable-products.html

BCP - Better Configurable Products

http://www.magentocommerce.com/magento-connect/better-configurable-products.html

Related Topic