2016-09-20 104 views
1

如果產品價格等於零'0',我需要替換或隱藏產品列表頁面上的購物車按鈕。Magento產品價格等於0顯示文本

喜歡這裏:http://www.lighting-furniture-design.com/luxury-lighting/ceiling-suspensions/deep-sky-2565.html

我的演示站點是在這裏:http://www.sllv2.lighting-design-led.com/luminaire-de-luxe.html

請幫助我。

感謝

+0

由於Stack Overflow是一個[編程相關](http://stackoverflow.com/help/on-topic)問答站點,因此我正在投票結束此問題。你的問題不是關於編程。也許你應該在http://magento.stackexchange.com上發佈它呢? – Enigmativity

回答

1

你可以用下面的if else在你添加到購物車按鈕

<?php if ($_product->getFinalPrice() == 0) : ?> 
    <h2>On demand</h2> 
<?php else: ?> 
    // Your add to cart button here 
<?php endif; ?> 
+1

這就是我想要的:)非常感謝你 –

1

如果你想更換鈕文,當時的價格是零。複製主題中的文件addtocart.phtml。將buttonTitle更改爲下方。它會檢查價格,並相應地可以更改文字。

<?php $buttonTitle = (($_product->getFinalPrice() > 0) ? 
      Mage::helper('core')->quoteEscape($this->__('Add to Cart')) : 
      "your text"); 
    ?> 
+0

謝謝..工作:) –