Skip to content

Commit

Permalink
Merge pull request #4359 in SW/shopware from sw-13434/5.2/fix-seo-url…
Browse files Browse the repository at this point in the history
…-parsing to 5.2

* commit 'ca97cb4984161d0516110adb3e1af57c10533728':
  SW-13434 - Fix SEO url parsing for last seen articles
  • Loading branch information
Phil23 committed Jan 9, 2017
2 parents ed7d2e6 + ca97cb4 commit 650d388
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@

// Remove query string from article url
if (url.indexOf('/sCategory') !== -1) {
newProduct.linkDetailsRewritten = url.substring(0, url.indexOf('/sCategory'));
newProduct.linkDetailsRewritten = url.replace(/\/?sCategory\/[0-9]+/i, '');
} else if (url.indexOf('?') !== -1) {
newProduct.linkDetailsRewritten = url.substring(0, url.indexOf('?')) + linkDetailsQuery;
}
Expand Down Expand Up @@ -338,10 +338,21 @@
return {};
}

// strip everything until query parameters
url = url.substring(url.indexOf('?'));

// remove leading "?" symbol
url = url.substring(1);

$.each(url.split('&'), function (key, param) {
param = param.split('=');
queryParams[param[0]] = param[1];

param[0] = decodeURIComponent(param[0]);
param[1] = decodeURIComponent(param[1]);

if (param[0].length && param[1].length && !queryParams.hasOwnProperty(param[0])) {
queryParams[param[0]] = param[1];
}
});

return queryParams;
Expand Down

0 comments on commit 650d388

Please sign in to comment.