Skip to content

Commit 3454947

Browse files
author
Derrick Heesbeen
authored
Merge pull request #13 from EgorDm/bugfix/fix-direct-links
[BUGFIX] Modified website matching by stripping schema and www.
2 parents 9177d40 + 5a0c9dc commit 3454947

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Helper/Data.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,16 @@ public function validateStore($storeCode)
9797
*/
9898
public function getRequestToWebsiteId($request)
9999
{
100-
$baseUrl = str_replace('www.', '', $request->getDistroBaseUrl());
100+
$baseUrl = str_replace('www.', '%', $request->getDistroBaseUrl());
101+
// Strip schemas
102+
$baseUrl = str_replace(['https://', 'http://'], '', $baseUrl);
101103

102104
$connection = $this->resource->getConnection();
103105
$table = $connection->getTableName('core_config_data');
104106
$websiteFilter = $connection->select()->from($table, ['scope_id'])
105107
->where('scope = ?', 'websites')
106108
->where('path in (?)', [Custom::XML_PATH_SECURE_BASE_URL, Custom::XML_PATH_UNSECURE_BASE_URL])
107-
->where('value = ?', $baseUrl);
109+
->where('value like ?', "%$baseUrl");
108110
$match = $connection->fetchCol($websiteFilter);
109111

110112
return count($match) > 0 ? (int)$match[0] : null;

0 commit comments

Comments
 (0)