Latest Blogs
Cloud Computing
Arpatech Website
Jan 07, 2025
Application Modernization Strategies: 5 Best Practices Explained
Read More...
Today the Dedication of Worldwide Magento Developers fo...
Matheus Gontijo is a hard working, respected Magento Software Engineer based in Curitiba, Brazil. Besides being interested in applying the best practices in his day-to-day work, he is also passionate about personal development, traveling and helping the community. He holds a degree in System Analysis and an MBA in Project Management, and he is certified by Magento as a developer and development plus.
In this interview with Arpatech, Matheus shares how his career started and provide our readers with some of the most relevant insights he has been having since then.
Arpatech: Matheus, you have vast experience in Development side. How did you start your Development career? What challenges did you face when you started your career? Share your first job experience with our readers.
Matheus: I would like to start off by saying it is an honor to be interviewed by Arpatech. Thank you so much for the opportunity. I hope you enjoy the interview as much as I did!
Initially, I started working in a company that had many short projects; they lasted around 2–3 weeks and most of them were HTML + CSS only. Later down the road, I started playing around with PHP, and I became fascinated with the idea of creating solutions through computer coding. These solutions could impact core businesses in big companies as well as make human life a lot easier. I instantly fell in love with the new world I had just discovered.
Today, a few years later, I stop and look back at my journey. Understanding how the programming world works is an easy task now. However, it was very challenging on day one when I everything was still so new to me. There were way too many different programming languages, frameworks, platforms, paradigms, and methodologies to learn and I did not know where to start. I need to confess that I was confused at the time. I could head towards many different directions but, thankfully, I found Magento!
Arpatech: Currently, you are working in Crimson Agility as Magento Software Engineer. When did you connect yourself with Magento? What was the thing that made you Magento Developer, when did you develop your first Magento project?
Matheus: Right after I had started my career as a developer, I spent a few months devotedly studying PHP and OOP. I spend quite some time working on personalized projects based mainly on Zend Framework and a bit on WordPress.
One day our salesperson brought us our first eCommerce project. We chose Magento for several different reasons, but I personally really like working with Zend Framework because of its beautiful code and flexibility. It seemed to me more enterprise-like as it was widely adopted by the industry.
I began working with Magento in the mid of 2011. Our project basically consisted of creating an online store for a client that sells auto parts in a physical store. It seemed pretty simple at first and since I did not have any knowledge about Magento at that point, I had to do my research. I dove into tutorials, blog posts, discussion forums and so on. StackOverflow was a major help to help me come up with solutions for that problems I was facing at the time (and to this day it is still an important source!).
If I could give any piece of advice for a developer who is just starting out, I would say that:
It may sound a bit cliche, but if you want to keep things simple it is going to be easy and you can finish your projects relatively fast — it doesn’t matter which method you use or what you do. However, the bigger your projects get the more experience you will need. You will have to understand the platforms a lot better (what do they offer? How can they be useful to your project and, most importantly, how to maintain them in the upcoming months or years). There’s no magic trick, you will not get this experienced overnight so get familiar with the platforms you use and always seek for the best practices! I don’t want to sound negative, but there is no point in calling yourself a specialist if you are not giving your best. Any other good Magento Developer should be able to complete, modify or extend the code you have written.
Also, when you become more experienced things, the work you put into your career will pay off. You will be getting job offers from all over the world: Brazil (that is where I am from!), USA, Europe, Asia. Doesn’t it sound amazing?
I am currently working in Crimson Agility (an American Magento Solution Partner), and it has been a great pleasure. I am proud to be a part of such a talented team for over a year now. Together we have been collecting amazing experiences in Magento, and I am learning a lot. Thank you so much, guys!
Arpatech: You are a developer very involved with the community. Which platform are you using to connect yourself with Community? Do you participate in the discussions of the Magento social communities? Which platform do you suggest to a newbie for learning and increasing their Magento knowledge? What’s your advice for developers who wanted to kick start their career with Magento?
Matheus: Yes, I have been talking basically with everybody I can! The top #1 breakthrough in my career was to understand the importance of being open to personal development. If you don’t allow yourself to open to it, you will hardly grow. Can you imagine having the opportunity to get help from hundreds of thousands of the most awesome developers in the whole world? Take a look at the open source model: PHP, Zend Framework, and Magento could not be where they are today if it wasn’t for hundreds of thousands of developers from all over the world working together towards the same goals. The more you expose yourself to improvement, the bigger you grow. Therefore, being involved is an intelligent decision, which undoubtedly will make you step out to the next level!
Stay tuned and on the last answer I will link some guys ;- )
Arpatech: You have been an attendee of Magento Developers Paradise 2016. Share some of the best moments from this event. How many Magento events are you going to attend in this year? What are the advantages of attending Magento events like Magento Imagine, Meet Magento, Magento Developers Paradise? How newbies increase their knowledge and connect themselves by attending these events?
Matheus: What a great experience it is to attend these events! There is nothing compared to going out there and meeting up with awesome developers.
I have been attending events as much as I can. Obviously, it is way easier to go to local events, to meet people who you are close to and create a near stable network. That being said, I started to expand my horizons in the past year or so, and I am trying to attend international events. I believe understanding the relevance to be connected with people is a key. They lead and give directions to the entire industry. You have to follow these big guys in the community!
This year I had the opportunity to attend Magento Developers Paradise, which took place in Croatia. So, I came all the way down from Brazil to Europe. During those four days of intense networking, I could sit down with CEO’s and CTO’s from many different Magento companies (agencies, consulting, training, module creating, etc.). I also had the pleasure of meeting the best of the best Magento Developers who have years of wide experience working with the platform. I made many friends that work with Magento from literally all over the world. I was able to sit down in many different tables and have dinner with a lot of interesting people. I had the chance to talk about important topics that gave me valuable insights.
Other than that, I have a funny story to tell! Is there anything better than to meet face to face with the people who answered very useful questions on StackOverflow? That happened to me during Magento Developers Paradise! I was having several issues with a module I was working on and a German developer helped me a lot. He said the module I was working on was obsolete and he gave me other useful alternatives. It matched perfectly to what I was looking for. Can you guess who I met in one of the parties of the event? Yes, Simon who had helped me so much, ha! He was amazed to hear me tell about how I had accomplished my goals in that project based on his instructions. His advice helped me save time and it allowed me to do things the best way possible. That was just one of the many great things that happened to me in that event.
I will be flying to the Netherlands in the next few days in order to attend to Mage Unconference. This conference — I mean this unconference — will have a different format. No predetermined talks or agenda, there will be just a panel for discussions in which the present attendees will come up with questions, share thoughts or comment on whatever they want to talk about. That’s going to happen full time during two days.
So, look for a local Magento meetups in your city or state/province. If you can’t find anything, maybe it’s time for you to start doing one! But, please, don’t keep going alone any longer.
Arpatech: What do you expect after the release of Magento 2? What’s your expectation with Magento in coming years? Do you think merchants can increase their sales with Magento 2?
Matheus: To be honest, I didn’t play around with Magento 2 very much. However, I do believe it is a significant accomplishment. It is not a new platform for the future, it’s a platform for now. During its ~8 years, Magento has been constantly improving and a major release was, in fact, needed to be made since it became “old”. The highlights of M2 are usage of Composer, Dependency Injection, jQuery, and support for Tests. Finally the core team published the platform in GitHub and have been receiving pull requests from any developer. The most wished thing has eventually happened: contributions from the community have already merged into the master branch!
I wouldn’t say merchants can increase their sales just by adopting M2, considering it doesn’t rely on the platform alone, but the set of all areas (design, usability, marketing, analytics & etc). The platform has a considerable part among them and yes, by making M2 part of it, the impact certainly will be positive.
Arpatech: Magento uses modules and extensions. Name some of the most important extensions that you recommend to use with every Magento website?
Matheus: Every single Magento store has its own particular rules, consequently it makes my job hard to answer this question. In a general perspective, my shoot for every Magento store would be:
Arpatech: Matheus, let’s put Magento aside for a bit and talk about your personal interests 🙂 I follow you on Facebook and I saw that you love traveling. Which sport you like most? How you spend your time besides work?
Matheus: SOCCER! As a good Brazilian I’m unfathomably passionate about soccer! Soccer is part of Brazilians’ Religion hahaha! To be honest I have been neither watching nor playing it as much as I would like to lately. But during Saturday’s morning I’m leading a Soccer Group in my neighborhood. Young guys from 13-21 have the opportunity to play, laugh, have fun with each other, and – the most import part – to listen a brief Bible reflection for the coming week. It’s not something big, but I may confidently tell you, it’s making a huge difference in their lives.
Besides work I like to hangout with friends: picnics, parties, and traveling – it’s wonderful!
Arpatech: Every one of us likes to follow some influencers. From whom do you get your inspirations? Name some Magento influencers who have inspired you with their work.
Matheus:
Do you want more? Go to StackOverflow User Reputation and find out the best of the bests! By the way, feel free to follow Matheus on Twitter: Follow @mhgontijo
Arpatech Website
Oct 7, 2016
Magento Influencers You Must Follow On Twitter
In the Magento Community, the influencers have played a major part and done a lot of contributions. From back end to front end development to community engagement, they have all managed to make Magento a better platform. These are some Magento influencers who have contributed to the development of Magento Community.
Ben Marks has a good reputation in Magento Community. Being an expert in Magento development he helped developers understand Magento. He has an exposure of 6 years of Magento Development and 3 years of training at Magento U. Ben is dedicated professional and always respond to queries. He’s a great source of information on Magento and PHP. He is also known as a Magento developer, educator, and an enthusiastic community member. Whether you are a newbie or a professional of Magento, he is the right person to follow for all your queries and concerns.
Meet Alan Storm, he is a source of practical Magento tips and bug fixes. He is an experienced e-commerce professional and creator of Commerce Bug. Alan is the author of No Frills Magento layout, a complete guide for newbie and professionals of Magento. He is active in Magento Community and loves to share his knowledge. If you want to know more about Magento, start following him today.
Follow @VinaiKopp
Meet Vinai Kopp, Freelance Magento trainer, Developer, Consultant and Author. Vinai has vast years of experience in web-development. He started developing Magento modules. He is the aurthor of Grokking Magento. Besides loving Magento Vinai like sport and is passionate about travelling to different places. Vinai is also a known speaker for topics related to Magento technicalities. He enjoys exploring projects. He is a great source of information, follow him to stay updated and learn about Magento.
Meet Kimberely, a Magento wizard! With an experience of over 15 years in developing and managing web applications, she has gained an expertise in architecting Magento solutions for her clients. The best thing about Kimberly – unlike most of us, she finds working under pressure, rather comfortable. Doesn’t matter how close the deadline seems to be, Kimberly and her teammates know how to deliver a high quality product that goes easy on their clients’ pockets and ensures them the immediate satisfaction! Kimberly also takes time out from her busy schedules for events that would help her enhance Magento architecting skills, such as #PreImagine, Meet Magento NY and also the monthly Magento Meetup in NYC – she makes sure she never misses out on any of these!
Meet Sylvain, a computer Engineer and Magento Community enthusiastic. He has a strong background in the domain of Web Development with experience of more than 10 years. He is also engaged with Magento for more than 6 years. His experience with the community leaves no question about his abilities. He is the founder of Diglin GmbH in Zurich (Switzerland), a company providing extensive development of eBusiness projects. Sylvain is a Co-organizer of Meet Magento Switzerland. He is a board member of German magento Community, Firegento. He is often invited as a speaker at many conferences around the globe and even helped in organizing various hackathons.
Meet Thomas Fleck, founder, and CEO of Netresearch. He is a multi-talented professional and also known for his multi-domain knowledge. From Entrepreneur to lawyer and idealist with over 15 years of working experience in the eCommerce sector, Thomas has an essence on different working environments. He is the initiator of Meet Magento – the leading event of Magento Community around the globe. He is well known among Magento Community. You must follow him to stay updated in the Magento World.
Meet Kalen Jorden, founder of magemail. He is engaged with Magento over years aind has contributed immensely to the Community. Kalen is the founder of Mage-Mail, an easy to setup plugin for Magento which saves time, money and helps to stay in touch with customers. Kalen actively participates in the Magento community. He is the co-host of MageTalk- a Magento community podcast. If you want to get yourself updated with latest Magento trends then you must start following him.
Meet Tim, an active Member of Magento Community. Tim leads Magento team at 21sportsgroup GmbH. He is a certified Magento developer with over 7 years’ experience of Magento Development and over 17 years’ experience in PHP development. He is active in StackExchange and other forums. Tim has been presenting in Magento Conferences and has published several articles. His main specializations are Magento Eco System and adopting Magento site for Mobile devices. He is a dedicated person. He is a great source of information.
Meet Piotr, an experienced Magento professional. He has been working with Magento since 2003 and have experienced different work flavors, from developer to sales engineer. He is an Ecommerce expert. Piotr has contributed his expertise in the domain of e-commerce Security. He is currently Lead Product Manager and responsible for Magento security and translation. Follow him if you don’t want to leave your website in the hands of a hacker.
Meet Alexander , founder and co-owner of ITABS SgR. He is an eCommerce and CMS specialist. He is a Magento expert and even deals with advanced PHP topics. He is well known for his PHP journals and solutions. He can be easily found on the internet and is always ready to help in any regard. If you want any good suggestion regarding eCommerce, you can always approach him.
Follow @MariusStrajeru
Meet Marius, a senior Magento developer. He is focused on backend development. He has been working with Magento since the version 1.0. Marius has created extensions for Magento Community. Marius is active on magento.stackexchange as he believes it’s a great platform to share knowledge. He is the moderator on magento.stackexchange since dec,2014. Marias have put great efforts in educating the community on Magento 2. He is the Magento Master 2016. He is active on Magento Stack exchange. You can learn a lot form this guy
Meet Anna Völkl, senior Magento developer at LimeSoda interactive Marketing GmbH. She is one the earliest Magento certified developer in Austria. Anna is professional Software engineer since 2016. She started her career with Magento in 2011. Since then she has contributed a lot in Magento community. Her contributions in Magento StackExchange/Mage stackDAy and giving talks on Magento events. Anna is Magento Master of 2016. She has contributed to Magento 2.x security. She is always engaged in Magento events and helped the community in organizing Magento-Stammtisch Wein and MagentoStackDay. She is always active on twitter. You can follow her and ask questions.She loves to share information
Meet Sherrie, Community Manager for Magento. Sherrie is one of the most famous people in Magento Community. She connects people and resources. She is engaged with Magento community. Sherrie was originally a Magento Developer, later she became Community Manager for Magento. She has a lot of resources to share. She co-produces a weekly broadcast for community professional which is known as #CMGRHangout. She is one backbone of Magento Community. To get involve in Magento Community, start following her on twitter
Sander is Magento Consultant, Senior Magento developer and technical lead at FitForMe. He is also known for his enthusiasm in coffee and e-commerce. Sander is engaged in Magento Community and stays updated about latest trends. He loves to reach new people in the community. Sander is Magento Master for 2016. He organized Magento User Group Rotterdam and MageStackDay. He is the mastermind of translating Magento platform to Dutch. He constantly helps the community on Magento StackExchnage. He is one of the best sources of knowledge. To learn more about Magento, follow this guy.
The pillars of Magento Community are laid by the influencers of Magento. Magento Evangelist are always ready to contribute in Magento community. There are other influencers who contribute in Magento Community. I have covered them in my next Article. Feel free to share your views in the comments below. 🙂
Arpatech Website
Oct 6, 2016
How to Secure Magento Against SQL Injections
We have all heard and witnessed that Magento comes with some predefined tools which are intended to secure your store from SQL injections. Yet the security researchers have found some vulnerabilities, which can potentially cause harm.
The vulnerability consists of compromising a chain of liability which allows malicious injections and unauthenticated attacker to execute random PHP/SQL codes on E-commerce websites. In layman’s terms, this allows the attacker to bypass all your security mechanism, then get the access to your store and the whole database. It lets the attacker then create a new admin account in your existing one, or lets them access and steal critical information like credit card etc. There are many other harmful things that SQL injections can cause to your Ecommerce business and your store’s customers. What is of more concern is the fact that this attack is not limited to any specific plugin or theme. It is present at the core Magento and it ends up affecting any default installation of community and enterprise editions both.
The Magento team issued a patch for fixing this problem, there was a lot of hype about code flaws discovered which were leading towards the exploitation. The security research community considered and viewed it as a very important concern and developers were given time to create a patch while users were given time to do the application of it. The details were then made public to help the other users and to make sure that the Magento community widely was aware of what was happening.
Unfortunately, after conducting further research and doing a detailed study researcher revealed that many web companies still have a lot of security concerns. There are nearly about 100,000 stores which happen to be still vulnerable. There have also been incidents of attacks which are used wildly against websites that have not implemented the patch till now. What we advise is being a Magento store owner, you need to apply the relevant patch right away.
You can easily find and apply this designed patch SUPEE-5344 which is released by Magento and can be found on this link: https://www.magentocommerce.com/download
We advise that, unauthenticated user or any attacker who can exploit the vulnerability and run the arbitrary PHP/SQL code on your Magento store to have full access to your store’s complete database and also any sensitive customer information needs to be taken care of immediately! Because unless and until your Magento website is patched, it is sadly vulnerable and can be exploited by offenders.
If you are unable or don’t know how to implement the patch, then leave a comment below and we will be happy to guide you through the whole process ☺
Arpatech Website
Oct 3, 2016
A Life time “Mistake” that made me A World ...
Marius by person is a very down to earth guy while he has a very vast professional experience and knowledge in the Magento field. He happens to be very active at Magento forums and all the Magento Communities. His expertise is in Magento Module Development. He is considered as this era’s dominant Magento Developer and ranked number 1 on Magento Stackexchange.
He has made important contributions to the development of Magento Platform, Magento Core Development, and Magento Extension Development. Read our exclusive interview with this World Class Magento Developer to find out more about his self-learned journey.
Arpatech: Marius, you have vast years of experience PHP Development side. How you started your career? When and how you started working with Magento? What challenges did you face in the initial stage of your career, and what you learned from these challenges?
Marius: I started working with PHP 10 years ago, when I was fresh out of college. I had zero “hands on” experience with web development, but luckily I found a company that was willing to train me. The teal lead there, Florin, was a great guy on and off work, he had a lot of patience with me and he really made me like what I was doing.
I don’t think I have any memorable challenges from the start of my career. As I said, I had a great team lead that handled all the “fire-fighting”.
But I can mention a challenge that happened 2 years later. It’s called Magento. I started working with it by “mistake” with no one to guide me or help me. No documentation, no previous experience with a similar system, nothing. It took me 1 month to come up with a product import from a third party system, that was really really slow and sometimes crashed. Then I screwed up the core and had to upgrade manually. Then screwed it up again. You probably can guess what I’ve learned from this. Yep…”Never touch the core”.
Arpatech: Currently you are working in Arnia Software as a PHP Developer since 3+ years, And in this time frame you got 2 Honor Awards “Magento Pioneer Award” and “Magento Master: Mentor”. How do you feel about achieving these awards? What was your reaction when you were nominated for these awards :)? Share some motivational thoughts with our readers, how you made yourself a Magento Master: Mentor?
Marius: You are right. I’ve been working at Arnia Software for more than 3 years (and counting). It’s a great place to work, I’m surrounded by people that I can call, without any regret, my friends. This makes it a lot easier every day.
But the awards did not come because of my work at Arnia. I rarely do any Magento projects here. I haven’t worked on one in 2 years.
The nominations and awards made me happy of course. It showed that the work I’ve done so far is appreciated and useful.
It all started with the challenge I mentioned before. I had to learn Magento by myself. Back then the old magento forum was really slim with shady answers and I started answering questions with challenges similar to what I had to make it easier for others. Years later magento.stackexchange came along and I shifted my focus there, mostly because the forum was more spam than useful information.
I had some free time at that point to answer questions. For a lot of them I didn’t know the answer but they were interesting enough to make me dig further. That helped me learn a lot as well.
As for motivation, I have nothing more to say than “always take a hands on approach”. I’m not good at motivating people :).
Arpatech: Marius, You are the most active and helpful member in the Magento community. What’s your advice for newbie, who want to connect their self with Magento? What is the best Magento learning platform you recommend for developers?
Marius: I don’t know if I’m still the most active lately. I don’t have that much spare time as I used to. There are a lot of people that became active on StackExchange and the new forum, Thumbs up to everyone. My advice, same as above, when hitting a problem, first try to understand the problem and then look for solutions.
Today, not like 8 years ago, there is a lot of good learning material on the web. There is stackoverflow with a large pool of questions and answers for magento. Now they started the documentation section that covers Magento 1 and Magento 2, there is magento.stackexchange.com, there is the Magento forum and a lot of good blogs out there. I will not list them all because I don’t know them all, but I want to mention my good friends at Inchoo.
Arpatech: What would be your recommendations for e-merchants who are looking to upgrade from 1.x to the Magento 2? How do you foresee the future of Magento, After the release of Magento 2?
Marius: I don’t think I’m in a position to give advice to merchants about Magento 2. I haven’t worked in a real life Magento 2 project. All I can say is that at some point they will have to make the switch, Magento 1 comes to EOL in 2 years so ….
Arpatech: Marius, What are your thoughts about Magento 2? What would you recommend to those developers who are working on migrating their store from Magento 1 to Magento 2? And what features do you think they should keep into consideration while doing the migration? What features you like to see in Magento 2?
Marius: I have mixed feelings about Magento 2, but they are based only on the things I’ve been able to dig so far just for fun. There are a lot of things I like, like the plugin system and the fact that there are small separate config files for each purpose, no more big fat config file in which you can get lost. But there are some things I don’t like. The only one I’m going to mention is the lack of consistency. Now, the same thing is done in more ways even in the core. For example the admin grids and add/edit forms. But, from what I understood from the core team, this will get standardized in the next releases.
And there are things I don’t understand yet and I don’t want to talk about them :).
My favorite improvement in Magento 2 is the way of creating configurable products and the fact that you can see without any clicks, the categories assigned to a products. Those have always been the hardest to explain to new developers and specially to clients.
Arpatech: Magento uses extensions and modules, which extensions would you recommend for the deployment of each Magento web store? What’s your advice for building own extensions and which things should the developer consider while developing their own extensions?
Marius: I don’t want to recommend any extensions. There are a lot of good extensions out there that serve different purposes. I don’t even know where to begin and I don’t want to turn this interview into a popularity contest.
As for advice for building an extension…nothing fancy, just a few common sense guidelines that will ensure a good code quality and an easy maintainability. I wrote this Magento SE post a while ago when I tried to install 2 horribly written extensions and struggled for 1 day to make them work even is they were marketed as plug&play. Don’t be those guys.
Coincidence…I’m presenting something about building Magento extension this year at MeetMagento Romania but on a slightly different approach. The slides will be online after the conference.
Arpatech: You were an attendee of the Magento Imagine 2016. How many Magento events have you attended till date? In your opinion, what are the advantages of attending the Magento Imagine and Meet Magento conferences for amateurs who want to involve themselves in the Magento Community?
Marius: This year it was my third Imagine and each year is different. Beside Imagine I’ve been twice to Meet Magento Romania (this year will be my third) and to MageTitans Italy this year. Like I said, every conference is different because of the venue, the culture of the country, the food and the after party :), but one thing is the same. The atmosphere. The same friendly people that share the same obsession/passion/frustration/goal.
I strongly recommend these events as a way of learning something new or getting new ideas from different presentations but mostly for the people involved. Everyone is friendly and willing to chat over a cup of coffee in the morning and over a beer in the evening. Lets socialize in real life not only on the web.
Arpatech: Let’s get aside Magento and talk about your personal interests, how you spend your time besides work? Are you a Family guy :)? Which sport you like to play?
Marius: When I’m not working, I spend my time with my wife, Oana, and our 3yo son, Alex. That takes about all of my spare time and I’m loving every second of it.
And from time to time I like to compensate the fact that I spend most of the time on a chair in front of the computer. I try, at least once a week to play football/soccer and once tennis. I would really love it if, for a future Magento event, someone organizes a MageFootball or TennisGento or MageBasketball tournament similar to the MageRun events.
Arpatech: Everyone has a few mentors, whose work and quotes inspire us. Can you name some of the people of Magento community who have motivated you throughout your journey?
Marius: Oh, there are a lot of people that inspire me. I’m sorry because I’m sure I forgot someone in the list below.
I have to start with my good friends, the MageStackDay crew. Anna Völkl, Sander Mangel and David Manners. I talk to them daily and complain about our problems and communicate solutions and ideas.
Then there is Ben (he doesn’t need a last name, because he’s a superstar). I’m really amazed how he can keep it together while spending more time on a plane than on the ground.
Phil Jackson with all the podcasts and NomadMage and all the other things he organizes (I lost track of them), I don’t know where he gets the time.
Vinai Koop who is trying to teach the world proper development etiquette and making all of us write tests.
Fabrizio Branca that is always one step ahead of everyone and takes development and infrastructure setup to another level.
And I really want to mention someone that, from my point of view, does not get enough recognition and exposure in the Magento Community even if he should. Allan MacGregor. A great guy and a Magento Guru.
Arpatech Website
Sep 30, 2016
How to add customer attribute in Magento 2.x
Many of us are facing problems in adding custom attributes to customer profile in Magento 2. Here is how to add a custom field in Magento 2. Thanks to sashas extension for providing easy solution on adding a custom field.
There are many ways to add custom field for customers in Magento 2. Today we will focus on extension for Magento 2 which adds attribute to customer edit page at admin.
To begin with you will need Magento 2 installed with demo data. For more information you can see the Magento 2 installation guide.
Our step by step instruction allow you to create a successful attribute of Customer in admin panel.
You must have heard about the change in architecture of Magento with the release of Magento 2, but you don’t need to worry about it now. The extension files are placed exactly same way as it was in Magento 1.x. The extension files will be under app/code/(CompanyName)/(ExtensionName). For this tutorial the company name we will use is Sashas and extension name will be customerAttribute.
You can use you own company/extension name as per your need. We will create folders and path to the extension will be app/code/Sashas/CustomerAttribute/
The folder structure inside the extension folder in Magento 2 is quiet similar to Magento 1.x. We will need to create ‘etc’ and ‘setup’ folder inside the Magento extension folder.
The folder structure will look like this
In next step you will need to create module.xml file for extension to declare the version and visibility for Magento2. The module.xml file is replacement of for the previous module file under app/etc/modules folder. This way will lead all files of extension to be in one folder.
For this tutorial, I assume you know how to create a file in Magento 2. Read here to know more about Magento file structure.
To begin with, we need to create the file app/code/Sashas/CustomerAttribute/etc/module.xml. This file will make the extension visible.
module.xml
[xml]
<?xml version=”1.0″ encoding=”UTF-8″?>
<!–
/**
* @author Sashas
* @category Sashas
* @package Sashas_CustomerAttribute
* @copyright Copyright (c) 2015 Sashas IT Support Inc. (http://www.extensions.sashas.org)
*/
–>
<config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd”>
<module name=”Sashas_CustomerAttribute” setup_version=”1.0.0″>
<sequence>
<module name=”Magento_Customer”/>
</sequence>
</module>
</config>
[/xml]
In the section we have defined the extension name and version. Here we used the name “Arpatech_CustomerAttr” and version = 1.0.0. You can use your own name of extension. Now we will add the list file. It will have the path app/code/Arpatech/customerAttr/Setup/InstallData.php. In next step we will create InstallData.php.
The install function here is used to add attribute for entity “customer” and after it we set it to be used in form adminhtml_customer.
As per your requirement the customer attribute can be used in different forms. For this tutorial we will use this attribute in customer edit page in admin panel.
“used_in_forms” => [‘adminhtml_customer_address’, ‘customer_address_edit’, ‘customer_register_address’]
[php]
<?php
/**
* @author Sashas
* @category Sashas
* @package Sashas_CustomerAttribute
* @copyright Copyright (c) 2015 Sashas IT Support Inc. (http://www.extensions.sashas.org)
*/
namespace Sashas\CustomerAttribute\Setup;
use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Customer\Model\Customer;
use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;</pre>
<pre>
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
* @var CustomerSetupFactory
*/
protected $customerSetupFactory;
/**
* @var AttributeSetFactory
*/
private $attributeSetFactory;
/**
* @param CustomerSetupFactory $customerSetupFactory
* @param AttributeSetFactory $attributeSetFactory
*/
public function __construct(
CustomerSetupFactory $customerSetupFactory,
AttributeSetFactory $attributeSetFactory
) {
$this->customerSetupFactory = $customerSetupFactory;
$this->attributeSetFactory = $attributeSetFactory;
}
/**
* {@inheritdoc}
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create([‘setup’ => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType(‘customer’);
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
/** @var $attributeSet AttributeSet */
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(Customer::ENTITY, ‘magento_username’, [
‘type’ => ‘varchar’,
‘label’ => ‘Magento Username’,
‘input’ => ‘text’,
‘required’ => false,
‘visible’ => true,
‘user_defined’ => true,
‘sort_order’ => 1000,
‘position’ => 1000,
‘system’ => 0,
]);
$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, ‘magento_username’)
->addData([
‘attribute_set_id’ => $attributeSetId,
‘attribute_group_id’ => $attributeGroupId,
‘used_in_forms’ => [‘adminhtml_customer’],
]);
$attribute->save();
}
}
[/php]
As you can see we have used attribute code magento_name and we set the properties in similar way as Magento 1.x. After you get through with the code you need to launch Magento Upgrade and clean cache.
You can use shell command to launch Magento Upgrade: php bin/magento setup:upgrade. This will perform all necessary upgrade for extension. After upgrading you will need to clear all the cache.
To clear the cache use the following shell command: php bin/magento cache:flush-all
I hope now you will be able to create customized plugin in Magento 2.
Know how to save your store against brute force attack.
Arpatech Website
Sep 19, 2016
Design
Art
AI
Development
Apps