2

I am using magento 2.1 with the ultimo theme. I was customizing the login page which was not avaialable as a module in the theme.

So I go to vendor and changed the login page setting like text and placement of new register and old customer login place.

I want to ask is it okay to change these files . I know after the changes I have to compile so that these changes make it to the pub.

But in the vendor what should be done for the best practice.

P.S the path is /vendor/magento/module-customer/view/frontend/templates/newcustomer.phtml

4
  • 1
    changing any file in vendor is not the right way, its total wrong way... extend your module under your ultimo theme.. Commented Sep 27, 2017 at 15:08
  • @ManojDeswal how ? i have already extended the ultimo theme.
    – tech_geek
    Commented Sep 27, 2017 at 15:09
  • extend customer module under ultimo theme... let me see the your theme directory then I ll tell you where to place the files Commented Sep 27, 2017 at 15:11
  • sure it will be a great help
    – tech_geek
    Commented Sep 27, 2017 at 15:18

2 Answers 2

3

No this is not best practice. If you run any updates these changes will get overwritten. Any patches that are applied may fail if the files are different from originals as well.

You can, however, do this from within your theme. From your ultimo theme's root directory create new folders for that module Magento_Customer/templates.

Then copy the vendor file to your new folder:

Magento_Customer/templates/newcustomer.phtml

Then make modifications to your new file from there.

16
  • actually there is nothing like Magento_Customer. Also there is xml file in view which i also want to change i want to change the settings of the block thats why
    – tech_geek
    Commented Sep 27, 2017 at 15:24
  • Yeah add the folders in there .
    – harri
    Commented Sep 27, 2017 at 15:27
  • The xml file will go within Magento_Customer/layout/ you can make changes to xml from there.
    – harri
    Commented Sep 27, 2017 at 15:28
  • thats what i am saying that there is not any folder like magento_customer in ultimo . Do i have to make one? and which files should i copy. It will automatically pick up the files which i have changed from this new directory and old files from vendor?
    – tech_geek
    Commented Sep 27, 2017 at 15:29
  • Yeah so create the new directories Magento_Customer , and templates within that. These files will now be used instead of vendor files.
    – harri
    Commented Sep 27, 2017 at 15:31
5

To make changes in your customer module , copy file from vendor at path you changing right now

/vendor/magento/module-customer/view/frontend/templates/newcustomer.phtml

And place at following location in your theme, if folders are not present then you can create them. Copy only required file , no need to copy all the files

/app/design/frontend/Infortis/base/Magento_Customer/templates/newcustomer.phtml

Make your changes and run required commands to take effect.

In same way you can extend any module which is not present in your theme

Never make any changes in vendor files , always extend the module

10
  • 1
    Thank you manoj i wish i could accept the both answers. cheers!
    – tech_geek
    Commented Sep 27, 2017 at 15:36
  • No worry bro.. Happy to help people here on forums . cheers ! Commented Sep 27, 2017 at 15:38
  • some day i will return this favor by helping others when i got some command on this technology.
    – tech_geek
    Commented Sep 27, 2017 at 15:39
  • 1
    sure, always help other with your knowledge , this way you will learn more Commented Sep 27, 2017 at 15:40
  • 1
    No not that way, check the answer link I given Commented Sep 28, 2017 at 8:09

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.