Tweeted twitter.com/#!/StackMagento/status/477714150911533056
3 added 1057 characters in body
source | link

Is it possible to retrieve all shipping carrier/rates starting from an Order instead of using a quote ?

UPDATE

With the following code I'm converting the order to a quote and the address. There is still some issue: Mage_Sales_Model_Quote_Address::requestShippingRates() is returning false (this is called by collectTotals())

$converter = mage::getModel('sales/convert_order');
$quote = $converter->toQuote($this->getOrder());
$quoteAddress = $converter->toQuoteShippingAddress($this->getOrder());

foreach ($this->getOrder()->getAllItems() as $item) {
//            $itemW = $item->getWeight();
//            $itemQty = $item->getWeight();
//            $itemTotalWeight = $itemW * $itemQty;

                $quoteItem = $converter->itemToQuoteItem($item);
                $quoteItem->setQuote($quote);
                $quoteItem->setQty($item->getQtyOrdered());
                $quoteItem->setWeight($item->getWeight());
                $quote->addItem($quoteItem);

                $quoteAddress->addItem($quoteItem);
            }
$quoteAddress->setQuote($quote);
$quoteAddress->setCollectShippingRates(true);
$quoteAddress->collectTotals();

Is it possible to retrieve all shipping carrier/rates starting from an Order instead of using a quote ?

Is it possible to retrieve all shipping carrier/rates starting from an Order instead of using a quote ?

UPDATE

With the following code I'm converting the order to a quote and the address. There is still some issue: Mage_Sales_Model_Quote_Address::requestShippingRates() is returning false (this is called by collectTotals())

$converter = mage::getModel('sales/convert_order');
$quote = $converter->toQuote($this->getOrder());
$quoteAddress = $converter->toQuoteShippingAddress($this->getOrder());

foreach ($this->getOrder()->getAllItems() as $item) {
//            $itemW = $item->getWeight();
//            $itemQty = $item->getWeight();
//            $itemTotalWeight = $itemW * $itemQty;

                $quoteItem = $converter->itemToQuoteItem($item);
                $quoteItem->setQuote($quote);
                $quoteItem->setQty($item->getQtyOrdered());
                $quoteItem->setWeight($item->getWeight());
                $quote->addItem($quoteItem);

                $quoteAddress->addItem($quoteItem);
            }
$quoteAddress->setQuote($quote);
$quoteAddress->setCollectShippingRates(true);
$quoteAddress->collectTotals();
2 edited title
| link

Get Shipping Rates/Carriers from an existing Order

1
source | link

Get Shipping Rates from an existing Order

Is it possible to retrieve all shipping carrier/rates starting from an Order instead of using a quote ?