Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public function match(RequestInterface $request)
  2. {
  3. $rewrite = $this->getRewrite(
  4. $request->getPathInfo(),
  5. $this->storeManager->getStore()->getId()
  6. );
  7.  
  8. $identifier = trim($request->getPathInfo(), '/');
  9.  
  10. if($identifier==='testing'){
  11. $rewrite = new UrlRewrite();
  12. $rewrite->setTargetPath("catalog/category/view/id/18");
  13. $rewrite->setRequestPath("testing");
  14. $rewrite->setRedirectType(0);
  15. $rewrite->setEntityType("category");
  16.  
  17. //return $this->processRedirect($request, $rewrite);
  18. }
  19.  
  20. if ($rewrite === null) {
  21. //No rewrite rule matching current URl found, continuing with
  22. //processing of this URL.
  23. return null;
  24. }
  25. if ($rewrite->getRedirectType()) {
  26. //Rule requires the request to be redirected to another URL
  27. //and cannot be processed further.
  28. return $this->processRedirect($request, $rewrite);
  29. }
  30. //Rule provides actual URL that can be processed by a controller.
  31. $request->setAlias(
  32. UrlInterface::REWRITE_REQUEST_PATH_ALIAS,
  33. $rewrite->getRequestPath()
  34. );
  35. $request->setPathInfo('/' . $rewrite->getTargetPath());
  36. return $this->actionFactory->create(
  37. MagentoFrameworkAppActionForward::class
  38. );
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement