Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit 7a3c299

Browse files
committed
Landingpage URL must always start with leading slash. Fix issue with obsolete ? in removal URL
1 parent 6cd930b commit 7a3c299

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

app/code/local/Emico/AttributeLanding/Model/Page.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
/**
88
* Class Emico_AttributeLanding_Model_Page
99
*
10-
* @method string getUrlPath();
1110
* @method $this setUrlPath(string $path);
1211
* @method $this setActive(bool $active);
1312
* @method bool getActive();
@@ -142,4 +141,16 @@ public function getCanonicalUrl()
142141

143142
return Mage::getBaseUrl() . $this->getUrlPath();
144143
}
144+
145+
/**
146+
* @return string
147+
*/
148+
public function getUrlPath()
149+
{
150+
$urlPath = $this->getData('url_path');
151+
if (substr($urlPath, 0, 1) !== '/') {
152+
$urlPath = '/' . $urlPath;
153+
}
154+
return $urlPath;
155+
}
145156
}

app/code/local/Emico/AttributeLanding/Model/Tweakwise/UrlStrategy/AttributeLandingStrategy.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ public function buildUrl(Emico_Tweakwise_Model_Catalog_Layer $state, Emico_Tweak
3333
/** @var Emico_AttributeLanding_Model_Page $landingPage */
3434
$landingPage = Mage::app()->getRequest()->getParam('page');
3535
if ($landingPage && $attribute->getIsSelected()) {
36-
return $landingPage->getUrlPath() . '?' . http_build_query($this->getQueryParamStrategy()->getUrlKeyValPairs($facet, $attribute));
36+
$filterPart = http_build_query($this->getQueryParamStrategy()->getUrlKeyValPairs($facet, $attribute));
37+
$removeUrl = $landingPage->getUrlPath();
38+
if (!empty($filterPart)) {
39+
$removeUrl .= '?' . $filterPart;
40+
}
41+
return $removeUrl;
3742
}
3843

3944
// Check if we have an attribute landing page available for the filter combination
@@ -47,7 +52,7 @@ public function buildUrl(Emico_Tweakwise_Model_Catalog_Layer $state, Emico_Tweak
4752
$page = $this->findLandingPageByFilters($category, $filterHash);
4853

4954
if ($page !== null) {
50-
return '/' . $page->getUrlPath() . '#no-ajax';
55+
return $page->getUrlPath() . '#no-ajax';
5156
}
5257

5358
return null;

0 commit comments

Comments
 (0)