magento2 - Magento 2 Cannot redirect from admin controller to front end -
i trying use code redirect frontend url, redirects admin dashboard. searched , tried lot of demo code, can't work. assume attributes set correctly.
$url= $this->_storemanager->getstore(1)->geturl('storelocator/index/index'); $resultredirect = $this->resultredirectfactory->create(); $resultredirect->seturl($url); return $resultredirect;
from here:
public function __construct( ... \magento\store\model\storemanagerinterface $manstore, ... ) { ... $this->manstore = $manstore; ... } public function execute() { ... $resultredirect = $this->resultredirectfactory->create(); $route = 'customer/account'; // w/o leading '/' $store = $this->manstore->getstore(); $url = $store->geturl($route, [$parm => $value]); // second arg can omitted $resultredirect->seturl($url); return $resultredirect; }
Comments
Post a Comment