2

I'm getting a blank page (without content, sidebars etc exists) on customer/address/new action using an custom theme.

What I want to do is to implement that new page under customer/address/new, that's the standard action when customer has no addresses.

So I've created an xml customer_address_new.xml in which I've specified an template file (and other stuff copied from the edit action), but it doesn't work, I've got same effect as without my layout and template files.

The layout file: <theme>/Magento_Customer/layout/customer_address_new.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">
    <update handle="customer_account" />
    <body>
        <referenceBlock name="head.components">
            <block class="Magento\Framework\View\Element\Js\Components" name="customer_page_head_components" template="Magento_Customer::js/components.phtml" />
        </referenceBlock>
        <referenceBlock name="customer-account-navigation-address-link">
            <arguments>
                <argument name="is_highlighted" xsi:type="boolean">true</argument>
            </arguments>
        </referenceBlock>
        <referenceContainer name="content">
            <block class="Magento\Customer\Block\Address\Edit" name="customer_address_new" template="address/new.phtml" cacheable="true" />
        </referenceContainer>
    </body>
</page>

What's going on?

1
  • please check updated code Commented Oct 24, 2016 at 10:16

1 Answer 1

2

You have missing layout="1column" in your customer_address_new.xml file,

please insert layout inside node,

   <?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">
    <update handle="customer_account" />
    <body>
        <referenceBlock name="head.components">
            <block class="Magento\Framework\View\Element\Js\Components" name="customer_page_head_components" template="Magento_Customer::js/components.phtml" />
        </referenceBlock>
        <referenceBlock name="customer-account-navigation-address-link">
            <arguments>
                <argument name="is_highlighted" xsi:type="boolean">true</argument>
            </arguments>
        </referenceBlock>
        <referenceContainer name="content">
            <block class="Magento\Customer\Block\Address\Edit" name="customer_address_new" template="address/new.phtml" cacheable="true" />
        </referenceContainer>
    </body>
</page>
8
  • sorry, but that's not working, maybe something is wrong with the controller: public function execute() { /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ $resultForward = $this->resultForwardFactory->create(); return $resultForward->forward('form'); }, I'm not sure what's the forward factory doing.
    – roomcayz
    Commented Oct 24, 2016 at 10:23
  • Have you add 1column inside page tag? Commented Oct 24, 2016 at 10:29
  • yes, I did this text is only for satisfy the lenght requirement
    – roomcayz
    Commented Oct 24, 2016 at 10:34
  • whats the issue you have faced now after apply changes? Commented Oct 24, 2016 at 10:38
  • it's the same, a page without content, now I've noticed theres an error while loading the page: [2016-10-24 10:32:10] main.CRITICAL: Invalid template file: 'address/edit.phtml' in module: 'Webinse_Customer' block's name: 'customer_address_edit' [] [] might it be caused by that?
    – roomcayz
    Commented Oct 24, 2016 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.