1

I'm trying to move the social login block to the top of the page but i'm unable to find where to change this. I'v been searching and editing different files without success.

URL for customer login page: https://dev.thefoodiesstore.com/customer/account/login/

LAYOUT XML FILES:

/app/design/frontend/Mgs/claue/Magento_Customer/layout/customer_account_login.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="customer.login.container">
                <container name="customer.login.container.before" htmlTag="div" htmlClass="col-sm-6 col-xs-12 margin-bottom50" before="-"/>
                <container name="customer.login.container.after" htmlTag="div" htmlClass="col-sm-6 col-xs-12 pull-right" after="customer.login.container.before"/>
        </referenceContainer>

        <move element="customer_form_login" destination="customer.login.container.before"/>
        <move element="customer.new" destination="customer.login.container.after"/>
    </body>
</page>

./vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <!-- customer.form.login.extra -->
            <container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container">
                <block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml">
                    <container name="form.additional.info" as="form_additional_info"/>
                </block>
                <block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="Magento_Customer::newcustomer.phtml"/>
            </container>
            <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
                <arguments>
                    <argument name="triggers" xsi:type="array">
                        <item name="loginButton" xsi:type="string">.action.login</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>

BLOCK FILE:

<?xml version="1.0"?>

<!--
/**
  * CedCommerce
  *
  * NOTICE OF LICENSE
  *
  * This source file is subject to the End User License Agreement (EULA)
  * that is bundled with this package in the file LICENSE.txt.
  * It is also available through the world-wide-web at this URL:
  * http://cedcommerce.com/license-agreement.txt
  *
  * @category    Ced
  * @package     VendorsocialLogin
  * @author      CedCommerce Core Team <[email protected]>
  * @copyright   Copyright CEDCOMMERCE (http://cedcommerce.com/)
  * @license     http://cedcommerce.com/license-agreement.txt
  */
-->


<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <update handle="cedsociallogin_facebook_button"/>
    <head>
        <!-- for css file -->
        <css src="Ced_VendorsocialLogin::css/styles.css"/>
        <css src="Ced_VendorsocialLogin::css/google/button.css"/>
        <css src="Ced_VendorsocialLogin::css/facebook/button.css"/>
        <css src="Ced_VendorsocialLogin::css/twitter/button.css"/>
        <css src="Ced_VendorsocialLogin::css/linkedin/button.css"/>
    </head>

    <referenceContainer name="customer.login.container">
        <block before="customer.new" class="Ced\VendorsocialLogin\Block\Container\Login"
               name="ced_vendorsociallogin_login" template="login.phtml" cacheable="false">
            <block class="Ced\VendorsocialLogin\Block\Google\Button" name="ced_google_login_button"
                   template="google/button.phtml" cacheable="false">
                <arguments>
                    <argument name="button_text" translate="true" xsi:type="string">Login</argument>
                </arguments>
            </block>
            <block class="Ced\VendorsocialLogin\Block\Facebook\Button" name="ced_facebook_login_button"
                   template="facebook/button.phtml" cacheable="false">
                <arguments>
                    <argument name="button_text" translate="true" xsi:type="string">Login</argument>
                </arguments>
            </block>
            <block class="Ced\VendorsocialLogin\Block\Twitter\Button" name="ced_twitter_login_button"
                   template="twitter/button.phtml" cacheable="false">
                <arguments>
                    <argument name="button_text" translate="true" xsi:type="string">Login</argument>
                </arguments>
            </block>
            <block class="Ced\VendorsocialLogin\Block\Linkedin\Button" name="ced_linkedin_login_button"
                   template="linkedin/button.phtml" cacheable="false">
                <arguments>
                    <argument name="button_text" translate="true" xsi:type="string">Login</argument>
                </arguments>
            </block>
        </block>
    </referenceContainer>
</page>

PHP related file:

./app/design/frontend/Mgs/claue/Magento_Customer/templates/form/login.phtml

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var \Magento\Customer\Block\Form\Login $block */
?>
<?php
/**
 * Customer login form template
 *
 * @see \Magento\Customer\Block\Form\Login
 * @var $block \Magento\Customer\Block\Form\Login
 */
?>
<div class="block block-customer-login">
    <div class="block-title">
        <h2 class="title" id="block-customer-login-heading" role="heading" aria-level="2"><span><?php /* @escapeNotVerified */ echo __('Registered Customers') ?></span></h2>
    </div>
    <div class="block-content" aria-labelledby="block-customer-login-heading">
        <form class="form form-login"
              action="<?php /* @escapeNotVerified */ echo $block->getPostActionUrl() ?>"
              method="post"
              id="login-form"
              data-mage-init='{"validation":{}}'>
            <?php echo $block->getBlockHtml('formkey'); ?>
            <fieldset class="fieldset login" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>">
                <div class="field note margin-bottom10"><?php /* @escapeNotVerified */ echo __('If you have an account, sign in with your email address.') ?></div>
                <div class="form-group email required">
                    <div class="form-group">
                        <label for="login[username]" class="required"><?php echo __('Email Address'); ?><em>*</em></label>
                        <div class="control">
                            <input name="login[username]" placeholder="Email" value="<?php echo $block->escapeHtml($block->getUsername()) ?>" <?php if ($block->isAutocompleteDisabled()) :?> autocomplete="off"<?php endif; ?> id="email" type="email" class="input-text" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" data-validate="{required:true, 'validate-email':true}">
                        </div>  
                    </div>
                </div>
                <div class="form-group password required">
                    <div class="form-group">
                        <label for="login[username]" class="required"><?php echo __('Password'); ?><em>*</em></label>
                        <div class="control">
                            <input name="login[password]" placeholder="Contraseña" type="password" <?php if ($block->isAutocompleteDisabled()) :?> autocomplete="off"<?php endif; ?> class="input-text" id="pass" title="<?php /* @escapeNotVerified */ echo __('Password') ?>" data-validate="{required:true}">
                        </div>
                    </div>
                </div>
                <?php echo $block->getChildHtml('form_additional_info'); ?>
                <div class="actions-toolbar padding-top10">
                    <button type="submit" class="action login btn btn-primary" name="send" id="send2"><span><?php /* @escapeNotVerified */ echo __('Sign In') ?></span></button>
                    <a class="margin-left15 action remind" href="<?php /* @escapeNotVerified */ echo $block->getForgotPasswordUrl() ?>"><span><?php /* @escapeNotVerified */ echo __('Forgot Your Password?') ?></span></a>
                </div>
            </fieldset>
        </form>
    </div>
</div>

Another URL where I want to do the same: https://dev.thefoodiesstore.com/customer/account/create/

1 Answer 1

0

I could solve the issue editing the layout XML file:

/app/design/frontend/Mgs/claue/Magento_Customer/layout/customer_account_login.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="customer.login.container">
                <container name="customer.login.container.before" htmlTag="div" htmlClass="account-login col-sm-12 col-xs-12 pull-right" before="-"/>
                <container name="customer.login.container.before" htmlTag="div" htmlClass="col-sm-6 col-xs-12 margin-bottom50" before="customer.login.container.after"/>
                <container name="customer.login.container.after" htmlTag="div" htmlClass="col-sm-6 col-xs-12 pull-right" after="customer.login.container.before"/>
        </referenceContainer>

        <move element="customer_form_login" destination="customer.login.container.before"/>
        <move element="customer.new" destination="customer.login.container.after"/>
    </body>
</page>

Now I want to apply the same change in the Customer Create Account page, but I'm unable to find out how to do it.

./vendor/magento/module-customer/view/frontend/layout/customer_account_create.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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="Magento_Customer::form/register.phtml">
                <arguments>
                    <argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument>
                </arguments>
                <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>

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.