7

I recently migrated to a new server and upgraded to the latest Magento. However, the order details page on the backend is now broken for any order that used our old 'PayPoint' extension (which we no longer have as it was discontinued). We have a newer extension which does the same thing.

This is the error code I get on orders that were placed using the old PayPoint integration extension.

There has been an error processing your request The requested Payment Method is not available.

Trace:

#0 /home/metaco2/public_html/app/code/core/Mage/Payment/Model/Info.php(82): Mage::throwException('The requested P...')
#1 /home/metaco2/public_html/app/code/core/Mage/Payment/Helper/Data.php(119): Mage_Payment_Model_Info->getMethodInstance()
#2 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php(50): Mage_Payment_Helper_Data->getInfoBlock(Object(Mage_Sales_Model_Order_Payment))
#3 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php(44): Mage_Adminhtml_Block_Sales_Order_Payment->setPayment(Object(Mage_Sales_Model_Order_Payment))
#4 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Adminhtml_Block_Sales_Order_Payment->_beforeToHtml()
#5 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#6 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('order_payment', true)
#7 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php(112): Mage_Core_Block_Abstract->getChildHtml('order_payment')
#8 /home/metaco2/public_html/app/design/adminhtml/default/default/template/sales/order/view/tab/info.phtml(46): Mage_Adminhtml_Block_Sales_Order_View_Tab_Info->getPaymentHtml()
#9 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/metaco2/p...')
#10 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#11 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#12 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#13 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Template->_toHtml()
#14 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php(303): Mage_Core_Block_Abstract->toHtml()
#15 /home/metaco2/public_html/app/design/adminhtml/default/default/template/widget/tabs.phtml(38): Mage_Adminhtml_Block_Widget_Tabs->getTabContent(Object(Mage_Adminhtml_Block_Sales_Order_View_Tab_Info))
#16 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/metaco2/p...')
#17 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#18 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#19 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#20 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Template->_toHtml()
#21 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#22 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#23 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#24 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#25 /home/metaco2/public_html/app/design/adminhtml/default/default/template/page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left')
#26 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/metaco2/p...')
#27 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#28 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#29 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#30 /home/metaco2/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Template->_toHtml()
#31 /home/metaco2/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#32 /home/metaco2/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#33 /home/metaco2/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(128): Mage_Core_Controller_Varien_Action->renderLayout()
#34 /home/metaco2/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_OrderController->viewAction()
#35 /home/metaco2/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#36 /home/metaco2/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#37 /home/metaco2/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#38 /home/metaco2/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#39 /home/metaco2/public_html/index.php(93): Mage::run('base', 'website')
#40 {main}

Does anybody know how to fix this?

Thanks in advance

4 Answers 4

28

Magento does not deal well with this scenario: deleting a payment method that has been used. Your options from here are:

  1. installing the old extension again from a backup or similar
  2. adjust the payment method in the database

For the second approach you can use something like

UPDATE`sales_flat_order_payment` SET `method`= 'NEW_CODE'  WHERE `method` = 'OLD_CODE';

As NEW_CODE you could test using the code from the newer version of the extension and hope that it is backwards compatible. You could find it in the same table for an order placed via the new extension. If that doesn't work out you could also change it to one of the default payment methods like checkmo or ccsave.

As usual if you make any changes directly to the database a backup is recommended beforehand.

6
  • Just encountered this very issue where the developer of a payment gateway extension had completely changed the structure of their extension (so new payment method) but we couldn't access any previous orders in admin due to this error. Idiots has used the same classes in both extensions so was impossible to be able to have a working checkout and access old orders with both old/new extensions active. Poor development with no graceful fallback/upgrade. As such, trying your option 2 and keeping everything crossed!
    – zigojacko
    Mar 11, 2015 at 13:18
  • Dammit. Option two made no difference... You still get the error The requested Payment Method is not available. when trying to access an order that uses the old extension.
    – zigojacko
    Mar 11, 2015 at 13:25
  • @zigojacko maybe you are using a table prefix. If so you would need to amend the table name (sales_flat_order_payment) to include the prefix. May 5, 2015 at 2:57
  • There was no table prefix no but I revisited this shortly aftter posting the question and made another attempt using the following query which did work UPDATE 'sales_flat_order_payment' SET 'method'= 'payhosted' WHERE 'method' = 'paymentsensegateway'; so unsure whether it was a cache issue before but either way, yes, you were right with your answer. Thanks.
    – zigojacko
    May 5, 2015 at 7:44
  • anyone who has upgraded the sofortueberweisung payment module may well experience this problem too, I can confirm that UPDATEsales_flat_order_payment SET method= 'paymentnetwork_pnsofortueberweisung' WHERE method = 'sofortueberweisung'; resolves the requested payment method not available error.
    – paj
    Jul 6, 2015 at 14:41
1

I've tried different solution than mentioned above.

Exception was thrown in Mage_Payment_Helper_Data class (getInfoBlock method), so I decided to overwrite it, so I copied it to: app/code/local/Mage/Payment/Helper/Data.php

Next step was to catch Exception, and create simple, fake block (with default template for info block, that is: payment/info/default.phtml). I've had some information about payment method from Mage_Payment_Model_Info $info parameter, so I used it, and used it as data for the block.

Here is whole method:

public function getInfoBlock(Mage_Payment_Model_Info $info)
{
    try {
        $blockType = $info->getMethodInstance()->getInfoBlockType();

        if ($this->getLayout()) {
            $block = $this->getLayout()->createBlock($blockType);
        }
        else {
            $className = Mage::getConfig()->getBlockClassName($blockType);
            $block = new $className;
        }
    } catch (Exception $e) {
        $block = new Mage_Core_Block_Template();
        $block->setTemplate('payment/info/default.phtml');
        $block->setMethod(new Varien_Object());
        $block->getMethod()->setTitle($block->__($info->getMethod()));
    }
    $block->setInfo($info);
    return $block;
}

And since this $info->getMethod() returned only method code I used translation system (updating my translate.csv) to display it as something more readable for the human.

Solution works fine, and is generic enough to solve this problem for all disabled payment methods.

0

You know I've got the same issue. I've disabled ShipComplaint modules and faced the error.
I've decided to implement some stub-class, just to avoid unexpected issues if we replace payment method code with code of active one.

/**
 * Stub model for orders paid with ShipComplaint payment method
 */
class My_ShipComplaint_Model_PaymentMethodStub extends Mage_Payment_Model_Method_Cc
{
    /**
     * Set FALSE for "can" properties to make the actions unavailable
     */
    public function __construct()
    {
        $this->_canCapture =
        $this->_canUseInternal =
        $this->_canUseCheckout =
        $this->_canUseForMultishipping =
        $this->_canManageRecurringProfiles = false;

        $this->_code = 'shipcompliant_payment';

        parent::__construct();
    }

    /**
     * Return false to make it unavailable
     *
     * @param Mage_Sales_Model_Quote $quote
     * @return bool
     */
    public function isAvailable($quote = null)
    {
        return false;
    }
}

And in config.xml file:

<?xml version="1.0"?>
<config>
    [...]
    <default>
        <payment>
            <shipcompliant_payment>
                <active>0</active>
                <!-- Stub model for orders paid with ShipComplaint payment method -->
                <model>mob_shipcomplaint/paymentMethodStub</model>
            </shipcompliant_payment>
        </payment>
    </default>
</config>
0

I was missing a line in my code:

<model>mob_shipcomplaint/paymentMethodStub</model>

That fixed my issue.

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.