0

Where do I transform the first name and Last name field into a single row with round corner?

I am using Magento 2.3

Now

Transform this as new Image

After

0

To customize registration form you have to override register.phtml, and to override this file you need to do several steps, like:

Goto this file path, copy content:

/local/vendor/magento/module-customer/view/frontend/templates/form/register.phtml

Make dir something like this:

/local/app/design/Magento_Customer/view/frontend/templates/form/register.phtml

Paste content which you copied and customize however you want.

Thank You.

  • Hi! Thanks for the reply, do I need to create my own xml file into the layout folder as well? or just copy the file and move to this folder for make changes? – Paul Fan Oct 31 at 17:03
0

For achieving your desired output, there is no need to touch any customer related xml files for it. You just need to deal with file:

/magento_rootdir/vendor/magento/module-customer/view/frontend/templates/widget/name.phtml

Just override the above file in your theme as the below path:

/magento_rootdir/app/design/frontend/Vendorname/Themename/Magento_Customer/templates/widget/name.phtml and do your customizations you will get the name fields in one row.

Now the question is that how I got the sense that I need to customize name.phtml file, so here is the answer:

Dive into the file: /magento_rootdir/vendor/magento/module-customer/view/frontend/templates/form/register.phtml and come to the code

<?= $block->getLayout()->createBlock('Magento\Customer\Block\Widget\Name')->setObject($block->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>

Magento\Customer\Block\Widget\Name => /magento_rootdir/vendor/magento/module-customer/Block/Widget/Name.php Open this file and checkout this code:

/**
     * @inheritdoc
     */
    public function _construct()
    {
        parent::_construct();

        // default template location
        $this->setTemplate('Magento_Customer::widget/name.phtml');
    }

Here the template has been set as name.phtml file.

Hope this gets you an idea about how to get your result, if yes then kindly upvote it and accept it as an answer and in case of any concerns please let me know. Thanks!

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.