nahanil Posted May 25, 2018 Report Posted May 25, 2018 (edited) Referring to the method getSld() in <Blesta 4.2.2>/plugins/order/lib/order_types/domain/order_type_domain.php This method doesn't handle domain searches as gracefully as it could. Search: www.something.com (.com checkbox selected) something.com somethingwww..com Search: www.something (.com checkbox selected) www.com Search: something.com (.com checkbox selected) something.com Search: something (.com checkbox selected) something.com I'm not sure how this could be rectified by changing the existing regex, but I've found something like the following to handle all the above inputs to return something sensible function getSld($domain) { $parts = explode(".", $domain); if (count($parts) == 1) { return $parts[0]; } return $parts[0] == "www" ? $parts[1] : $parts[0]; } // Mentioned test cases foreach ([ 'www.something.com', 'www.something', 'something.com', 'something'] as $search) { echo "$search: ", getSld($search), "<br>"; } /* Output www.something.com: something www.something: something something.com: something something: something */ Edited May 25, 2018 by texh Specify Blesta version Abdy 1
Abdy Posted May 25, 2018 Report Posted May 25, 2018 I just tried in my Blesta installation and got the same (weird) result. I think the solution you're proposing is pretty good, I did some testing even using Punnycode domains and it seems to work perfectly. nahanil 1
Blesta Addons Posted May 25, 2018 Report Posted May 25, 2018 i'm also not using the default search of order. i have come with my own search system (sample here) nahanil 1
Tyson Posted June 22, 2018 Report Posted June 22, 2018 I've improved this in CORE-2733 for v4.3.0-b2 nahanil 1
Recommended Posts