English 中文(简体)
如何在程序上标记订单失败 - Magento
原标题:How to mark an order failed programmatically - Magento
  • 时间:2012-05-24 18:16:29
  •  标签:
  • php
  • magento

我只想知道,当设定时将命令标记为失败的属性是什么,这样 failure Action () ap/code/col/Mage/Mage/ checkout/controller/ Onepagecurrent.php () app/code/code/col/Mage/Mage/ checkout/control/ Onepagecurrent.php 就会被调用。

我有一个观察家.php, 我在哪里为成功付款和失败付款开具发票, 在 sustaid_ paying 状态下开出保存单 paying 状态下, 并想用上方的错误信息将它们改到手推车页 。

这一切都完好无损。 仅仅对于未成功/ 失败的付款, 加上未了的付款状态, 加上未了的付款状态, n 将它们改到有错误信息的车页, 我还想保留/ 保存该车, 以免被空掉 。

但无福无福

观察员.php

 public function implementOrderStatus($event)
 {
    $order = $event->getEvent()->getOrder(); 
    if ($this->_getPaymentMethod($order) ==  mypaymentmodule ) 
    {
                $quote = Mage::getModel( sales/quote )->load($order->getQuoteId());
        if($order->getPayment()->getCcTransId() == NULL)
        {
            $order->cancel();
            $order->setStatus( canceled );
            $order->save();
            $quote->setIsActive(1)->save();
            /*$state =  pending_payment ;
            $status =  pending_payment ;
            $comment =  Payment transaction failed due to incorrect AVS/CVD details. ;
            $isNotified = false;
            $order->setState($state,$status,$comment,$isNotified)->save();
            $order->setCanSendNewEmailFlag(false);*/

            Mage::getSingleton( checkout/session )->addError( Sorry, either of your card information (billing address or card validation digits) dint match. Please try again );                 

            Mage::app()->getFrontController()->getResponse()->setRedirect( checkout/cart/ )->sendResponse();
        }
       else
       {
           if ($order->canInvoice())

            $this->_processOrderStatus($order);
       }
    }
    return $this;
}

$quot- & gt; setIsAspecial( true)-gt;saave () 似乎没有在玩这个把戏。 对于在以取消状态保存命令后如何让我的车不空的问题, 任何帮助 。

最佳回答

您也许应该查看 ./ app/code/ core/Mage/ Sales/ Model/ Order.php 。 您可以在命令中找到多个常数, 可用于设置这样的命令状态 :

<?php
// [...] all your code within your custom action or script

//load your order by order_id (or by increment_id, if you like to, here, it s your order id
$order = Mage::getModel( sales/order )->load($your_order_id);
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED); //or whatever distinct order status you d like
$order->save();

控制器动作中 failure Action 中的 Action 没有做任何这类事情, 如果您想要人工称呼它, 您可以使用 Mage::: getUrl () 来构建它 URL 。

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...