Skip to content

Commit 1c42c28

Browse files
committed
MAGETWO-53342: Duplicating url keys on creating configurable product
- add i18n support
1 parent ed044a6 commit 1c42c28

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingError;
1818
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
1919
use Magento\ImportExport\Model\Import\Entity\AbstractEntity;
20-
20+
use Magento\Catalog\Model\Product\Visibility;
2121
/**
2222
* Import entity product model
2323
* @SuppressWarnings(PHPMD.TooManyFields)
@@ -108,11 +108,6 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
108108
*/
109109
const COL_VISIBILITY = 'visibility';
110110

111-
/**
112-
* Column product visibility value.
113-
*/
114-
const COL_VALUE_VISIBILITY_NON_VISIBLE = 'Not Visible Individually';
115-
116111
/**
117112
* Column product sku.
118113
*/
@@ -2326,7 +2321,8 @@ private function isNeedToValidateUrlKey($rowData)
23262321
{
23272322
return (!empty($rowData[self::URL_KEY]) || !empty($rowData[self::COL_NAME]))
23282323
&& (empty($rowData[self::COL_VISIBILITY])
2329-
|| $rowData[self::COL_VISIBILITY] !== self::COL_VALUE_VISIBILITY_NON_VISIBLE);
2324+
|| $rowData[self::COL_VISIBILITY]
2325+
!== (string)Visibility::getOptionArray()[Visibility::VISIBILITY_NOT_VISIBLE]);
23302326
}
23312327

23322328
/**

app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Magento\UrlRewrite\Model\OptionProvider;
2020
use Magento\UrlRewrite\Model\UrlFinderInterface;
2121
use Magento\Framework\Event\ObserverInterface;
22-
22+
use Magento\Catalog\Model\Product\Visibility;
2323
/**
2424
* Class AfterImportDataObserver
2525
*
@@ -222,7 +222,7 @@ protected function setStoreToProduct(\Magento\Catalog\Model\Product $product, ar
222222
*/
223223
protected function addProductToImport($product, $storeId)
224224
{
225-
if ($product->getVisibility() == ImportProduct::COL_VALUE_VISIBILITY_NON_VISIBLE) {
225+
if ($product->getVisibility() == (string)Visibility::getOptionArray()[Visibility::VISIBILITY_NOT_VISIBLE]) {
226226
return $this;
227227
}
228228
if (!isset($this->products[$product->getId()])) {

0 commit comments

Comments
 (0)