New answers tagged

0

Try not to use Objectmanager. It is just for fast implementation If the url is http://localhost/mage242/customer/account/login $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $request = $objectManager->get('\Magento\Framework\App\Request\Http'); echo $request->getRouteName() . '<br />'; //customer echo $request-&...


1

Please try the following code: use Magento\Framework\App\Action\Context; use Magento\Framework\App\CacheInterface; use Psr\Log\LoggerInterface; class Search extends \Magento\Framework\App\Action\Action { protected $cache; protected $logger; public function __construct( Context $context, CacheInterface $cache, ...


Top 50 recent answers are included