First of all i will explain you about the actuall functionality:

  1. Customer buys in shop via PayPal
  2. Shop operators call the order from an external software (WaWi; don't know in en) and the software sets the order state to complete
  3. Shop operators collect the money at paypal, based on their seller account, from customer
  4. After that, Paypal sends after some time an automatic Ipn request back to magento and set the order back to pending

The thing is to prevent paypal (or Ipn Model) from setting the order from state finished back to pending.

We allready did some modifications to the class: Mage_Paypal_Model_Ipn in Mage/Paypal/Model/Ipn.php. In my opinion is there the responsible code in _registerPaymentCapture(). Here are our edits (marked with Edit):

 if ($this->getRequestData('transaction_entity') == 'auth') {
    $payment = $this->_order->getPayment();

    /* Edit: check if order state is complete */
    $orderStateComplete = (Mage_Sales_Model_Order::STATE_COMPLETE == $this->_order->getState());

    $orderStatusBefore = $this->_order->getStatus();
        ->setShouldCloseParentTransaction('Completed' === $this->getRequestData('auth_status'))

    /* Edit: reset state and status, if order was already complete before */
    if ($orderStateComplete) {

    // notify customer
    $invoice = $payment->getCreatedInvoice();
    if ($invoice && !$this->_order->getEmailSent()) {
            Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId())

The problem is still there and i don't know where to edit the file to prevent order state changes.

greetz & thanks in advance


1 Answer 1


We managed it. The problem was that the ERP Software the order state didn't set, just the status, so the condition didn't woked.


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.