0

Please if anyone know how to override this file in our theme please reply me

"Magento\Customer\Controller\Account" creatPost.php file

This is my Mageplaza/HelloWorld/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Customer\Controller\Account\CreatePost" type="Mageplaza\HelloWorld\Controller\Account\CreatePost" />
</config>

second file Mageplaza/HelloWorld/etc/routes.xml

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

<router id="standard">
    <route id="mageplaza" frontName="hello">
       <module name="Mageplaza_HelloWorld" before="Magento_Customer" />
    </route>
</router>

</config>

third file here Mageplaza/HelloWorld/Controller/Account/CreatePost.php

<?php 
namespace Mageplaza\HelloWorld\Controller\Account;

class CreatePost extends \Magento\Customer\Controller\Account\CreatePost{   
    protected function getSuccessMessage()
    {
        if ($this->addressHelper->isVatValidationEnabled()) {
            if ($this->addressHelper->getTaxCalculationAddressType() == Address::TYPE_SHIPPING) {
                // @codingStandardsIgnoreStart
               /* $message = __(
                    'If you are a registered VAT customer, please <a href="%1">click here</a> to enter your shipping address for proper VAT calculation.',
                    $this->urlModel->getUrl('customer/address/edit')
                );*/
                // @codingStandardsIgnoreEnd
            } else {
                // @codingStandardsIgnoreStart
                /*$message = __(
                    'If you are a registered VAT customer, please <a href="%1">click here</a> to enter your billing address for proper VAT calculation.',
                    $this->urlModel->getUrl('customer/address/edit')
                );*/
                // @codingStandardsIgnoreEnd
            }
        } else {
         //your custom message...
            $message = __('Thank you for registering with us');
        }
        return $message;
    }
}

I apply all command but after register this messages not hide.

  • Your code is correct. But to test this you need post a real form (because the _construct method check if form key is valid) – Bruno Monteiro Jul 8 at 17:51

Your Answer

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

Browse other questions tagged or ask your own question.