2012-08-28 22 views
2

首先,我使用的是Magento 1.7。Magento - 貝寶爭議自動創建貸項憑證

問題是,如果有人打開貝寶爭議,還會在Magento中創建一個信用備忘錄電子郵件,並且會向客戶發送一封電子郵件,告訴他們他們已經退款。相反,PayPal只是在爭議解決之前持有資金。

當我們解決糾紛時,信用備忘錄仍然存在,我們不能刪除或取消它。

有誰知道如何防止這種情況發生?

謝謝。

馬立克

回答

1

,我覺得這是我從v1.4.0.1升級到v1.7.0.2後遇到的Magento的較新版本的惱人的錯誤。我認爲它在v1.4.2.0左右。有很多方法可能會出錯我不知道他們爲什麼認爲這是一個好主意添加它。

支持此操作的代碼位於/app/code/core/Mage/Sales/Model/Order/Payment.php中的Mage_Sales_Model_Order_Payment類的registerRefundNotification()方法中。

每個timpea的修復在http://www.magentocommerce.com/boards/viewthread/261158/你只需要重載registerRefundNotification()並註釋掉冒犯的部分,在v1.7.0.2將是下面的部分。

$serviceModel = Mage::getModel('sales/service_order', $order); 
if ($invoice) { 
    if ($invoice->getBaseTotalRefunded() > 0) { 
     $adjustment = array('adjustment_positive' => $amount); 
    } else { 
     $adjustment = array('adjustment_negative' => $baseGrandTotal - $amount); 
    } 
    $creditmemo = $serviceModel->prepareInvoiceCreditmemo($invoice, $adjustment); 
    if ($creditmemo) { 
     $totalRefunded = $invoice->getBaseTotalRefunded() + $creditmemo->getBaseGrandTotal(); 
     $this->setShouldCloseParentTransaction($invoice->getBaseGrandTotal() <= $totalRefunded); 
    } 
} else { 
    if ($order->getBaseTotalRefunded() > 0) { 
     $adjustment = array('adjustment_positive' => $amount); 
    } else { 
     $adjustment = array('adjustment_negative' => $baseGrandTotal - $amount); 
    } 
    $creditmemo = $serviceModel->prepareCreditmemo($adjustment); 
    if ($creditmemo) { 
     $totalRefunded = $order->getBaseTotalRefunded() + $creditmemo->getBaseGrandTotal(); 
     $this->setShouldCloseParentTransaction($order->getBaseGrandTotal() <= $totalRefunded); 
    } 
} 

$creditmemo->setPaymentRefundDisallowed(true) 
    ->setAutomaticallyCreated(true) 
    ->register() 
    ->addComment(Mage::helper('sales')->__('Credit memo has been created automatically')) 
    ->save(); 

$this->_updateTotals(array(
    'amount_refunded' => $creditmemo->getGrandTotal(), 
    'base_amount_refunded_online' => $amount 
)); 

$this->setCreatedCreditmemo($creditmemo); 
+0

謝謝!會試試看! – Marek123