I got an answer to this same question on StackOverflow by user Elvarasan. His answer provided me with everything I needed to get this working.
To hide some payment methods based on shipping method you don't need to observe things at all:
Every methods(in one page check out) post the methods which are chosen to the next level. So you can get the shipping method which are chosen, in payment method level. Just print the post things in
app/design/frontend/base/default/template/checkout/onepage/payment/methods.phtml
in this add below one,
<?php print_r($_POST); ?>
So now you can get the shipping methods which are chosen previous step. And note it, so now, you can add just simple logic (if else) condition in same file for hiding payment.
For example here I want hide check / money order
payment method, if shipping method is flat
. Here the payment method code is checkmo
. you can get payment method code by simply printing that variable like echo $_code = $_method->getCode();
in same file. so here just add simple if else ,
<?php
$methods = $this->getMethods();
$oneMethod = count($methods) <= 1;
?>
<?php if (empty($methods)): ?>
<dt>
<?php echo $this->__('No Payment Methods') ?>
</dt>
<?php else:
foreach ($methods as $_method):
echo $_code = $_method->getCode();
if($_POST['shipping_method'] == 'flatrate_flatrate') {
if($_code == 'checkmo') {
continue;
}
}
?>
Here,
if($_POST['shipping_method'] == 'flatrate_flatrate') {
if($_code == 'checkmo') {
continue;
}
}
checks the shipping method and skip the payment method which we don't want to display. That's it. Please comment here if you have any doubt.
Note:
shipping_method => flatrate_flatrate
payment_method => checkmo
Setting Up Free Shipping
Free shipping is one of the most effective promotions you can offer. It can be based on a minimum purchase, or set up as a shopping cart price rule that applies when a set of conditions has been met. If both apply to the same order, the configuration setting will take precedence over the shopping cart rule.
See your shipping carrier configuration for any additional settings
that may be required for free shipping.
Free Shipping In Shopping Cart
To set up free shipping:
On the Admin menu, select System > Configuration.
In the Configuration panel on the left, under Sales, select Shipping Methods.
Click to expand the Free Shipping section. Then, do the following:
Set Enabled to “Yes.”
Enter the
Title for this shipping method that you want to appear during checkout.
Enter a descriptive
Method Name to internally identify this shipping method.
Enter the
Minimum Order Amount to qualify an order for free shipping.
To use Free Shipping with Table Rates, you must enter a Minimum Order Amount so high that it is never met. This prevents Free Shipping from going into effect, unless triggered by a price rule.
In the
Displayed Error Message box, type the message to appear if this method becomes unavailable.
Set
Ship to Applicable Countries to one of the following:
All Allowed CountriesCustomers from all countries specified in your store configuration can use this shipping method.
Specific CountriesAfter choosing this option, the Ship to Specific Countries list appears. Select each country in the list where this shipping method can be used. (To select multiple options, hold the Ctrl (PC) or Command (Mac) key down, and click each option.)
Set
Show Method if Not Applicable to one of the following:
YesAlways shows the Free Shipping method, even when not applicable.
NoShows the Free Shipping method only when applicable.
Enter a
Sort Order number to determine the position of Free Shipping in the list of shipping methods during checkout. (0 = first, 1 = second, 2 = third, and so on.)
Make sure that you complete any configuration settings that are required for each
carrier you plan to use with free shipping. For example, assuming that your UPS configuration is otherwise
complete, make the following settings to enable and configure free shipping:
From the Shipping Methods configuration, click to expand the UPS section.
In the UPS section, set
Free Method to “Ground.”
To require a minimum order for free shipping, set
Free Shipping with Minimum Order Amount to “Enable.”
Enter the required amount in the
Minimum Order Amount for Free Shipping field.
When complete, click the Save Config button.
Best Answer
Try selecting a specific shipping method under Free Method in
System -> Configuration -> Shipping Methods
and expanding your shipping method of choice. Then, expand all other shipping methods and make sure "Free Method" is set to "none". Ensure this option hasn't also been set in another scope.