Skip to main content

Posts

Showing posts from October, 2019

Magento 2: How to add menu to the admin grid?

To add new menu in admin grid, first create an menu.xml file to your module on following location: Packagename/Modulename/etc/adminhtml/menu.xml then place the following code in menu.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd">     <menu>          <add id="Packagename_Modulename::urlkey" title="Menu Title" module="Packagename_Modulename"  sortOrder="10" resource="Packagename_Modulename::urlkey"/>        <add id="Packagename_Modulename::urlkey_controller_action" title="Sub Menu Title" module="Packagename_Modulename"  sortOrder="10" action="urlkey/controller/action" resource="Packagename_Modulename::urlkey_controller_action" parent="Packagename_Modulename::urlkey" />     </menu> </config> ...

Magento 2: Set default cron

To set default cron in magento 2 just login your project using ssh and go to root directory of project and type following command: crontab -e after that an editor will open just paste the following code there: * * * * * php project server root directory path/bin/magento cron:run * * * * * php project server root directory path/update/cron.php * * * * * php project server root directory path/bin/magento setup:cron:run and replace project server root directory path   with your project root directory path.

Magento 2: upgrade magento 2.2 versions

Use following commands to upgrade magento 2.2 versions: php bin/magento maintenance:enable define version name in this command: composer require magento/product-community-edition 2.2.7 --no-update composer update rm -rf var/cache/* rm -rf var/page_cache/* rm -rf generation/* php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento indexer:reindex php bin/magento maintenance:disable