我們有產品的混合物,其中一些使用specialPrice,一些使用Catalog Rules Sets。Magento:獲得優惠價格
我需要在我的前臺顯示我所有產品的折扣百分比。
我們使用$ _product-> getSpecialPrice()來獲得折扣價格,但是對於基於目錄規則的價格的產品而言,這是失敗的。
是否有可能根據目錄規則或specialPrice獲得折扣價格?
我們有產品的混合物,其中一些使用specialPrice,一些使用Catalog Rules Sets。Magento:獲得優惠價格
我需要在我的前臺顯示我所有產品的折扣百分比。
我們使用$ _product-> getSpecialPrice()來獲得折扣價格,但是對於基於目錄規則的價格的產品而言,這是失敗的。
是否有可能根據目錄規則或specialPrice獲得折扣價格?
試試這個片段: 這一個會計算價格規則。
Mage::getModel('catalogrule/rule')->calcProductPriceRule($product,$product->getPrice());
是你在找什麼?
是否有拉這個數據更快的方法?當然產品頁面不會像這樣拉動價格? –
目前我認爲有1種方法。特別是在產品收集形成的階段。所以,如果你需要這樣的自定義行爲,我會建議你寫一個自定義模塊的自定義資源模塊,實現與規則表和應用規則的連接。 –
是的,你可以使用$_product->getFinalPrice()
。
下面是三個價格的區別:
$regularPrice = number_format($_product->getPrice(), 2);
$discountedPrice = number_format($_product->getFinalPrice(), 2);
$specialPrice = number_format($_product->getSpecialPrice(), 2);
謝謝! – asherrard
嘗試$ _product-> getFinalPrice() –