php - header('Location: '.$newurl) in not working in my Magento -
in magento have 2 store, want integrate example payment gateway in magento. in magento have logic if transaction status success go redirect success page else redirect failure page.
but pg side don't have type of logic wants 1 url, when request site redirect url, decided this.
- just created 1 .php file in root folder (root folder/example/redirect.php).
- the pg redirecting customers url along pg posting response also.
based on pg response written code in redirect.php please find code below.
<?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(); } ?>
every thing working fine redirecting homepage.
but same code working fine in staging site.
whey happening ?
any ideas ?
Comments
Post a Comment