//load configurable product
$product = Mage::getModel('catalog/product')->load(some_id);
//load all children
$childProducts = Mage::getModel('catalog/product_type_configurable')
->getUsedProducts(null,$product);
foreach($childProducts as $child){
$_child = Mage::getModel('catalog/product')->load($child->getId());
$childPrice = $_child->getPrice();
//compare the $childPrice
}
或者对于内联查询应该是这样的
<?php
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $db->query('SELECT a.product_id, a.product_super_attribute_id, ap.product_super_attribute_id, ap.pricing_value FROM catalog_product_super_attribute AS a INNER JOIN catalog_product_super_attribute_pricing AS ap ON a.product_super_attribute_id=ap.product_super_attribute_id WHERE a.product_id='.$_product->getId().' ORDER BY ap.pricing_value DESC LIMIT 1');
$rows = $result->fetch();
echo 'From '.Mage::helper('core')->currency($_product->getPrice()).' to '.Mage::helper('core')->currency($rows ['pricing_value']+$_product->getPrice());
?>
1 回答
尝试以下代码
或者对于内联查询应该是这样的
Edit (optional)