Here is how you can get the prices of the simple products. The example is for a single configurable product but you can integrate it in your loop.
There may be a problem with performance because there are a lot of foreach
loops but at least you have a place to start. You can optimize later.
//the configurable product id $productId = 126; //load the product - this may not be needed if you get the product from a collection with the prices loaded. $product = Mage::getModel('catalog/product')->load($productId); //get all configurable attributes $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product); //array to keep the price differences for each attribute value $pricesByAttributeValues = array(); //base price of the configurable product $basePrice = $product->getFinalPrice(); //loop through the attributes and get the price adjustments specified in the configurable product admin page foreach ($attributes as $attribute){ $prices = $attribute->getPrices(); foreach ($prices as $price){ if ($price['is_percent']){ //if the price is specified in percents $pricesByAttributeValues[$price['value_index']] = (float)$price['pricing_value'] * $basePrice / 100; } else { //if the price is absolute value $pricesByAttributeValues[$price['value_index']] = (float)$price['pricing_value']; } } } //get all simple products $simple = $product->getTypeInstance()->getUsedProducts(); //loop through the products foreach ($simple as $sProduct){ $totalPrice = $basePrice; //loop through the configurable attributes foreach ($attributes as $attribute){ //get the value for a specific attribute for a simple product $value = $sProduct->getData($attribute->getProductAttribute()->getAttributeCode()); //add the price adjustment to the total price of the simple product if (isset($pricesByAttributeValues[$value])){ $totalPrice += $pricesByAttributeValues[$value]; } } //in $totalPrice you should have now the price of the simple product //do what you want/need with it }
The code above was tested on CE-1.7.0.2 with the Magento sample data for 1.6.0.0.
I tested on the product Zolof The Rock And Roll Destroyer: LOL Cat T-shirt and it seams to work. I get as results the same prices as I see in the frontend after configuring the product by Size
and Color
相关推荐
SRAM-based FPGA architecture for defect and fault tolerance of configurable logic blocks1
Magento可配置产品价格超越简单产品价格此扩展名用于以简单产品价格覆盖可配置产品价格。
一个简单领域驱动设计中的configurable注解的demo,涉及到技术springboot aspectj
A Highly-Configurable Cache Architecture For Embedded Systems
CPU Configurable_out_of_order_data_t
dry-configurable, 一个简单的mixin使 ruby 类可以配置 干可以配置 概要class App extend Dry::Configurable # Pass a block for nested configuration (works to any
embeded configurable operating system
The mission of operational support systems (OSS) is to run and manage the daily operations of a company. It is very important that the OSS exhibits great flexibility in adjusting its behaviour to ad ...
这是关于智能优化的电子书,高清,最新版本,经典著作,英文版
python库。 资源全名:configurable-http-proxy-0.2.2.tar.gz
Configurable C++ platform adapter
a configurable refernce modelling language
Community-wide-Dataset-of-Configurable-Systems
#自述文件使用 spring @Configurable 注释的“原型”bean 类型的示例(也请记住单例 bean),即使用普通的“new”运算符创建 bean,然后 spring 进一步控制初始化 bean,替换 @Value 占位符 bean 属性上的值,调用 ...
It is entirely configurable: you can choose the category of product displayed in the module, choose the template which will be used to display the product (HTML file with Tokens)… Store Account ...
It is entirely configurable: you can choose the category of product displayed in the module, choose the template which will be used to display the product (HTML file with Tokens)… Store Account ...
It is entirely configurable: you can choose the category of product displayed in the module, choose the template which will be used to display the product (HTML file with Tokens)… Store Account ...
* Versatility of theme installation options. Stylus supports installs from popular online repositories. Additionally, styles can now also be installed from .user.css or .user.styl URLs (see Usercss ...
目录使用REST API REST API基础通过传递令牌进行身份验证获取路由表添加新路线删除路线自定义错误页面基于主机的路由故障排除 安装先决条件: Node.js≥6 如果要在Linux中安装configurable-http-proxy ,则可以按照...
The design uses a configurable Weighted Overlap-Add (WOLA) filterbank coprocessor to implement the analysis and synthesis filterbanks. A new method to convert the two-times over-sampled, complex ...