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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -