0

I am new to magento. I am using the default rwd theme while placing the order im getting this wierd error message

"There was an error processing your order. Please contact us or try again later.
1. Action.php:saveOrderAction(418)-GBCustom_Checkout_OnepageController
2. Standard.php:dispatch(250)-Mage_Core_Controller_Varien_Action 
3. Front.php:match(172)-Mage_Core_Controller_Varien_Router_Standard 
4. App.php:dispatch(354)-Mage_Core_Controller_Varien_Front 
 5. Mage.php:run(694)-Mage_Core_Model_App 6. index.php:run(139)-Mage "

After error reporting:

#0 C:\xampp\htdocs\rwd-qa\app\code\local\GBCustom\Checkout\controllers\OnepageController.php(201): mageCoreErrorHandler(2048, 'Non-static meth...', 'C:\xampp\htdocs...', 201, Array)
#1 C:\xampp\htdocs\rwd-qa\app\code\core\Mage\Core\Controller\Varien\Action.php(418): GBCustom_Checkout_OnepageController->saveOrderAction()
#2 C:\xampp\htdocs\rwd-qa\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
 #3 C:\xampp\htdocs\rwd-qa\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
 #4 C:\xampp\htdocs\rwd-qa\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
 #5 C:\xampp\htdocs\rwd-qa\app\Mage.php(694): Mage_Core_Model_App->run(Array)
 #6 C:\xampp\htdocs\rwd-qa\index.php(144): Mage::run('', 'store')
 #7 {main}

Onepage Controller:

<?php
 public function savePaymentAction()
{  
    if ($this->_expireAjax()) {  
        return;
    }  
    try {
        if (!$this->getRequest()->isPost()) { 
            $this->_ajaxRedirectResponse();
            return;
        }  
        // set payment to quote
        $result = array();
        $data = $this->getRequest()->getPost('payment', array());
        $session = Mage::getSingleton('checkout/session');
        $quote=$session->getQuote();
        $total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount(); 
        $paid_total= Mage::helper('payment')->getPaymentPaidTotal($quote);  // amount remaining is to pay  
        //same card can't be used twice
        if(isset($data['card_number']) && isset($data['card_pin']))
        {
            if(Mage::helper('payment')->isCardExists($quote,$data))  
            {
                $result['error'] = $this->__('You already paying with this card, Try another'); 
            } 
        }  
        if(!isset($result['error'])) { 
            if($paid_total==0){    
                Mage::helper('payment')->deletePaymentQuote($quote,$data['method']);
                $paid_total= Mage::helper('payment')->getPaymentPaidTotal($quote);  // amount remaining is to pay
                }
            /*
            if redem amount is not mentioned
            */
            if(!isset($data['amount_to_redem'])){ 
                /*
                amount is paid already then asign remaining amount
                */
                if($paid_total==-1){
                    $data['amount_to_redem']=$total; // if nothing is paid then asign total
                    }
                elseif($paid_total>0){ 
                    $data['amount_to_redem']=$paid_total; 
                }else{ 
                    $data['amount_to_redem']=$total;  
                }  
            }

            if($paid_total-$data['amount_to_redem']>=0 || $paid_total==-1) {  // if amount is not exceds  or not paid at all
                $result = $this->getOnepage()->savePayment($data);
                $paid_total= Mage::helper('payment')->getPaymentPaidTotal();
                if($paid_total==0){
                    $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
                    if (empty($result['error']) && !$redirectUrl) {  
                        $this->loadLayout('checkout_onepage_review');
                        $result['goto_section'] = 'review';
                        $result['update_section'] = array(
                        'name' => 'review',
                        'html' => $this->_getReviewHtml()
                        ); 
                    }  
                    if ($redirectUrl) {   
                        $result['redirect'] = $redirectUrl;
                    }                   
                }else{
                    $result['goto_section'] = 'payment';
                    $result['update_section'] = array(
                    'name' => 'payment-method',
                    'html' => $this->_getPaymentMethodsHtml()
                    );  
                }
            }else{
                $result['goto_section'] = 'payment';
                $result['update_section'] = array(
                'name' => 'payment-method',
                'html' => $this->_getPaymentMethodsHtml()
                );  
                //  $result['error'] = $this->__('Unabale to pay you entered amount. Amount Exceed than actual amount');
                }
        }
    } catch (Mage_Payment_Exception $e) {
        if ($e->getFields()) {
            $result['fields'] = $e->getFields();
        }
        $result['error'] = $e->getMessage();
    } catch (Mage_Core_Exception $e) {
        $result['error'] = $e->getMessage();
    } catch (Exception $e) {
        Mage::logException($e);
        $result['error'] = $this->__('Unable to set Payment Method.'.$e->getMessage().'-'.$e->getTraceAsString());
    }
    $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}

/**
* Create order action
*/
public function saveOrderAction()
{  
    if ($this->_expireAjax()) {
        return;
    }
    $result = array();
    try {
        if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {  
            $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
            if ($diff = array_diff($requiredAgreements, $postedAgreements)) {    
                $result['success'] = false;
                $result['error'] = true;
                $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
                $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
                return;
            }
        }

        if ($data = $this->getRequest()->getPost('payment', false)) {  
            $this->getOnepage()->getQuote()->getPayment()->importData($data);
        } 
        $this->getOnepage()->saveOrder();
        //$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
        $redirectUrl=Mage::helper('payment')->havePayment(); // gets custom redirect url
        $result['success'] = true;
        $result['error']   = false;
    } catch (Mage_Payment_Model_Info_Exception $e) {
        $message = $e->getMessage();
        if( !empty($message) ) {
            $result['error_messages'] = $message;
        }
        $result['goto_section'] = 'payment';
        $result['update_section'] = array(
        'name' => 'payment-method',
        'html' => $this->_getPaymentMethodsHtml()
        );
    } catch (Mage_Core_Exception $e) {
        Mage::logException($e);
        Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
        $result['success'] = false;
        $result['error'] = true;
        $result['error_messages'] = $e->getMessage();

        if ($gotoSection = $this->getOnepage()->getCheckout()->getGotoSection()) {
            $result['goto_section'] = $gotoSection;
            $this->getOnepage()->getCheckout()->setGotoSection(null);
        }

        if ($updateSection = $this->getOnepage()->getCheckout()->getUpdateSection()) {
            if (isset($this->_sectionUpdateFunctions[$updateSection])) {
                $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
                $result['update_section'] = array(
                'name' => $updateSection,
                'html' => $this->$updateSectionFunction()
                );
            }
            $this->getOnepage()->getCheckout()->setUpdateSection(null);
        }
    } catch (Exception $e) {
        Mage::logException($e);
        Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
        $result['success']  = false;
        $result['error']    = true;
        $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.'.Mage::callStack(debug_backtrace()));
    }
    $this->getOnepage()->getQuote()->save();
    /**
    * when there is redirect to third party, we don't want to save order yet.
    * we will save the order in return action.
    */
    if (isset($redirectUrl)) {           
        $result['redirect'] =  str_replace(Mage::getBaseUrl(),'',$redirectUrl);;
    }

    $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
public function failureAction()
{
    $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
    $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();

    if (!$lastQuoteId || !$lastOrderId) {
        $this->_redirect('checkout/cart');
        return;
    }

    $this->loadLayout();
    $this->renderLayout();   
    Mage::getSingleton('checkout/cart')->truncate();
    Mage::getSingleton('checkout/session')->unsLastQuoteId();
    Mage::getSingleton('checkout/session')->clear();
    Mage::getSingleton('checkout/session')->unsLastRealOrderId();
}
/**
* Order success action
*/
public function successAction()
{
    $session = $this->getOnepage()->getCheckout();
    if (!$session->getLastSuccessQuoteId()) {
        $this->_redirect('checkout/cart');
        return;
    }

    $lastQuoteId = $session->getLastQuoteId();
    $lastOrderId = $session->getLastOrderId();
    $lastRecurringProfiles = $session->getLastRecurringProfileIds();
    if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
        $this->_redirect('checkout/cart');
        return;
    }

    $session->clear();
    $this->loadLayout();
    $this->_initLayoutMessages('checkout/session');
    Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
    $this->renderLayout();
    Mage::getSingleton('checkout/cart')->truncate();
    Mage::getSingleton('checkout/session')->unsLastQuoteId();
    Mage::getSingleton('checkout/session')->clear();
    Mage::getSingleton('checkout/session')->unsLastRealOrderId();
}      

}

How can i resolve this?

  • Enable magento and check what you get error wheneevr place an order – Amit Bera Jan 21 '16 at 10:41
  • enable magento means? – user3041822 Jan 21 '16 at 10:42
  • Enable magento log – Amit Bera Jan 21 '16 at 10:43
  • after enabling log im getting the above error – user3041822 Jan 21 '16 at 10:48
  • attach log when you have place an order – Amit Bera Jan 21 '16 at 10:50
1

It's a common mistake when developing in php.

The developer forgets to see if the array index exists before using it. In your case, you must have a httponly array key at C:\xampp\htdocs\rwd-qa\app\code\core\Mage\Core\Model\Session\Abstract\Varien.php on line 96.

It should be something like $array['httponly'], but this array key doesn't exists.

You can simply add the following line before this one:

$array['httponly'] = (isset($array['httponly']))?$array['httponly']:'';

Just replace $array for the corresponding variable name in your file.

Or you can see this other answer here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.