Magento 1.9 Onepage Checkout – Fix Auto Redirect to Cart Issue

magento-1.9onepage-checkout

During one page checkout, after filling the shipping address and click upon next button page again redirects to cart page?

No errors are displaying and my log file also empty.

On app\code\core\Mage\Checkout\controllers\OnepageController.php file inside the method saveShippingAction() I can see $this->_getShippingMethodsHtml(). This causes the error.

To find the error on root folder index.php I changed the below line

#ini_set('display_errors', 1);

into

ini_set('display_errors', 1);

now on console I found below issue,

<br />
<b>Fatal error</b>:  Can't use method return value in write context in <b>/magento/htdocs/app/design
/frontend/default/default/template/deliverydate/shipping_method/available.phtml</b> on line <b>67</b
><br />

on available.phtml line no 67 I can find below:

<?php if(!empty($_rate->getMethodDescription())):?>
        <p class="address-block hide">
            <?php echo $_rate->getMethodDescription(); ?>
        </p>
<?php endif;?>

Note: The same is working fine on my local server, I faced this issue on production server only.

Best Answer

PHP empty function, prior to PHP 5.5.0 only accepts variables as parameters; see here http://php.net/manual/en/function.empty.php. Are you running different PHP versions on your local vs production?

Related Topic