E-commerce Platforms
How to enable profiler in magento2
To enable the profiler we can add it from index.php or apache/nginx conf file.
Enable/Disable Profiler from Command Line:
# Enable the profiler.
php bin/magento dev:profiler:enable
# Disable the profiler.
php bin/magento dev:profiler:disable
Enable Profiler from index.php:
Flash Catalog Images Cache Magento2
To flash the Catalog Images cache, first of all instantiate the Object and Event Manager in your constructor
private $objectManager; private $eventManager; public function __construct( \Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Event\Manager $eventManager ){ $this->objectManager = $objectManager; $this->eventManager = $eventManager; }
After that you can clean the catalog images cache by using this two code lines
Magento add Recaptcha to any form you want
Hi, This extension will allow you to ad google reCaptcha to any form you want by add one line , only one line will activate the reCaptcha
First step is to set the configuration from
System -> Configuration
Go to the ZEO Extension section then click on reCaptcha
Then add the configuration
How to Disable/Enable Modules in Magento 2.x
Log in to your Magento directory using SSH.
Disable RMA
- bin/magento module:disable Aheadworks_Rma
- bin/magento setup:upgrade
- rm -rf var/cache/*
- rm -rf var/page_cache/*
- rm -rf generated/*
Enable RMA
- bin/magento module:enable Aheadworks_Rma
- bin/magento setup:upgrade
- rm -rf var/cache/*
- rm -rf var/page_cache/*
- rm -rf generated/*
Add Order Attribute to Custom Attributes on Magento 2 Rest API?
Step 1: Create new column and set value for the existing order
Firstly, you need to create a new column in table sales_order in your installer file
$setup->getConnection()->addColumn($setup->getTable('sales_order'), 'order_attribute', 'varchar(1)');
In this post, we named it “order_attribute”.
Step 2: Create extension_attributes.xml file
Magento2 gallery afterLoad callback
If you need to do any JavaScript code after Magento gallery is loaded you can use this event in your code
Magento2 Refresh Cache for Single Product
Magento’s cache management system saves loaded data, configuration, instructions, images, assets, and more for increased performance loading and rapid access on the storefront. It offers increased stability on your website during heavy user load and greater customer browsing activity. Having a slow-performing website can also negatively impact your conversion
You can use this code to refresh the cache for single product
Magento2 indexes
First of all you need to change the directory to shell folder under magento root
Checking for the status of all indexes
php bin/magento indexer:status
Re-indexing a single index
Each index has its own index key that you can use to reference it when asking Magento to re-index. To get these keys, you can use the following command:
php bin/magento indexer:info
Refresh Magento1 Cache from Command Line
change your directory to Magento root then execute this command
php -r 'require "app/Mage.php"; Mage::app()->getCacheInstance()->flush();'
Magento1 indexes
First of all you need to change the directory to shell folder under magento root
{Magento root}/shell
Checking for the status of all indexes
php indexer.php --status
Re-indexing a single index
Each index has its own index key that you can use to reference it when asking Magento to re-index. To get these keys, you can use the following command:
php indexer.php --info