如果在Magento中取消了订单状态,如何一次停止相同订单的订单处理? [英] How to stop order processing of same order once if order status is canceled in Magento?

查看:95
本文介绍了如果在Magento中取消了订单状态,如何一次停止相同订单的订单处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦取消订单,如何停止处理同一订单? 我使用的是贝宝付款方式,如果我从贝宝网关取消订单(取消并返回),则从贝宝下订单,它将订单状态设置为已取消并重定向到购物车页面,但是如果我按浏览器返回按钮,然后将我重定向到Paypal付款网关页面,付款成功完成.我的订单状态历史记录显示为待付款已取消订单处理准备交付.

How to stop processing of the same order once the order is cancelled ? I'm using paypal payment method,While placing the order from paypal if I cancel the order from the paypal gateway (Cancel and return),it set the order status as cancelled and redirected to the cart page, but again if I press browser back button, then it redirects me back to the paypal payment gateway page,and the payment is done succesfully.My order status history shows as Pending Payment,Canceled,Order Processing,Preparing for delivery.

我该如何阻止呢?

我尝试使用事件和观察者更新订单状态,但仍然无法停止此处理.

I tried to update the order status using event and observer, but still I unable to stop this processing.

$order = $observer->getEvent()->getPayment()->getOrder();
$order=Mage::getModel('sales/order')->load($order->getEntityId());
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true);
$order->setStatus("canceled");
$order->save();

推荐答案

我认为您的状态已更改,但状态未更改,请尝试下面的代码.

i think problem with you status is change but the state is not changing try below code..

              $order->setData('state', Mage_Sales_Model_Order::STATE_CANCELED); 
              $order->setStatus("canceled");
              $history = $order->addStatusHistoryComment('', false);
              $history->setIsCustomerNotified(false);
              $order->save(); 

这篇关于如果在Magento中取消了订单状态,如何一次停止相同订单的订单处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆