Default Localization not showing

csCart Team fixed this bug for me (and charged me credits for the privilage) so I thought it may help others.,

Localization settings were still effecting the cart operation even when they were disabled. Causing much confusion when products and shipping would not be shown properly and NO localization would be selected, rather than the expected Default Localization.

But for the purpose of fault finding:

Heres the fix they gave me:





In order to fix this bug please replace the following part of code:


$_ip = fn_get_ip(true);
$_country = fn_get_country_by_ip($_ip['host']);
$_lngs = db_get_hash_single_array("SELECT lang_code, 1 as 'l' FROM ?:languages", array('lang_code', 'l'));
$_language = fn_get_browser_language($_lngs);

$cart_localization = db_get_field("SELECT localization_id, COUNT(localization_id) as c FROM ?:localization_elements WHERE (element = ?s AND element_type = 'C') OR (element = ?s AND element_type = 'L') GROUP BY localization_id ORDER BY c DESC LIMIT 1", $_country, $_language);

if (empty($cart_localization)) {
$cart_localization = db_get_field("SELECT localization_id FROM ?:localizations WHERE is_default = 'Y'");
}
}


with this one:


$_ip = fn_get_ip(true);
$_country = fn_get_country_by_ip($_ip['host']);
$_lngs = db_get_hash_single_array("SELECT lang_code, 1 as 'l' FROM ?:languages WHERE status = 'A'", array('lang_code', 'l'));
$_language = fn_get_browser_language($_lngs);
$cart_localization = db_get_field("SELECT localization_id, COUNT(localization_id) as c FROM ?:localization_elements WHERE (element = ?s AND element_type = 'C') OR (element = ?s AND element_type = 'L') GROUP BY localization_id ORDER BY c DESC LIMIT 1", $_country, $_language);
if (empty($cart_localization) || empty($locs[$cart_localization])) {
$cart_localization = db_get_field("SELECT localization_id FROM ?:localizations WHERE status = 'A' AND is_default = 'Y'");
}
}


in the “fn.init.php” file, located in the “core” directory.





http://www.remoteone.com.au/ visit remoteONE.com.au

They should not be charging for bug fixes.



Bob

I know! Tell me about it! But what do you do if you want something fixed?. CS Cart are starting to ask me to pay for Special Development Service just to fix the bugs in their own software. They also just keep deducting service credits whenever they need to do more work…fixing bugs that are nothing to do with addons I’ve installed.



Anyway, thats why I shared the fix …share the love.



Oh …and I’ve since found there is a similar bug in “Locations” as well as “Localizations” . I’m still waiting for a fix.

Meanwhile v2.0.9 (bugfest) then 2.0.10 is released, but I wont be upgrading as it would be a disaster with all the addons/mods and code fixes Ive done.