I can't override the adminhtml block please suggest me missing parameter

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"></pre>
        <preference for="Magento\Sales\Block\Adminhtml\Totals" type="Namespace\Modulename\Block\Adminhtml\Totals" />

        <preference for="Magento\Sales\Controller\Adminhtml\Order" type="Namespace\Modulename\Controller\Adminhtml\Order" />
  • Can you please add your custom block code here Jul 26, 2018 at 7:20
  • i have added Block/Adminhtml/Totals.php file but not override Jul 26, 2018 at 7:22
  • controller not override using perefence becuse Order class is abstract Jul 26, 2018 at 7:23
  • Can you please add code of Block/Adminhtml/Totals.php in your question? Jul 26, 2018 at 7:26
  • Thanks for suggestion me but Block not override please suggest me Jul 26, 2018 at 7:28

1 Answer 1

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

Add this before the preference tag in place of -

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"></pre>

Also please confirm the di.xml file starts with

<?xml version="1.0"?>

If not worked, share the Block code with path

  • Namespace\Modulename\etc\di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\Sales\Block\Adminhtml\Totals" type="Namespace\Modulename\Block\Adminhtml\Totals" /> </config> Namespace\Modulename\Block\Adminhtml\Totals.php Jul 26, 2018 at 8:38
  • :D I mean you can edit the question
    – Gagan
    Jul 26, 2018 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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