This tutorial covers two major aspect of the Magento 2 website management. It covers Magento 2 maintenance followed by advanced Magento 2 tutorials.
Magento 2 Maintenance Tutorials
Cache Management in Magento 2
The Caching system of Magento 2 will help your Store perform better and faster especially when you add more content to it. In this tutorial, we will talk about the different cache types and how to flush the cache of your Store.
To access the Cache, you will need to login to your admin dashboard and navigate to the System → Cache Management section.
To flush the entire Magento 2 cache, simply click on the big orange button titled Flush Magento Cache.
Now let us talk about the different types of cache at your disposal:
- Configuration - This Cache contains configuration and store specific settings. You will need to flush it after modifying configuration files
- Layouts - Contains the compiled page layout from all components. Flush after modifying layout files
- Blocks HTML output - Contains HTML page fragments per block. Flush after modifying the view layer of your store
- Collections Data - Automatically cleaned by Magento, this cache type collects results from database queries. Custom modules may write entries which Magento will not be able to clean by itself, in those cases flush the cache manually
- Reflection Data - Any API interfaces reflection data will be cached here
- Database DDL operations - Automatically cleaned by Magento, this cache type holds custom changes to the database schema
- EAV types and attributes - This cache collects metadata regarding the entity attributes
- Integrations Configuration - Caches the compiled integrations on your store. Clean after adding new or changing existing integrations
- Integrations API Configuration - Caches the API configuration of your Store’s Integrations
- Page Cache - This is the cache you will need to flush frequently as it is connected to the HTML pages of your store
- Translations - Merged translations from all modules will be cached via this cache type
- Web Services Configuration - Caches the Web API Structure of your website
For example, when you change the HTML output of a page, you will receive a notification regarding the change and a link to the Cache Manager so you can refresh the Page Cache.
Select the Page Cache, from the drop-down action menu select the Refresh option and click the Submit button.
You also have the Additional Cache Management options:
- Catalog Images Cache - Flush this cache, if you have catalog images that have been cached but are no longer needed
- Static Files Cache - All Static Files cache can be flushed from here
How to Change the Admin URL in Magento 2
Magento 2 has the option for you to type a custom Admin URL when you install it, but if you wish to later change your Admin URL again, you might find the option for it in the admin dashboard and as a result make your admin area inaccessible.
To change the Admin URL in Magento 2, you will have to:
- Step 1: Modify the evn.php file
- Step 2: Modify the Database
Modify the evn.php file
To correctly change the admin URL of your Magento 2 website, you will need to first go into cPanel → FIle manager and find the file env.php located in:
Right click on the file and select the Edit Code option.
Now you will need to change this line:
'frontName' => 'admin'
By adding your new admin URL in the 'admin' field.
Click on the Save Changes button at the top right corner and you are done with the file change.
Modify the Database
Now you will also need to modify a line in one of the tables of your Magento 2 database. You can do that, by navigating to the phpMyAdmin service located in your cPanel.
Click on the Database you use for the Magento 2 application and open the core_config_data table. Now look for the entry:
which will most likely be on page 11.
You will need to change the /admin part in http://yourdomain/admin to the same value you added in the env.php file by clicking on the Edit button for this entry.
When you are ready, click on the Go button to apply the change.
How to Backup your Magento 2 website
The most reliable and safe way to backup your Magento 2 website is by manually exporting your files and database to your local computer. In this tutorial we will show you the process and actions needed in order to achieve that.
To backup your Magento 2 Installation, you will need to:
The first thing you must do in order to backup your files is to access your hosting account’s file structure.
There are two ways of downloading your files from the server - using an FTP client, following our FTP tutorial, or downloading directly through your cPanel account > File Manager, following our cPanel tutorial.
It is important to locate the directory that contains all of the files and folders of your Magento 2 installation.
If you are accessing your website via http://example.com/ Magento 2 will be located directly within the /public_html directory of your account.
However, if you are accessing your website via a link like http://example.com/store/ where example.com is your domain name and "store" is a subfolder on your account, this will indicate that the Magento 2 application is located in that folder within the /public_html/ directory of your account.
To create a backup of the MySQL database used on your Magento 2 website, you need to navigate to the phpMyAdmin service from within your cPanel.
Click on the name of the database used by your website.
Hit the Export button to save the database on your local computer as a .sql file.
Select the Quick exporting method, SQL as a format and hit the Go button.
With this done, you have completed the backup of your Magento 2 Store.
Magento 2 Advanced Tutorials
How to Integrate Zopim in Magento 2
A great way to provide your Magento 2 Store's guests with assistance is to have a live chat enabled for your website. This will increase your orders as you can help your clients with their request and offer them items they might have difficulties finding. In this tutorial we will review the integration of Zopim live chat in your Magento 2 website.
To get Zopim working with Magento 2 you will need to:
Get the Zopim Addon
In order, to get the Zopim Live Chat addon you will need to log into your Zopim Client Area and then navigate to the Order section.
Select the Product Addons tab, which will includes all of the extra services that are offered.
Scroll down till you find the Zopim Live Chat service. So simply click on the Add to cart button.
Complete the order for and you will receive an email to verify it shortly after. The new email includes a direct link to your Zopim live chat dashboard and the login credentials for it.
Integrate Zopim with Magento
Start by loggin into your Zopim account and accessing the Widget tab under the Settings section.
Copy the script you are presented with, access the admin area of your Magento 2 and navigate to Stores → Configuration.
In the General section, select the Design option. Expand the Footer section and paste the Zopim script in the Miscellaneous HTML field.
Save the changes on your website and access the front-end. You will be able to see the Zopim widget displayed at the bottom of the page.
Changing the Domain associated with Magento 2
Rebranding or changing the goods you sell may lead to a need for a change in the domain name of your Store. In this Tutorial, we will help you reconfigure your Magento 2 Store to open via a new domain.
Before you continue, make sure your new domain is properly configured and pointed to the servers of the hosting provider on which your current Magento 2 installation resides.
Now you will need to login to the admin area of your Magento 2 website and navigate to the Stores → Configuration section from the main admin panel.
Go to the General → Web tab from the navigation menu on the left and expand the Base URL section.
If your current domain is example.com and you wish to change your Magento 2 to be accessible via your new domain example22.com you will need to make the change in the URL here. You will also need to expand the Base URL (Secure) section and make the same change on the URL.
Once you are ready, hit the Save Config button at the top right corner of the page to apply the changes and make Magento 2 open via your new domain.
How to Reset the Admin Password in Magento 2
If you are not using an encryption program to save your passwords, you might end up forgetting it and being unable to access your admin area in Magento 2. Luckily you have 2 options in that situation.
To reset your admin password for Magento 2, you have two options:
The easier way to reset your password is by using the Forgot your password? feature located in the admin dashboard login screen.
Type your admin email address and click on the Retrieve Password button.
On your email address, you will receive a link with which you can create a new password for your account.
If for some reason, you have no access to the email address associated with your Admin account in Magento 2, you will have to edit the database manually in order to regain access. To do that, you will need to login to your cPanel and access the phpMyAdmin service.
Click on the database you use for your Magento 2, search for admin and access the admin_user table.
Click on the Edit button and then input your new admin email address in the email value field and the new admin password in the password value field using the MD5 function.
Scroll down and click on the Go button to save the changes. Now you will be able to login with the newly configured credentials.
Integrating Google Analytics in Magento 2
Being able to track the traffic on your Magento 2 website will enable you to better manage the products on your store and have more customers. Google Analytics has you covered when it comes to traffic tracking.
To enable Google Analytics in Magento 2 you will need to:
Obtain a tracking ID
To obtain this tracking ID you have to create an account with Google Analytics.
Select the Sign in with Google Analytics option and click Sign up.
Fill the account details and scroll to the bottom of the page to click on the Get Tracking ID button.
Now you will have to accept the Google Analytics Terms of Service, if you read and agreed with them.
You will now have to copy the tracking ID in preparation for the next step.
Configure the Google API in Magento 2
Login to your Magento 2 admin area and navigate to Stores → Configuration.
Access the Sales>Google API section, expand the Google Analytics option, Enable it and paste the tracking code in the Account Number field. Also click on the Save Config button to apply the changes.
Wait a few minutes for the traffic data to load in your Google Analytics dashboard and you will be able to track the activity on your website.
How to Generate a Sitemap in Magento 2
A Sitemap is a plain text XML file that contains link to all of the pages on your website. It is used by the Search Engines to properly crawl and index your website. In Magento 1.x this option was called Google Sitemaps and was located in the Catalog menu. However, things have changed in Magento 2.
To access your Sitemap's configuration page, you will need to access your website's admin area and navigate to Stores → Configuration.
From there access the Catalog → XML Sitemap section.
Here you will have to expand all of the individual parts of the configuration page:
For Categories, Products and CMS options you will have frequency and priority of creation of new entries as well as an option to add the images of products into the sitemap.
In the Generation Settings you will be able to Enable Sitemap Generation and set a time of the day for it (if you choose a daily frequency for example).
In the Sitemap File Limits section, you can choose the limit of URLs per file and the maximum size of a file (in bytes). Last but not least, you will have to decide, if you want to If you add a reference of your sitemap to your robots.txt file. This will make search engines find it automatically.
Once you have configured the XML Sitemap schedule and options, click the Save Config button at the top right corner of the page.