Magento 2 has a rich in feature to add categories as it comes with default root category. You can create your own category and name as your wish. First and foremost you need to login magento dashboard. Navigate to products > Categories as shown in fig. 1.0 There is already a root category by…
You can create a skeleton of module from Module Generator. After creating a module structure update your module to database using command line code :
1 |
php bin/magento setup:upgrade |
To every magento project there needs certain level of customization on overriding magento core classes. Editing and adding our custom code on magento core classes is a bad practice…
The static view files deployment command enables you to write static files to the Magento file system when the Magento software is set for production mode. 1. Deploy all static contents
1 |
php bin/magento setup:static-content:deploy |
2. Deploy static content of locale AU
1 |
php bin/magento setup:static-content:deploy --language en_AU |
3. Deploy static content of Admin
1 |
php bin/magento setup:static-content:deploy --area adminhtml |
4. Deploy static content for frontend
1 |
php bin/magento setup:static-content:deploy --area frontend |
5.…
In between Magento 1.x and 2.x, rendering the Static block is quiet different. You can call either in .phtml template, CMS page or layout file in the following way. In phtml file:
1 |
<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block-identifier')->toHtml();?> |
In layout file:
1 2 3 4 5 6 7 |
<referenceContainer name="content"> <block class="magento\Cms\Block\Block" name="block-identifier"> <arguments> <argument name="block_id" xsi:type="string">block-identifier</argument> </arguments> </block> </referenceContainer> |
In any CMS block:
1 |
{{block class="Magento\Cms\Block\Block" block_id="block-identifier"}} |
If you forgot your admin password in magento 2 in localhost you cann’t retrieve by just clicking on lost password. For that you can reset through Magento CLI, then you can easily change password of your original user. Go inside magento directory and type:
1 |
php bin/magento admin:user:create --admin-user="admin" --admin-password="admin123" --admin-email="admin@gmail.com" --admin-firstname="Admin" --admin-lastname="Admin" |