After a research, finally I found the function getProductByAttributes
in app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php
, use it could get the child simple product like below.
$childProduct = Mage::getModel('catalog/product_type_configurable')->getProductByAttributes($params['super_attribute'], $product);
The function getProductByAttributes
could use a reference when need write similar function, so I will show it here for future reference.
/**
* Retrieve used product by attribute values
* $attrbutesInfo = array(
* $attributeId => $attributeValue
* )
*
* @param array $attributesInfo
* @param Mage_Catalog_Model_Product $product
* @return Mage_Catalog_Model_Product|null
*/
public function getProductByAttributes($attributesInfo, $product = null)
{
if (is_array($attributesInfo) && !empty($attributesInfo)) {
$productCollection = $this->getUsedProductCollection($product)->addAttributeToSelect('name');
foreach ($attributesInfo as $attributeId => $attributeValue) {
$productCollection->addAttributeToFilter($attributeId, $attributeValue);
}
$productObject = $productCollection->getFirstItem();
if ($productObject->getId()) {
return $productObject;
}
foreach ($this->getUsedProducts(null, $product) as $productObject) {
$checkRes = true;
foreach ($attributesInfo as $attributeId => $attributeValue) {
$code = $this->getAttributeById($attributeId, $product)->getAttributeCode();
if ($productObject->getData($code) != $attributeValue) {
$checkRes = false;
}
}
if ($checkRes) {
return $productObject;
}
}
}
return null;
}