From bcd936553fc5ba0223dbaf4e09297d8fb205585a Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Thu, 3 Dec 2015 18:19:01 +0200 Subject: [PATCH] MAGETWO-44997: [Github] Can't change Product & Category URL suffix when using custom prefix on Magento tables --- .../System/Config/Backend/Catalog/Url/Rewrite/Suffix.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index 2ff610190d430..f1fd7ad2be21a 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -35,6 +35,11 @@ class Suffix extends \Magento\Framework\App\Config\Value /** @var \Magento\Framework\DB\Adapter\AdapterInterface */ protected $connection; + /** + * @var \Magento\Framework\App\Resource + */ + protected $resource; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -67,6 +72,7 @@ public function __construct( $this->connection = $appResource->getConnection(); $this->urlFinder = $urlFinder; $this->storeManager = $storeManager; + $this->resource = $appResource; } /** @@ -118,7 +124,7 @@ protected function updateSuffixForUrlRewrites() ? [UrlRewrite::REQUEST_PATH => preg_replace($oldSuffixPattern, $suffix, $urlRewrite->getRequestPath())] : [UrlRewrite::TARGET_PATH => preg_replace($oldSuffixPattern, $suffix, $urlRewrite->getTargetPath())]; $this->connection->update( - DbStorage::TABLE_NAME, + $this->resource->getTableName(DbStorage::TABLE_NAME), $bind, $this->connection->quoteIdentifier(UrlRewrite::URL_REWRITE_ID) . ' = ' . $urlRewrite->getUrlRewriteId() );