How to Reindex prices by product ids programmatically Magento 2?

You can reindex only prices for the products in the Magento 2 store by their IDs.

The indexer id used for the prices is catalog_product_price. We need to reindex only prices programmatically to reflect the price changes on the backend. you can do it using the CLI command also,

php bin/magento indexer:reindex catalog_product_price Continue reading “How to Reindex prices by product ids programmatically Magento 2?”

How to create admin user via Command Line in Magento 2?

If you want to create a new admin user via CLI, You can create a new admin user through CLI by typing the below command.

The admin:user:create command is used to create a new admin user via the command line interface.

This post will help when you are facing login with the admin panel and want to create a new user for admin. Continue reading “How to create admin user via Command Line in Magento 2?”

Error during compilation, Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface.

We can be resolved Compile time error by below way, The error looks like when running compilation command,

Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: string; File:
app/code/Rbj/CustomForm/Model/ResourceModel/Customform/Grid/Collection.php
[Magento\Framework\Validator\Exception]
Error during compilation

Solutions:

From Magento 2.2.* version we need to pass full class name in__construct()  instead of $connection = null as di argument in Collection.php file.

Replace, $connection = null argument with \Magento\Framework\DB\Adapter\AdapterInterface $connection = null  in __construct() parameter.

Run again command,
php bin/magento setup:di:compile
an error will be gone.