How to Reindex prices by product ids programmatically Magento 2?

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

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 CLI command also,
php bin/magento indexer:reindex catalog_product_price Continue reading “How to Reindex prices by product ids programmatically 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.

Complete List of All SSH CLI Commands Magento 2.

A Complete list of useful SSH CLI Command in Magento 2 that will be useful in daily routine for development tasks.

Magento 2 comes with multiple Commands by default and you want to use any of the commands, You have to type the command in CLI, bin/magento help
Continue reading “Complete List of All SSH CLI Commands Magento 2.”