0
votes

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>
1
What vendor data are you matching with attribute data? Vendor name? Your simple products, do they have two configurable attributes or just one?srgb
Yes, color and vendor.CaitlinHavener
So a vendor may have the product in blue and red. So test-red-ven1 test-blue-ven1CaitlinHavener
When I var_dump($_product->debug()); I see the simple products and their individual price... I'm just not sure what filter to put on that to retrieve the price.CaitlinHavener

1 Answers

2
votes

After some research I figured out this is pretty hard to solve on your own. If you're willing to spend a few bucks this is a great extension: http://www.magentocommerce.com/magento-connect/simple-product-pricing.html