Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #90 from piyuesh23/category_alias
Browse files Browse the repository at this point in the history
Fixing category alias generation for category translation.
  • Loading branch information
miromichalicka authored Oct 5, 2018
2 parents b00cfba + 08c55b3 commit 96e7215
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions modules/sku/src/CategoryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,15 @@ private function syncCategory(array $categories, $parent = NULL, $storeId = '')

if (!$term->hasTranslation($langcode)) {
$term = $term->addTranslation($langcode);

// We doing this because when the translation of node is created by
// addTranslation(), pathauto alias is not created for the translated
// version.
// @see https://www.drupal.org/project/pathauto/issues/2995829.
if ($this->modulehandler->moduleExists('pathauto')) {
$term->path->pathauto = 1;
}

$term->get('field_commerce_id')->setValue($category['category_id']);
}
else {
Expand Down Expand Up @@ -373,14 +382,6 @@ private function syncCategory(array $categories, $parent = NULL, $storeId = '')
'langcode' => $langcode,
]);

// We doing this because when the translation of node is created by
// addTranslation(), pathauto alias is not created for the translated
// version.
// @see https://www.drupal.org/project/pathauto/issues/2995829.
if ($this->modulehandler->moduleExists('pathauto')) {
$term->path->pathauto = 1;
}

$this->results['created']++;
}

Expand Down

0 comments on commit 96e7215

Please sign in to comment.