AResourcePool - Common Problems and Solutions of Magento 2

Views:
 
Category: Entertainment
     
 

Presentation Description

In this document, AResourcePool is introducing its Magento 2 development services. If you want a new trending website for your e-commerce and other projects, then Magento 2 is the widely used platform to develop your project. AResourcePool provides custom Magento 2 Development services to their clients. Feel free to contact us anytime regarding our quality web development services in India, USA and UK.

Comments

Presentation Transcript

slide 1:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ Common Problems and Solutions of Magento 2 Magento 2 is a champion among the most prevailing and understood online business stages. Since Magento is a totally incorporate stacked stage it may seem by all accounts to be difficult to manage. Nowadays every business is going to use this advanced technology to make their business effectively. If you are the one among them and wants to hire Magento 2 developer India then AResourcePool is the best company that provides valuable or experienced developer for the same. Well if you want to learn something that you can do on your own then here you go: How to add header and footer to Magento 2  For Header: Step 1: First in the folder app/code create a custom module which should be based on Magento 2 structure. Ex: Magento 2 root directory/app/code/Dckap/Newlink/ Step 2: Now in the below path create module.xml file which will describe your Magento 2 extension.

slide 2:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ Magento 2 root directory/app/code/Dckap/Newlink/etc/module.xml xml version“1.0” config xmlns:xsi“http://www.w3.org/2001/XMLSchema- instance”xsi:noNamespaceSchemaLocation“../../../../../lib/internal/Magento/Fram ework/Module/etc/module.xsd” module name“Dckap_Newlink” setup_version“2.0.1”/module /config Step 3: In the below path now create routes.xml for your custom link. Magento 2 root directory/app/Dckap/Newlink/etc/frontend/routes.xml xml version“1.0” config xmlns:xsi“http://www.w3.org/2001/XMLSchema- instance”xsi:noNamespaceSchemaLocation“../../../../../../lib/internal/Magento/Fra mework/App/etc/routes.xsd” router id“standard” route id“newlink” frontName“newlink” module name“Dckap_Newlink” / /route /router /config Step 4: In the below path now made layout file for a custom header. Magento2 root directory/app/Dckap/Newlink/view/frontend/layout/header.xml xml version“1.0” page xmlns:xsi“http://www.w3.org/2001/XMLSchema-instance” layout“1column”xsi:noNamespaceSchemaLocation“../../../../../../../lib/internal/M agento/Framework/View/Layout/etc/page_configuration.xsd” body referenceBlock name“header.links”

slide 3:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ move element“test-last” destination“header.links”/ block class“Dckap\Newlink\Block\Header” name“test-link” after“my- account-link”/ /referenceBlock /body /page Step 5: In the below path of the layout file create block file. Magento2 root directory/app/Dckap/Newlink/Block/Header.php php namespace Dckap\Newlink\Block class Header extends \Magento\Framework\View\Element\Html\Link protected _template ‘Dckap_Newlink::link.phtml’ public function getHref return__ ‘testuser’ public function getLabel return __‘Test Link’ For third party URLs follow the above code. Step 6: In the below path create template file that should be referred to the block file. Magento2 root directory/app/Dckap/Newlink/frontend/templates/link.phtml li a php echo block-getLinkAttributes php echo block-

slide 4:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ escapeHtmlblock-getLabel php echoblock-getCounter ‘span‘ . block-escapeHtmlblock- getCounter . ‘/span‘ : ” /a /li Step 7: When you are done with the above steps just run the below Magento 2 and its upgrade command in the command prompt. php bin/magentosetup:upgrade When you run this command after that clear the entire cache of Magento as well as also check the extension as it is installed or not.  For Footer: Step 1: Now it’s time to create custom footer in Magento 2 link so follow the above first 3 steps of header and put back the layout file with the code mentioned below: Magento2 root directory/app/Dckap/Newlink/view/frontend/layout/footer.xml xml version“1.0” page xmlns:xsi“http://www.w3.org/2001/XMLSchema-instance” layout“1column”xsi:noNamespaceSchemaLocation“../../../../../../../lib/internal/M agento/Framework/View/Layout/etc/page_configuration.xsd” page referenceBlock name“footer_links” block class“Magento\Framework\View\Element\Html\Link\Current” name“2custom-link” arguments argument name“label” xsi:type“string”Footer Link/argument argument name“path” xsi:type“string”testuser/argument /arguments /block

slide 5:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ /referenceBlock /page Step 2. You can get the argument value by following two steps: Use block file. This is specially used by header. Specify argument value in layout file. This is specially used by footer. Step 3: Follow the 7 th step mention in the header. By using these steps you can simply add the header and footer in the Magento 2. How to improve the security of Magento 2 store The greatest worry of each online business is the security of their online store. So follow the best tips for improving your Magento 2 security. Latest Magento Version is best:Commonly you will be informed that the latest isnt the best.. Magento reliably gets refreshed at a decent pace. Resulting Magento adaptations fix security issues of the previous ones. Subsequently it is basic to remain educated about the most recent Magento variant. Utilize Two-Factor Authentication:In this age a protected Magento secret key is unfortunately insufficient. There are a couple of expansions that convey two-factor validation with the goal that you dont need to stress over secret word related Magento security hazards any longer. Custom path for the Admin Panel:It is easy for programmers to jump on to your administrator sign in page and begin speculating passwords. You can keep this by/administrator with a tweaked term. It likewise keeps programmers from jumping on to your administrator login page regardless of whether they some way or another get hold of your secret phrase.

slide 6:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ Pick a high caliber of security Hosting supplier:You ought to pick an authentic facilitating supplier for your site and getting some information about security before choosing to explore to this facilitating. You should likewise guarantee this facilitating supplier claim a safe programming improvement which is reasonable for your site. This is critical on the grounds that you will claim a high-security site with the supporting from high-security facilitating supplier. Secure condition:   With the safe condition your Magento 2 site absolutely runs easily. Along these lines you ought to secure your condition cautiously. The following are a few answers for a sheltered situation:   Update all the product and apply fixes as when suggested   Approach the facilitating supplier for erasing all the pointless programming on the server   Simply utilize secure interchanges convention like SSH SFTP or HTTPS to oversee records   Utilize a secret key as most secure as you can and transform it occasionally   Fix any issues which are accounted for programming parts utilized by your Magento establishment as you see the alert Improve Magento 2 security: Magento 2 is the most recent rendition from Magento with the best security fixes so you dont stress over Magento 2 establishment. Be that as it may you ought to improve the security by designing the security for setup settings secret phrase and continuous support. Furthermore some different things you ought to do are:   Supplanting the default "administrator" or the regularly utilized "backend" by a one of a kind custom Admin URL   Blocking access to any improvement arranging or testing frameworks   Utilizing a right record authorizations

slide 7:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ Try not to be shown a good time: Having a cautious thought before choosing to introduce any expansions or snap on an advertisement. Especially get ready for all of sudden issues  Improve your recuperation congruity plan  Test the reinforcement routinely to guarantee that it very well may be reestablished  Work with your facilitating supplier to make an expert database reinforcement arrangement Check for indications of attack: You should check for indications of assault routinely. A standout amongst the most famous signs is that your framework isnt quickly fixed after a noteworthy security break. For this situation you can do others like:  Check the Admin activities Log for suspicious action  Utilize programmed log survey devices  Audit server logs for suspicious by asking the co-task from your facilitating supplier Counteract MySQL Injection: Despite the fact that Magento gives fantastic help to outflank any MySQL infusion assaults with its more up to date forms and fixes it isnt generally a perfect way to deal with depend just on them. We propose that you include web application firewalls for example NAXSI to protect your website and your clients. Complete a Magento Security Review: Magento engineers are not really security specialists. Truly huge numbers of them are great at coding however just a couple of know the complexities of Magento site security. That is the reason once or maybe twice a year you ought to get

slide 8:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ your site examined for evident escape clauses and security inadequacies. On the off chance that effectively done these surveys help in further solidifying of your Magento safety efforts. Admin url returning 404 error in Magento 2 You can get an error while downloading Magento 2. The error that you can get is 404 Error Page Not Found. Well if you get the error then dont worry as there is some solution. Mainly there are 4 reasons why 404 Error Page Not Found is:   Reason 1: After installing/upgrading   Reason 2: Fresh Install On Ubuntu/Centos/Debian   Reason 3: Page 403 Forbidden errors   Reason 4: Messy page no style SOLUTION 1: Flush Magento Cache with command line: php bin/magentocache:clean rm -rf var/cache/ rm -rf var/generation/ Solution 2: Enable Rewrite mode sudo a2enmod rewrite Configure apache For Ubuntu / Debian edit the file /etc/apache2/apache2.conf. To edit this file run command sudo vi /etc/apache2/apache2.conf Modify from:

slide 9:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ Directory /var/www/ Options Indexes FollowSymLinks AllowOverride None Require all granted /Directory to Directory /var/www/ Options Indexes FollowSymLinks AllowOverride All Require all granted /Directory Then restart apache sudo service apache2 restart or sudo /etc/init.d/apache2 restart Solution 3: Open apache2.conf file For Ubuntu the file /etc/apache2/apache2.conf. To edit this file run command sudo vi /etc/apache2/apache2.conf Update like this: Directory /var/www/ Options Indexes FollowSymLinksMultiViews AllowOverride All Order allowdeny Allow from all /Directory Create a custom frontend view in Magento 2:

slide 10:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ There are five steps involved in creating a fronted view in Magento 2. So here have a look at those steps: Step 1: Register CustomView module Register a new custom view module with the help of Namespace Cloudways. For that you can go to app/code/Cloudways/Newmodule and create a new registration.php file. Step 2: Create a Controller action Just make the file Index.php file as go to app/code/Cloudways/Newmodule/Controller/Index. It would be the controller action. Step 3: Create a Layout file For creating a layout file use a file inside the module folder which is named after the module structure. The general naming style isRouterName_ControllerName_ActionName.xml. So in this case create the file newmodule_index_index.xml in app/code/Cloudways/Newmodule/view/frontend/layout directory. Step 4: Create a Block file Now to create a block file of the module follow this direction. Block file has many logical functions which will be used in the file of the template. For creating the block file type code app/code/Cloudways/Newmodule/Block and name it Newmodule.php. Step 5: Create a Template file File of the template will be stored as the new module .phtml which will be locate in and app/code/Cloudways/Newmodule/view/frontend/templates.

slide 11:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ Disable add to cart button in Magento 2 In order to disable the add to cart button one must have to build a system module. As there is no good option to edit the files as well as do the editing. When you get done with the creation of the module just build InstallData.php file in app/code/Magenticians/Mymodule/Setup. You have to add some code in it like: php namespace Magenticians\Mymodule\Setup use Magento\Eav\Setup\EavSetup use Magento\Eav\Setup\EavSetupFactory use Magento\Framework\Setup\InstallDataInterface use Magento\Framework\Setup\ModuleContextInterface use Magento\Framework\Setup\ModuleDataSetupInterface use Magento\Catalog\Setup\CategorySetupFactory use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory class InstallData implements InstallDataInterface private eavSetupFactory private attributeSetFactory private attributeSet private categorySetupFactory public function __constructEavSetupFactory eavSetupFactory AttributeSetFactory attributeSetFactory CategorySetupFactory categorySetupFactory this-eavSetupFactory eavSetupFactory this-attributeSetFactory attributeSetFactory this-categorySetupFactory categorySetupFactory public function installModuleDataSetupInterface setup ModuleContextInterface context

slide 12:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ setup-startSetup How to add custom admin menu in Magento 2 Step 1: Build a new registration.php file in Magento2Root/app/code/Cloudways/Adminmenu/ and add the code below to it: php \Magento\Framework\Component\ComponentRegistrar::register \Magento\Framework\Component\ComponentRegistrar::MODULE Cloudways_Adminmenu __DIR__ Now to declare the module create a module.xml file in Cloudways/Adminmenu/etc/ with the following code: xml version"1.0" config xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation"urn:magento:framework:Module/etc/module.x sd" module name"Cloudways_Adminmenu" setup_version"1.0.0"/module /config File menu.xml will handled the admin menu. This file holds of config menu and add elements. menu constituent may have of multiple add elements as well. Create a new file menu.xml in Cloudways/Adminmenu/etc/adminhtml/ and add the following content to it: xml version"1.0" config xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation"urn:magento:module:Magento_Backend:etc/ menu.xsd" menu add id"Cloudways_Adminmenu::first_level_demo" title"Cloudways Admin Menu"

slide 13:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ module"Cloudways_Adminmenu" sortOrder"20" resource"Magento_Backend::content" / add id"Cloudways_Adminmenu::second_level_demo" title"Sub Menu" module"Cloudways_Adminmenu" sortOrder"1" action"menuitem/index/index" parent"Cloudways_Adminmenu::first_level_demo" resource"Magento_Backend::content" / /menu /config As should be obvious the menu.xml record we have characterized two add component with characteristics. Initial one is utilized for first dimension menu and the second one is for the second dimension menu with extra activities and parent properties. Here is a clarification of each characteristic: id – one of a kind identifier title – title of the menu that will appear in the administrator module – shows the module sortOrder – organize the spot of menu asset – the standard to distinguish which administrator client see and access this menu activity – connection to the predetermined administrator controller parent – characterizes on which first dimension menu it depends At long last everything is prepared that will include custom administrator menu in Magento 2 Admin Panel. To empower and initiate the custom module run the accompanying CLI directions:

slide 14:

Email id- infoaresourcepool.com Website - https://www.aresourcepool.com/ rm -rf var/di/ var/generation/ var/cache/ var/log/ var/page_cache/ php bin/magentocache:clean php bin/magentocache:flush php bin/magentosetup:upgrade php bin/magentosetup:di:compile php bin/magentoindexer:reindex In the end it will look something like this: Magento 2 is very vast topic which has so much new to learn or modify. If you want such kind of service then hire Magento 2 developer India from Aresourcepool. The developer from the company will help you with the best. Link- https://websiteandmobileappdevelopmentcompany.blogspot.com/2019/04/common-problems- its-solutions-of.html

authorStream Live Help