1

I have an issue on magento 2 customer account edit form.

I think generally magento 2 customer account edit form was loaded from vendor/magento/module-customer/view/frontend/templates/form/edit.phtml

My create account templates also loaded from vendor/magento/module-customer/view/frontend/templates/form/register.phtml

For create account template shows the exact path and from there also my template was loading.

But on customer account edit template, I have faced one issue,that was I have enabled the template path hints and checked the template path for the customer account edit form, it shows the below path: vendor/amzn/amazon-pay-module/view/frontend/templates/form/edit.phtml

I want to customize the customer account edit form, so I have tried to override the core customer module edit.phtml template (vendor/magento/module-customer/view/frontend/templates/form/edit.phtml)

But here it showing the amazon pay module core file.

If any of my extension override that edit.phtml file means, it will show that path. But unfortunately, it shows another core module path (amazon-pay-module).

I'm totally confused with that. Why it is showing the core file path and tested with default magento 2 package, it also shows the correct path from module-customer (core file).

Hereby I have attached the image.

template path for account edit form

Is I want to override the amazon-pay-module here? It was correct.

can anyone please help me to shootout the issue?

Thanks in advance!.

  • Yes, you've to override this file to you theme or your module which is in app/code I've given answer just try it and let me know. – Prathap Gunasekaran Feb 15 at 11:50
  • Thanks Prathap.. But my doubt as of why the default module-customer core module template path changed by another one core module (amazon-pay-module). Generally, a core module can be overridden by any of our custom module or extension. – Ramya Feb 15 at 12:11
  • If you find the answer useful, please accept – Prathap Gunasekaran Feb 18 at 7:04
  • @Prathap, Thanks for ur answer. But my doubt as why amazon-pay-module path hint was showing instead of customer module. Can you please clarify that... – Ramya Feb 18 at 7:11
  • Amazon also an third party vendor which comes with magento core, so they may require to those files to be overridden. you could see Algolia_Search which goes under vendor and they do the same if require. It's not just extensions which is in app/code only need to overridden as far as my knowledge is concern. – Prathap Gunasekaran Feb 18 at 7:17
0

You need to overwrite the file

vendor/amzn/amazon-pay-module/view/frontend/templates/form/edit.phtml

to your theme.

So Like this

app/design/frontend/<vendor>/<theme>/Amazon_Payment/templates/form/edit.phtml

And then Clear the cache it should work.

0

you can try below code :

Vendor/Module/registration.php & put below code.

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_Module',
    __DIR__
);

add the module.xml file in Vendor/Module/etc/module.xml & put below code.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="1.0.0">
        <sequence>
            <module name="Amazon_Payment"/>
        </sequence>
    </module>
</config>

and customer_account_edit.xml in Vendor/Module/view/frontend/layout/customer_account_edit.xml & put below code.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="form.additional.info">
            <block class="Magento\Framework\View\Element\Template" name="form_additional_info_customer" template="Vendor_Module::additionalinfocustomer.phtml"/>
        </referenceContainer>
    </body>
</page>

and additionalinfocustomer.phtml in Vendor/Module/view/frontend/templated/additionalinfocustomer.phtml & put below code.

<fieldset class="fieldset create account" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>">
    <legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Additional Information') ?></span></legend><br>

    <div class="field promotion_code required">
        <label for="promotion_code" class="label"><span><?php /* @escapeNotVerified */ echo __('Promotion Code') ?></span></label>
        <div class="control">
            <input type="text" name="promotion_code" id="promotion_code" title="<?php /* @escapeNotVerified */ echo __('Promotion Code') ?>" class="input-text" data-validate="{required:true}" autocomplete="off">
        </div>
    </div>    
</fieldset>

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.