magento - How to get id of last purchase with multiple addresses?


Question: 

I have a payment method that needs to be redirected to the page it like paypal, I can add a code block on the page of success but need to know if petido that was just completed was paid with my payment method, so I can redirect.

Note: several people say it is not possible to redirect payments with multishipping.

I just want to get the id of the application of the current purchase being multishipping.

I got this way, but it's not exactly what I want:

$fromDate = date('Y-m-d') . ' 0:0:0';
$toDate = date('Y-m-d H:i:s');
$orderCollection = Mage::getModel('sales/order')->getCollection()
    ->addFieldToFilter('customer_id', array('eq' => array(Mage::getSingleton('customer/session')->getCustomer()->getId())));
$orderCollection = $orderCollection->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate));
foreach($orderCollection as $order_row){



1 Answer: 

Solution:

$last_quote_id = Mage::getSingleton('checkout/session')->getLastQuoteId();
$orderCollection = Mage::getModel('sales/order')->getCollection()
    ->addFieldToFilter('customer_id', array('eq' => array(Mage::getSingleton('customer/session')->getCustomer()->getId())));
$orderCollection = $orderCollection->addFilter('quote_id', $last_quote_id);
foreach($orderCollection as $order_row){
    if($order_row->getPayment()->getMethodInstance()->getTitle() == 'PagSeguro'){ $pagseguro = 1; }
    echo $order_row->getId() . ' - ' . $order_row->getPayment()->getMethodInstance()->getTitle() . '<br />';    
} 
 

More Articles


Xcode: App installation failed No code signature found

I want run app on real device ( iphone 6 or 8 )But i get this error : App installation failed No code signature found.I try all below solutions but not work for me:iOS app testing. App installation failed. No code signature foundMy xcode version is 9.2I'm tired :(

Google Smart Home Action: Account linking successful, SYNC response sent by fulfillment with status code 200 but Google Home app reporting error

I am building a Google Smart Home action with fulfillment hosted on AWS as a lambda function in node.js with the node implementation for Google Smart Home actions, exposed via AWS API gateway and an external OAuth 2 provider serving as authorizer for API gateway. My fulfilment includes SYNC, QUERY a

payment processing - pylons/python

I'm building an application that eventually needs to process cc #s. I'd like to handle it completely in my app, and then hand off the information securely to my payment gateway. Ideally the user would have no interaction with the payment gateway directly.Any thoughts? Is there an easier way?


Magento Payment methods are not showing in checkout

I have a website in magento. iam using payment methods paypal, bank transfer and stripe. using multi store view(3)Except paypal remaning payment methods are not showing in checkout process. i dont know what to do. please help me any one,Thanks,

java - JFrame as a dialog

I want to customize the jframe and that frame should work like a joptionpane. which is relative with parent. can i do like this. if it is possible please any one help me.

How to use API in actions-on-google

I have tried the following javascript code, using a railway API in aog for getting names of trains between 2 stations.train : function(conv,src,dst) {const options={ method:'GET', url : `https://api.railwayapi.com/v2/between/source/${src}/dest/${dst}/date/23-09-2018/apikey/<api_key>/`,


Integrate with RBS WorldPay Hosted Payment Page (XML Redirect) using Python

Does anyone have any example code for integrating with RBS WorldPay using Python? Specifically posting the XML order to WorldPay

c# passing cookies as a parameter in sql

I am trying to save cookies on a login page pass it to another page where it will be used as a parameter in sql.saving cookies and redirecting to new page;HttpCookie cookie = new HttpCookie("UserID");cookie["UserID"] = reader["UserID"].ToString();Response.Cookies.Add(cookie);Response.Redirect("Home.

azure CloudBlobDirectory.ListBlobs() returns "The specified resource does not exist.", but fetchAttributes() works using same data

I am getting a "The specified resource does not exist" exception when I try to iterate the result of a ListBlobs() call. I can get the blob attributes when I access it directly, but I'm trying to get a list of all the blobs in the subdirectory.I wrote this little test to see exactly where the probl

IPN - PAYPAL No Return POST Data on Mobile

Many people are struggling with this one, when getting the return from PayPal there is no POST data if you use a mobile device (fine on desktop), so you can not run the IPN as there is no data to send.What do PayPal expect us to do, I have contacted PayPal support but they have not answered, this is