0

The payment method I have uses a third party gateway. I need to forward the Increment Order ID to them.

public function getOrderPlaceRedirectUrl() {
    return Mage::getUrl('shopping/checkout/forwardweb', array('_secure' => true));
}

What I would like to do is to get the order and send the $order->getIncrementId().

I tried using $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();

But for some reason, it's always returning the same order id, no matter how many times I check out my cart, and if I go to the website, and list the orders, the new orders are not being added to the list, and it's always empty.

1
  • Have you check at table sales_flat_order ?
    – Amit Bera
    Oct 2, 2015 at 9:54

1 Answer 1

1

You can get the last order increment id by

$last_order_increment_id = Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId();

You will need to save reserveOrderId in quote.

Mage_Sales_Model_Quote::reserveOrderId()

Paypal express method doing the same in function

Mage_Paypal_Model_Express_Checkout::start()

You can follow the way it is doing and send your increment id same way for your payment method.

2
  • But how do I get the ID of the order that was created by the checkout page for that customer, rather than just the last order id?
    – Pat
    Oct 2, 2015 at 10:25
  • edited my answer. Oct 2, 2015 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.