magento
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
Magento2 Create Shipment for Order Direclty By PHP code
Kindly i am share with you the code of how to make partial Shipment for existing Order in Magento2
I will write the code that can be executed external of magento files
First Create new file and name it as you want , For me i named it (create-shipment-magento2.php)
add this code to the file
Magento2 log messages
Hi, In this wiki we will show you how we can logging in Magento2
as you know in Magento1, we can doing log by this code
<?php Mage::log("You message here"); ?>
but in magento2 this code will not work, we can easily log by this code
in your file just you need to make new instance of Object Manager, then we will create a new object of LoogerInterface
Magento2 Create Configurable Product via Rest in PHP
In this wiki we will see how can we create new configurable product using rest in magento2.
- First let us write the configurations (URL's,username,password)
// configuration Data $url="http://www.example.com/index.php/"; $token_url=$url."rest/V1/integration/admin/token"; $product_url=$url. "rest/V1/products"; $username="your admin username"; $password="your admin password"; $children_ids=array(196);
- Then let us get access token