public static function calculatePrice($basePrice, $specialPrice, $specialPriceFrom, $specialPriceTo,
$rulePrice = false, $wId = null, $gId = null, $productId = null)
{
Varien_Profiler::start('__PRODUCT_CALCULATE_PRICE__');
if ($wId instanceof Mage_Core_Model_Store) {
$sId = $wId->getId();
$wId = $wId->getWebsiteId();
} else {
$sId = Mage::app()->getWebsite($wId)->getDefaultGroup()->getDefaultStoreId();
}
$finalPrice = $basePrice;
if ($gId instanceof Mage_Customer_Model_Group) {
$gId = $gId->getId();
}
$finalPrice = self::calculateSpecialPrice($finalPrice, $specialPrice, $specialPriceFrom, $specialPriceTo, $sId);
if ($rulePrice === false) {
$storeTimestamp = Mage::app()->getLocale()->storeTimeStamp($sId);
$rulePrice = Mage::getResourceModel('catalogrule/rule')
->getRulePrice($storeTimestamp, $wId, $gId, $productId);
}
if ($rulePrice !== null && $rulePrice !== false) {
$finalPrice = min($finalPrice, $rulePrice);
}
$finalPrice = max($finalPrice, 0);
Varien_Profiler::stop('__PRODUCT_CALCULATE_PRICE__');
return $finalPrice;
}
在Mage_Catalog_Model_Product_Type_Price
有
if ($rulePrice === false) {
$storeTimestamp = Mage::app()->getLocale()->storeTimeStamp($sId);
$rulePrice = Mage::getResourceModel('catalogrule/rule')
->getRulePrice($storeTimestamp, $wId, $gId, $productId);
}
左右的時間內$ rulePrice ==產品的數量以及是否有任何批量定價假支票適用,如果是,那麼
if ($rulePrice === false) {
$storeTimestamp = Mage::app()->getLocale()->storeTimeStamp($sId);
$flag = $this->someCheckFunction() // This function you will have to write
if($flag == 1) {
$rulePrice = Mage::getResourceModel('catalogrule/rule')
->getRulePrice($storeTimestamp, $wId, $gId, $productId);
}
}
你試圖創建它不工作或什麼? – Meabed