Skip to content

Commit

Permalink
Fixed issue where url keys were broken
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleGroenendal committed Jan 23, 2020
1 parent 5314725 commit 2177913
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,27 @@ class Product extends Import
* @var string PIM_PRODUCT_STATUS_DISABLED
*/
const PIM_PRODUCT_STATUS_DISABLED = '0';

/**
* @var string MAGENTO_PRODUCT_STATUS_DISABLED
*/
const MAGENTO_PRODUCT_STATUS_DISABLED = '2';

/**
* @var int CONFIGURABLE_INSERTION_MAX_SIZE
*/
const CONFIGURABLE_INSERTION_MAX_SIZE = 500;

/**
* @var array EXCLUDED_COLUMNS
*/
const EXCLUDED_COLUMNS = ['_links'];

/**
* @var string ASSOCIATIONS_KEY
*/
const ASSOCIATIONS_KEY = 'associations';

/**
* @var string VALUES_KEY
*/
Expand All @@ -87,72 +92,84 @@ class Product extends Import
* @var string $code
*/
protected $productCode = 'product';

/**
* This variable contains a string value
*
* @var string $code
*/
protected $attributeCode = 'attribute';

/**
* This variable contains a string value
*
* @var string $name
*/
protected $name = 'Product';

/**
* list of allowed type_id that can be imported
*
* @var string[]
*/
protected $allowedTypeId = ['simple', 'virtual'];

/**
* This variable contains a ProductImportHelper
*
* @var ProductImportHelper $entitiesHelper
*/
protected $entitiesHelper;

/**
* This variable contains a ConfigHelper
*
* @var ConfigHelper $configHelper
*/
protected $configHelper;

/**
* This variable contains a ProductFilters
*
* @var ProductFilters $productFilters
*/
protected $productFilters;

/**
* This variable contains a ScopeConfigInterface
*
* @var ScopeConfigInterface $scopeConfig
*/
protected $scopeConfig;

/**
* This variable contains a JsonSerializer
*
* @var JsonSerializer $serializer
*/
protected $serializer;

/**
* This variable contains a ProductModel
*
* @var ProductModel $product
*/
protected $product;

/**
* This variable contains a ProductUrlPathGenerator
*
* @var ProductUrlPathGenerator $productUrlPathGenerator
*/
protected $productUrlPathGenerator;

/**
* This variable contains a TypeListInterface
*
* @var TypeListInterface $cacheTypeList
*/
protected $cacheTypeList;

/**
* This variable contains a StoreHelper
*
Expand Down Expand Up @@ -1755,7 +1772,6 @@ public function setUrlRewrite()
$this->storeHelper->getStores(['lang', 'channel_code']) // en_US-channel
);


$productsWebsites = $connection->fetchAll(
$connection->select()->from('catalog_product_website'));
$productWebsiteData = [];
Expand Down Expand Up @@ -1815,7 +1831,7 @@ public function setUrlRewrite()
continue;
}

$product->setUrlKey($urlKeyData['value-' . $local]);
$product->setUrlKey($product->formatUrlKey($urlKeyData['value-' . $local]));
$product->setStoreId($store['store_id']);
$urlPath = $this->productUrlPathGenerator->getUrlPath($product);
if (!$urlPath) {
Expand Down Expand Up @@ -2290,6 +2306,7 @@ public function importAsset($delta = false)
$binary = $this->akeneoClient->getAssetReferenceFileApi()
->downloadFromNotLocalizableAsset($media['code']);
}

$this->configHelper->saveMediaFile($name, $binary);
$generateCacheImages[] = $assetAttribute['_entity_id'];
}
Expand Down Expand Up @@ -2429,9 +2446,7 @@ public function generateImageCacheByProductId(array $productImages)
*/
public function generateImageCache($productIds)
{

$products = $this->productCollection->getItems();

$productCount = count($productIds);

$i=0;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"php-http/guzzle6-adapter": "^1.1"
},
"type": "magento2-module",
"version": "100.1.29",
"version": "100.1.30",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down

0 comments on commit 2177913

Please sign in to comment.