我已经配置了一个Magento 1.9社区商店,所有通过Paypal或其他付款方式(如货到付款)付款的订单都会显示在后端.
但是,当我结帐选择Paypal作为网关时,在Paypal页面上取消我的订单并返回到网站 - 我的订单没有显示在管理员中.它不应该显示为已取消的订单.
由于这是从Shopify迁移的商店,我们必须手动创建大约100个订单并手动更改数据库中的日期.这可能是这种意外行为的原因吗?
编辑1:即使paypal窗口关闭而不是单击取消,因此网格中不显示订单信息,因为许多答案都在建议.
这是显而易见的,因为当您(作为客户)在PayPal付款页面中取消订单时,它会在重定向到商店之前自动销毁(取消设置)订单和订单报价 - 不要与着名的:已取消的订单混淆,顾名思义显示实际完成然后取消的实际订单.
根据您使用的PayPal方法,可以区别对待.
在标准的PayPal中,您可以在此控制器中找到它:
\ Magento的\应用\代码\核心\法师\贝宝\控制器\ StandardController.php
当您取消订单时cancelAction()
,它首先取消订单:
public function cancelAction()
{
$session = Mage::getSingleton('checkout/session');
$session->setQuoteId($session->getPaypalStandardQuoteId(true));
if ($session->getLastRealOrderId()) {
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
if ($order->getId()) {
$order->cancel()->save();
}
Mage::helper('paypal/checkout')->restoreQuote();
}
$this->_redirect('checkout/cart');
}
Run Code Online (Sandbox Code Playgroud)
然后redirectAction()
在重定向回购物车页面之前取消设置报价:
public function redirectAction()
{
$session = Mage::getSingleton('checkout/session');
$session->setPaypalStandardQuoteId($session->getQuoteId());
$this->getResponse()->setBody($this->getLayout()->createBlock('paypal/standard_redirect')->toHtml());
$session->unsQuoteId();
$session->unsRedirectUrl();
}
Run Code Online (Sandbox Code Playgroud)
另一方面,在PayPal Express中,在此控制器中触发取消操作:
\程序\代码\核心\法师\宝\控制器\快\ Abstract.php
public function cancelAction()
{
try {
$this->_initToken(false);
// TODO verify if this logic of order cancelation is deprecated
// if there is an order - cancel it
$orderId = $this->_getCheckoutSession()->getLastOrderId();
$order = ($orderId) ? Mage::getModel('sales/order')->load($orderId) : false;
if ($order && $order->getId() && $order->getQuoteId() == $this->_getCheckoutSession()->getQuoteId()) {
$order->cancel()->save();
$this->_getCheckoutSession()
->unsLastQuoteId()
->unsLastSuccessQuoteId()
->unsLastOrderId()
->unsLastRealOrderId()
->addSuccess($this->__('Express Checkout and Order have been canceled.'))
;
} else {
$this->_getCheckoutSession()->addSuccess($this->__('Express Checkout has been canceled.'));
}
} catch (Mage_Core_Exception $e) {
$this->_getCheckoutSession()->addError($e->getMessage());
} catch (Exception $e) {
$this->_getCheckoutSession()->addError($this->__('Unable to cancel Express Checkout.'));
Mage::logException($e);
}
$this->_redirect('checkout/cart');
}
Run Code Online (Sandbox Code Playgroud)
它在同一个地方取消了一切.
因此,在您的情况下,如果您需要保留引号(我认为这是您在自定义模块中利用的内容),则必须更改PayPal模块的此行为.
请记住,如果您要这样做,请不要修改原始核心文件,而是在自定义模块中扩展这些类并在那里应用您的更改.
归档时间: |
|
查看次数: |
1485 次 |
最近记录: |