1

I created a module Pera_CustomerRegistration, i want to override /app/code/Pera/CustomerRegistration/view/frontend/template/form/register.phtml

However, when i try to all i got is is an empty page with only the "Create New Customer Account" title, which makes me assume that the layout is overridden, but that the template is not loading. Here is what i have so far.

customer_account_create.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="head.components">
            <block class="Magento\Framework\View\Element\Js\Components" name="customer_account_create_head_components" template="Magento_Customer::js/components.phtml"/>
        </referenceBlock>
        <referenceContainer name="content">
            <block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="Pera_CustomerRegistration::form/register.phtml">
                <container name="form.additional.info" as="form_additional_info"/>
                <container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/>
            </block>
            <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
                <arguments>
                    <argument name="triggers" xsi:type="array">
                        <item name="registerSubmitButton" xsi:type="string">.action.submit</item>
                    </argument>
                </arguments>
            </block>
        </referenceContainer>
        <referenceContainer name="form.additional.info">
            <block class="Magento\Framework\View\Element\Template" name="form_additional_info_customer" template="Magento_Customer::additionalinfocustomer.phtml"/>
        </referenceContainer>
    </body>
</page>

And here is how the files are in the structure:

enter image description here

Also, here is my module.xml:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Pera_CustomerRegistration" setup_version="1.0.0">
        <sequence>           
            <module name="Magento_Customer"/>  
        </sequence>
    </module>
</config>

enter image description here

If you need any more info, please ask.

1

You have to just keep below code inside your customer_account_create.xml file,

<?xml version="1.0"?>    
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
            <referenceBlock name="customer_form_register" template="Pera_CustomerRegistration::form/register.phtml" />          
    </body>
</page>

Your view file location at this place,

You have remaining 's' inside template folder name

Please replace template into templates,

/app/code/Pera/CustomerRegistration/view/frontend/templates/form/register.phtml

Clear cache and check.

  • It didn't work. I added your code, cleared cache and reloaded. However i still get a blank page ( i'll attach a screenshot on the question ). – Radosav Sep 1 '16 at 13:11
  • you have problem in your module please replace template with templates. – Rakesh Jesadiya Sep 1 '16 at 13:28

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.