I'm trying to set a custom shipping method in the cart by ajax. Using magento 184.108.40.206
It's sending an ajax-call to a new controller to set the new shipping method and returns the result and the updated cart totals.
Thats working but after an pagerefresh it's again showing the default shipping method. I have tested it with another shipping method that should work but it's the same, always back to default after an refresh.
I tried already all kind of ways to set the method. And It's updating the entries in the db 'sales_flat_quote_address' to the new shipping method. Basicly it's working...
I haven't found any observer or other call thats overriding the shipping method. It's changing back while loading the base grand totals in the quote.
$cart = Mage::getSingleton('checkout/cart'); $quote = $cart->getQuote(); $shippingAddress = $quote->getShippingAddress(); $shippingAddress->setCollectShippingRates(true) ->collectShippingRates() ->setShippingMethod($method); $quote->setTotalsCollectedFlag(false)->collectTotals()->save();
$result = $this->getOnepage()->saveShippingMethod($method); $this->getOnepage()->getQuote()->collectTotals()->save();
and similar ways.