Created
December 4, 2013 20:52
-
-
Save ryaan-anthony/7795296 to your computer and use it in GitHub Desktop.
Hide all payment methods if none needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Your_Custom_Block_Rewrite extends Mage_Checkout_Block_Onepage_Payment_Methods | |
| { | |
| protected function _canUseMethod($method) | |
| { | |
| $total = $this->getQuote()->getShippingAddress()->getBaseGrandTotal(); | |
| if((float)$total > 0){return parent::_canUseMethod($method);} | |
| if($method->getCode() != 'free'){ | |
| return false; | |
| } | |
| return parent::_canUseMethod($method); | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <config> | |
| <modules> | |
| <Your_Custom> | |
| <version>0.1.0</version> | |
| </Your_Custom> | |
| </modules> | |
| <global> | |
| <blocks> | |
| <custom> | |
| <class>Your_Custom_Block</class> | |
| </custom> | |
| <checkout> | |
| <rewrite> | |
| <onepage_payment_methods>Your_Custom_Block_Rewrite</onepage_payment_methods> | |
| </rewrite> | |
| </checkout> | |
| </blocks> | |
| </global> | |
| </config> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment