在Magento中可能出现以下情况吗?
分级定价和批量折扣将适用于同一订单。总共超过200美元,我想要4%的折扣。然而,分级定价的产品价格将不会被视为批量折扣规则。
例如,我有4个产品
product 1 price = 10 and having tier price = $8 for 5+ products
product 2 price = 10
product 3 price = 100
product 4 price = 140所以如果我点这样的菜
product 1 qty-6 price = $48
priduct 2 qty-1 price = 10
priduct 3 qty-1 price = 100
priduct 4 qty-1 price = 140我们对产品1应用阶梯定价,该产品不符合批量定价的条件。但是,剩余的金额仍有资格进行批量定价。这意味着$250 (10 + 100 + 140)将享受4%的折扣。
我需要减去在购物车中应用了阶梯价格的产品总数,并需要根据我的购物车规则检查剩余的产品总数以获得折扣。
有没有人可以指导我如何做到这一点?
发布于 2013-04-12 10:06:07
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);
}
}https://stackoverflow.com/questions/15787794
复制相似问题