magento
Magento1 how to change magento order status programatically?
Some time we need to change the Order status programmatically , the below code will allow us to do this
Magento 2: How to get customer collection
<?php
protected $_customerFactory;
public function __construct(
...
\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory $customerFactory
..
Create Invoice Via REST API for Magento2 for Bundle Product
To create an invoice for an order that contain bundle product you have to prepare the good json.
Basically Magento has two different types of bundle products: dynamic and fixed. That's why I need to add clarification for Expected Result:
I) Bundle dynamic product:
Get Customer's Orders using Magento2 API REST
in this code you will see how to get all Customer's Orders from Magento2 using the REST API
Disable/Hide Recently Ordered Block in Magento 2
To hide the recently ordered product block from the left side
Create default.xml in your module or theme's view/layout folder and paste the below code.
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