Skip to content

Commit 03eda34

Browse files
committed
ACP2E-1783: Unable to create 301/302 redirect for product with a category path when Generate "category/product" URL Rewrites set to Yes
- fixed static
1 parent fab97fc commit 03eda34

File tree

1 file changed

+13
-4
lines changed
  • app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite

1 file changed

+13
-4
lines changed

app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
namespace Magento\UrlRewrite\Controller\Adminhtml\Url\Rewrite;
99

10+
use Magento\Backend\App\Action\Context;
1011
use Magento\Catalog\Api\ProductRepositoryInterface;
12+
use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator;
13+
use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator;
14+
use Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator;
1115
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
1216
use Magento\Framework\Exception\LocalizedException;
1317
use Magento\UrlRewrite\Model\UrlFinderInterface;
@@ -41,11 +45,12 @@ class Save extends \Magento\UrlRewrite\Controller\Adminhtml\Url\Rewrite implemen
4145
protected ProductRepositoryInterface $productRepository;
4246

4347
/**
44-
* @param \Magento\Backend\App\Action\Context $context
45-
* @param \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator $productUrlPathGenerator
46-
* @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator
47-
* @param \Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator $cmsPageUrlPathGenerator
48+
* @param Context $context
49+
* @param ProductUrlPathGenerator $productUrlPathGenerator
50+
* @param CategoryUrlPathGenerator $categoryUrlPathGenerator
51+
* @param CmsPageUrlPathGenerator $cmsPageUrlPathGenerator
4852
* @param UrlFinderInterface $urlFinder
53+
* @param ProductRepositoryInterface|null $productRepository
4954
*/
5055
public function __construct(
5156
\Magento\Backend\App\Action\Context $context,
@@ -123,6 +128,8 @@ protected function getTargetPath($model)
123128
}
124129

125130
/**
131+
* Generate canonical product / category path
132+
*
126133
* @return string
127134
*/
128135
protected function getCanonicalTargetPath()
@@ -157,6 +164,8 @@ private function _handleCmsPageUrlRewrite($model)
157164
}
158165

159166
/**
167+
* Process save URL rewrite request
168+
*
160169
* @return void
161170
*/
162171
public function execute()

0 commit comments

Comments
 (0)