cancel
Showing results for 
Search instead for 
Did you mean: 

'Please specify a shipping method' error even by selecting the shipping method

'Please specify a shipping method' error even by selecting the shipping method

We are developing an extension for freight and it works well in the cart.

At the checkout the shipping options appear and can be selected normally, but when I try to close the purchase order an alert with the message 'Please specify a shipping method' appears, even though I have already selected the shipping method.

When I query the Freight Platform API it returns a code that I have to pass in the shipping method, for example, 'mycustomshipping_transporter_code'. When I send without the code, for example 'mycustomshipping_transporter', it works.

My code is like this:

$shipping_method = $this->_offer_token . '_' . $carrier->oferta;

/** @var Mage_Shipping_Model_Rate_Result_Method $rate */
$method = Mage::getModel('shipping/rate_result_method');

$method->setCarrier($this->_code);
$method->setMethod($shipping_method);

Anyone have any idea what might be happening?

3 REPLIES 3

Re: 'Please specify a shipping method' error even by selecting the shipping method

Hi @davidalves,

 

Can you share the whole code of the class/shipping method?

Re: 'Please specify a shipping method' error even by selecting the shipping method

Thanks, but I resolved this problem. I didn't know that the collectRates method was called every time the step was changed in the checkout, so when was changing the step, the API was responding with a different code and the Magento was losting the shipping method

 

The module is on github: https://github.com/davidalves1/freterapido_magento

Re: 'Please specify a shipping method' error even by selecting the shipping method

Thanks for sharing the final solution.