1

I have created 3 custom customer attributes. So far I have them saving and displaying correctly in the account creation page and for the admin in the backend.

In the users account on the frontend they just appear as empty boxes. I can, however, save the attributes from here.

Here is my customer_account_edit.xml

<?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="content">
         <referenceContainer name="form.additional.info">
            <block class="Magento\Framework\View\Element\Template"  template="Ubr_CustomAttributes::additionalinfocustomer.phtml"/>
         </referenceContainer>

        </referenceContainer>

    </body>
</page>

Here is my additionalinfocustomer.phtml

    <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 ubr_interest">
        <label for="ubr_interest" class="label"><span><?php /* @escapeNotVerified */ echo __('Your Interest in U Build Rods?') ?></span></label>
        <div class="control">
            <input type="text" name="ubr_interest" id="ubr_interest" title="<?php /* @escapeNotVerified */ echo __('Your Interest in U Build Rods') ?>" class="input-text" data-validate="{required:false}" autocomplete="off">
        </div>
    </div>
    <div class="field ubr_company">
        <label for="ubr_company" class="label"><span><?php /* @escapeNotVerified */ echo __('Company or Organisation') ?></span></label>
        <div class="control">
            <input type="text" name="ubr_company" id="ubr_company" title="<?php /* @escapeNotVerified */ echo __('Company or Organisation') ?>" class="input-text" data-validate="{required:false}" autocomplete="off">
        </div>
    </div>
    <div class="field ubr_telephone">
        <label for="ubr_telephone" class="label"><span><?php /* @escapeNotVerified */ echo __('Telephone') ?></span></label>
        <div class="control">
            <input type="text" name="ubr_telephone" id="ubr_telephone" title="<?php /* @escapeNotVerified */ echo __('Telephone') ?>" class="input-text" data-validate="{required:false}" autocomplete="off">
        </div>
    </div>
</fieldset>

They should obviously be displaying their content on the frontend ready to be edited.

Thanks

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.