I have the custom module with product collection and custom router.
for example i want to have link https://domain.com/gaires/something
Router code:
namespace UseApp\Gaires\Controller; class Router implements \Magento\Framework\App\RouterInterface { protected $actionFactory; protected $_response; public function __construct( \Magento\Framework\App\ActionFactory $actionFactory, \Magento\Framework\App\ResponseInterface $response ) { $this->actionFactory = $actionFactory; $this->_response = $response; } public function match(\Magento\Framework\App\RequestInterface $request) { $exlpoded = array_filter(explode('/', trim($request->getPathInfo()) ) ); if($exlpoded && $exlpoded[1]=='gaires' && count($exlpoded)>=2){ $request->setModuleName('gaires') ->setControllerName('index') ->setActionName('gaire') ->setParam('q', urldecode($exlpoded[2])); } } }
Router working fine.
In the page (controller) gaires/index/gaire I have product collection with toolbar (sorter, limeter, pagger )
The problem is that the bad url address in the pager, sorter and limiter links.
For example: http://domain.com/gaires/index/gaire/q/something/?p=2
address must be: http://domain.com/gaires/something?p=2
If I change the adres in browser url field manually (http://domain.com/gaires/something?p=2) Router and collection working fine, but toolbar links also no
How can this be fixed?