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 – Rutvee Sojitra Jul 26 '18 at 7:20
  • i have added Block/Adminhtml/Totals.php file but not override – hitesh patel Jul 26 '18 at 7:22
  • controller not override using perefence becuse Order class is abstract – Rutvee Sojitra Jul 26 '18 at 7:23
  • Can you please add code of Block/Adminhtml/Totals.php in your question? – Rutvee Sojitra Jul 26 '18 at 7:26
  • Thanks for suggestion me but Block not override please suggest me – hitesh patel Jul 26 '18 at 7:28
<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 – hitesh patel Jul 26 '18 at 8:38
  • :D I mean you can edit the question – Gagan Jul 26 '18 at 9:05

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.