I have several shipping methods. And each method has own rates.
But I cannot get it while the user enters his address.
I would like to get all active shipping methods and their rates.
After user selected shipping methods he should select payment method (depends on shipping method) and fill his address fields (fields also depends on shipping method).
To get all shipping methods is simply enough:
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
But to get its rates without address – a little bit complex.
Any ideas on how to solve it?
Perhaps someone could recommend some modules.
Best Answer
I don't know any module, however you could find a way to include or reorder the checkout process as explained below. It could help you to develop a solution.
I wanted one day add a step in the middle of the checkout process. At the moment, there is no official way to do it, I mean you don't have any events which allows to change the behavior.
The solution I found consist to modify the class
Mage_Checkout_Block_Onepage_Abstract
. Attention, it's not a classic model, it's an abstract, you can't overwrite it by using the tag<rewrite>
inconfig.xml
file.So, you have to copy the file
app/code/core/Mage/Checkout/Block/Onepage/Abstract.php
toapp/code/local/Mage/Checkout/Block/Onepage/Abstract.php
, edit the file by adding (if you use Magento 1.5) or editing (if you use Magento >= 1.6), the method_getStepCodes
as showned below. In this case, you can change the order of the steps, add your own or remove steps. Take care of the consequences of such changes.EDIT
The code I provide here was a code proposed to Magento core team to allow customized steps, that's one of the reason why the Mage namespace and the Abstract are used.
The block
checkout/onepage
class is also rewritten: