-
16-10-2019 - |
题
对于产品,我有目录价格规则和级别的价格。
当我将物品添加到Cart Magento时,价格总是最低的。是否有任何方法可以根据目录价格规则将其设置为按价格设置?
我搜索了,但没有为此找到解决方案。有任何管理设置吗?
解决方案
可以在mage_catalog_model_product_type_price中找到驾驶价格的代码
public function getFinalPrice($qty=null, $product)
{
if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
return $product->getCalculatedFinalPrice();
}
$finalPrice = $product->getPrice();
$finalPrice = $this->_applyTierPrice($product, $qty, $finalPrice);
$finalPrice = $this->_applySpecialPrice($product, $finalPrice);
$product->setFinalPrice($finalPrice);
Mage::dispatchEvent('catalog_product_get_final_price', array('product'=>$product, 'qty' => $qty));
$finalPrice = $product->getData('final_price');
$finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
return max(0, $finalPrice);
}
在_applytierprice中
$finalPrice = min($finalPrice, $tierPrice);
并通过_applyspecialprice
$finalPrice = min($finalPrice, $specialPrice);
没有任何选择,它将返回最低价格。
在我看来,这也与客户的期望相符!
如果您想更改此行为,则可以观察事件Catalog_product_get_final_price并使用$ product-> setData('Final_price',x.yz);达到您想要的价值。