In Magento 2, You can redirect to the previous page. This allows customers to redirect back to the page from where the customer came. In Your Controller write the following code: <?php namespace Company\Module\Controller\Index; use Magento\Framework\Controller\ResultFactory; class Actionname name extends \Magento\Framework\App\Action\Action { public function execute() { $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); //your code work around here $resultRedirect->setUrl($this->_redirect->getRefererUrl());…
Author: Bikash
Useful Git Commands
Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Here are some of git useful commands that you can use frequently on Github bash. git remote -v git remote remove origin git remote add origin Bitbucket_Repository_URL git diff –stat –cached…
How to use Dependency Injection (DI) in Magento 2
Dependency injection is the idea that a class is given the classes that it needs in the __construct method. Magento uses constructor dependency injection. In your __construct method, you list classes that you want to be injected and Magento’s DI system will do that for you. public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig ){ $this->scopeConfig = $scopeConfig;…