ayz1 Posted November 29, 2016 Share Posted November 29, 2016 In admin, order on the inventory tab when trying to select a tax some of the country names are not showing up, just the country number is showing. This is on 6.1.1 on a clean install and all EU countires selected in the Taxes section. Is this happening to anyone else? Strange it picks up some country names and not others. Any idea how I can fix this? Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2016 Share Posted November 29, 2016 Please view CubeCart's Countries/Zones screen. Regarding the ISO Numeric: 208 is Denmark 233 is Estonia 246 is Finland 250 is France Determine if these countries are in the list. If they are, make sure the numerical value is purely a three-digit number - meaning the value shown does not have any leading spaces, trailing spaces, or a character other than three digits 0-9. If there is any doubt, hover the mouse cursor over the three-digit value in the table. The mouse cursor will change to a pointy finger. Click to edit. Delete the entire value, pressing the Delete key and Backspace key for good measure (to delete hidden whitespace characters). Enter the three-digit value. Save. Repeat for the four instances. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 29, 2016 Share Posted November 29, 2016 I just tried Denmark on my test site. Everything looked perfect when I setup a Denmark Sales Tax setting. But when I tried to create an order in Admin, I, too, see 208 instead of Denmark. I deleted the 208 in the Countries table and typed it again. Then I cleared all cache and tried creating the order with Denmark Sales Tax again - still getting 208. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2016 Share Posted November 29, 2016 As an experiment, be sure CubeCart's Debug mode is enabled. (Enter your IP address in the adjacent field so that only you will see the debug section. www.whatismyip.com) Make this edit: /admin/sources/order.index.inc.php, near line 250, find: $country = getCountryFormat($numcode); Change to: $country = getCountryFormat($numcode);trigger_error("The numcode is ".(string)$numcode.", and the country returned is ".($country?$country:'unknown'), E_USER_WARNING); Bring an order up for editing. Scroll to the bottom of the page where the debug section is shown. You will find something like this in the PHP section: PHP: [Warning] \admin\sources\orders.index.inc.php:250 - The numcode is 56, and the country returned is Belgium [Warning] \admin\sources\orders.index.inc.php:250 - The numcode is 484, and the country returned is Mexico [Warning] \admin\sources\orders.index.inc.php:250 - The numcode is 840, and the country returned is United States We are looking for the four anomalous country codes/names. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2016 Share Posted November 29, 2016 Me, too, for Denmark. Analyzing now. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 29, 2016 Share Posted November 29, 2016 Quote [Warning] /XXX/sources/orders.index.inc.php:251 - The numcode is 208, and the country returned is 208[Warning] /XXX/public_html/sources/orders.index.inc.php:251 - The numcode is 840, and the country returned is United States Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2016 Share Posted November 29, 2016 Checking now to see why functions::getCountryFormat() is not liking the value of 208. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2016 Share Posted November 29, 2016 (edited) Found it. In the file /includes/functions.php Near line 504, in the function getCountryFormat(), find: if(($match == 'id' || $match == 'numcode') && !ctype_digit($input)) return $input; Change to: if(($match == 'id' || $match == 'numcode') && !ctype_digit((string)$input)) return $input; This post has been edited! The above code has been edited since its initial posting! Issue posted in the Github. A few lines down, the function getStateFormat() also can be edited: Near line 564, find: if($match == 'id' && !ctype_digit($input)) return $input; Change to: if($match == 'id' && !ctype_digit((string)$input)) return $input; Edited November 29, 2016 by bsmither Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 29, 2016 Share Posted November 29, 2016 I just made that change in our plush test site that is on today's commit for 6.1.2. I get this when I refresh the Order page Quote Parse error: syntax error, unexpected end of file in /XXX/includes/functions.inc.php on line 923 Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2016 Share Posted November 29, 2016 Double-check your spelling. Let us see your edit in a reply. I do not know how to get "today's commit for 6.1.2." Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 29, 2016 Share Posted November 29, 2016 line 503 >> function getCountryFormat($input, $match = 'numcode', $fetch = 'name') { /* ORIGINAL 6.1.2 BSMITHER FIX FOR DENMARK BELOW if(($match == 'id' || $match == 'numcode') && !ctype_digit($input)) return $input; */ if(($match == 'id' || $match == 'numcode') && !ctype_digit((string)$input)) { $country = $GLOBALS['db']->select('CubeCart_geo_country', array($fetch), array($match => $input)); return ($country) ? $country[0][$fetch] : false; } line 564>> function getStateFormat($input, $match = 'id', $fetch = 'name') { /* STOCK 6.1.2 BSMITHER EDIT BELOW FOR DENMARK if($match == 'id' && !ctype_digit($input)) return $input; */ if($match == 'id' && !ctype_digit((string)$input)) return $input; if (($county = $GLOBALS['db']->select('CubeCart_geo_zone', false, array($match => $input))) !== false) { return ($fetch == 'abbrev' && empty($county[0][$fetch])) ? $county[0]['name'] : $county[0][$fetch]; } return $input; } Other than that includes/functions.inc.php is stock from GitHub 6.1.2. I download the day's commit as a zipped file, extract, and compare with the previous commit. Then I make the changes on the test site. I cannot currently make the database index changes that are in 6.1.2 - Al suspected those changes would not work for everyone, and I'm one who can't use it as is. But I don't think those changes would be an issue here. Everything I've checked on the test site worked properly today, until I tried this Denmark edit. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2016 Share Posted November 29, 2016 Original complete getCountryFormat() from CC611: function getCountryFormat($input, $match = 'numcode', $fetch = 'name') { if(($match == 'id' || $match == 'numcode') && !ctype_digit($input)) return $input; $country = $GLOBALS['db']->select('CubeCart_geo_country', array($fetch), array($match => $input)); return ($country) ? $country[0][$fetch] : false; } Changed complete function: function getCountryFormat($input, $match = 'numcode', $fetch = 'name') { if(($match == 'id' || $match == 'numcode') && !ctype_digit((string)$input)) return $input; $country = $GLOBALS['db']->select('CubeCart_geo_country', array($fetch), array($match => $input)); return ($country) ? $country[0][$fetch] : false; } Yup - messed up badly in my posting above. Will fix. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 29, 2016 Share Posted November 29, 2016 I'm too tired to fool with any more code today - I'll double check all my merges tomorrow - since you don't get the error message it's likely a goof of mine. Sounds like both of us need a rest for the night LOL! Quote Link to comment Share on other sites More sharing options...
ayz1 Posted November 30, 2016 Author Share Posted November 30, 2016 The first edit Change to: if(($match == 'id' || $match == 'numcode') && !ctype_digit((string)$input)) return $input; Seems to have solved the problem with my initial post. Country names are now showing and not getting any errors. I have added the second edit Change to: if($match == 'id' && !ctype_digit((string)$input)) return $input; All seems OK, not getting any errors. Will play about a bit more with it but looks like sorted for 6.1.1 Thank you. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 30, 2016 Share Posted November 30, 2016 Confirmed that the 6.1.2 commit also works properly with the edited version Bsmither provided. And a complete fix for this issue is included in today's GitHub commit of 6.1.2. Quote Link to comment Share on other sites More sharing options...
pinkie Posted November 30, 2016 Share Posted November 30, 2016 Thanks Quote Link to comment Share on other sites More sharing options...
Underlord93 Posted November 30, 2016 Share Posted November 30, 2016 Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.