标题('位置:'。$ newurl)在我的Magento中不起作用

时间:2015-07-30 07:58:25

标签: php .htaccess magento redirect payment-gateway

在我的Magento我有2个商店,我想在我的Magento中集成示例支付网关。在magento中,如果Transaction Status为Success,则会有一个像这样的逻辑去重定向Success Page else重定向到Failure Page。

但是从PG方面来看,他们没有这种逻辑,他们只想要一个URL,当来自我的网站的任何请求他们只需要重定向到那个URL时,所以最后我决定这样。

  1. 刚刚在我的根文件夹中创建了一个.php文件(根文件夹/ example / redirect.php)。
  2. PG正在将客户重定向到此URL,此PG也会发布一些响应。
  3. 根据PG的反应,我在redirect.php中写了一些代码,请找到下面的代码。

        <?php
            header("Pragma: no-cache");
            header("Cache-Control: no-cache");
            header("Expires: 0");
    
            $mageFilename = '../app/Mage.php';
            require_once $mageFilename;
            Mage::app();
    
            if (empty($_REQUEST['ORDERID'])) {
                $_order_orig = Mage::getModel('sales/order')->loadByIncrementId($_REQUEST['ORDERID']);
                $store_id = $_order_orig->getStoreId();
    
                if ($_REQUEST['STATUS'] == 'TXN_SUCCESS' && $_REQUEST['RESPCODE'] == 01) {
                    if($store_id == 2)
                        $newurl = 'https://example.com/secondstore/index.php/checkout/onepage/success?status=TRANSACTION SUCESSFUL';
                    else
                        $newurl = 'https://example.com/index.php/checkout/onepage/success?status=TRANSACTION SUCESSFUL';
    
                    header('Location: '.$newurl);
                    die();
                } else {
                    if($store_id == 2)
                        $newurl = 'https://example.com/secondstore/index.php/checkout/onepage/failure/?status=TRANSACTION FAILURE';
                    else
                        $newurl = 'https://example.com/index.php/checkout/onepage/failure/?status=TRANSACTION FAILURE';
    
                    header('Location: '.$newurl);
                    die();
                }
            } else {
                $newurl = 'https://example.com/index.php/checkout/onepage/failure/?status=TRANSACTION FAILURE';
                header('Location: '.$newurl);
                die();
            }
        ?>
    

    每件事情都运转正常,但它会重定向到我的主页。

    但是同样的代码在我的暂存网站中运行良好。

    乳清它正在发生?

    有什么想法吗?

0 个答案:

没有答案