Skip to content

Commit

Permalink
added trimming to url paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad Tomaraei committed Feb 19, 2020
1 parent 89fba2d commit 861a0d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/catalog/controller/vsbridge/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ public function mapFields(array &$elements, $current_level = 0, $id_path = array
$element['slug'] = $name_slug.'-'.$element['id'];

// Change if you use a custom SEO extension
$element['url_key'] = $element['slug'];
$element['url_path'] = implode('/', array_merge($name_path, array($name_slug))).'-'.$element['id'];
$element['url_key'] = trim($element['slug']);
$element['url_path'] = trim(implode('/', array_merge($name_path, array($name_slug))).'-'.$element['id']);

// Check for SEO URls via the OpenCart extension [SEO BackPack 2.9.1]
$seo_url_alias = $this->model_vsbridge_api->getSeoUrlAlias('category', $element['id'], $this->language_id);

if(!empty($seo_url_alias['keyword'])){
$element['url_path'] = $seo_url_alias['keyword'];
$element['url_path'] = trim($seo_url_alias['keyword']);
}

$element['level'] = $current_level + 1;
Expand Down
8 changes: 4 additions & 4 deletions src/catalog/controller/vsbridge/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,16 @@ public function populateProducts($input){
$oc_url_alias = $this->model_vsbridge_api->getUrlAlias('product', $product['product_id']);

if(!empty($oc_url_alias['keyword'])){
$product_array['slug'] = $oc_url_alias['keyword'];
$product_array['url_path'] = $oc_url_alias['keyword'];
$product_array['slug'] = trim($oc_url_alias['keyword']);
$product_array['url_path'] = trim($oc_url_alias['keyword']);
}

// Check for SEO URls via the OpenCart extension [SEO BackPack 2.9.1]
$seo_url_alias = $this->model_vsbridge_api->getSeoUrlAlias('product', $product['product_id'], $this->language_id);

if(!empty($seo_url_alias['keyword'])){
$product_array['slug'] = $seo_url_alias['keyword'];
$product_array['url_path'] = $seo_url_alias['keyword'];
$product_array['slug'] = trim($seo_url_alias['keyword']);
$product_array['url_path'] = trim($seo_url_alias['keyword']);
}

// Related products
Expand Down

0 comments on commit 861a0d0

Please sign in to comment.