Jack_mcs Posted February 18, 2005 Share Posted February 18, 2005 Easy Populate requires the date to be in the yyyy-mm-dd format. Excel won't let you save that as the default format without changing the systems format. This means the date columns had to be re-formatted every time the page was loaded into Excel. The following code fixes that problem. I didn't post it as an update to the contribution yet since I wasn't sure if there were any other default formats (due to country standards). So if anyone that needs this fix will try it and let me know if it doesn't work, I would appreciate it. It does work if the default format in Excel is mm/dd/yyyy. In admin/easypopulate.php, find this line around 1215: function walk( $item1 ) { and place the following before it function ConvertDate($v_date_orig) { if (strpos($v_date_orig, '/')) { $dateNew = explode('/', $v_date_orig); $yr = explode(' ', $dateNew[2]); $dateNew = sprintf("%s-%s-%s", $yr[0],$dateNew[0],$dateNew[1]); if (! empty($yr[1])) $dateNew .= ' ' . $yr[1]; $v_date_orig = '"' . $dateNew . '"'; } else { $v_date_orig = '"' . $v_date_orig . '"'; // we put the quotes around it here because we can't put them into the query, because sometimes // we will use the "current_timestamp", which can't have quotes around it. } return $v_date_orig; } Then, find this section of code arount 1478 if ($v_date_avail == '') { // $v_date_avail = "CURRENT_TIMESTAMP"; $v_date_avail = "NULL"; } else { // we put the quotes around it here because we can't put them into the query, because sometimes // we will use the "current_timestamp", which can't have quotes around it. $v_date_avail = '"' . $v_date_avail . '"'; } if ($v_date_added == '') { $v_date_added = "CURRENT_TIMESTAMP"; } else { // we put the quotes around it here because we can't put them into the query, because sometimes // we will use the "current_timestamp", which can't have quotes around it. $v_date_added = '"' . $v_date_added . '"'; } and replace it with if ($v_date_avail == '') { // $v_date_avail = "CURRENT_TIMESTAMP"; $v_date_avail = "NULL"; } else { $v_date_avail = ConvertDate($v_date_avail); } if ($v_date_added == '') { $v_date_added = "CURRENT_TIMESTAMP"; } else { $v_date_added = ConvertDate($v_date_added); } That should do it. When you copy and paste, watch the long comments extending into a new line. They should be on one line. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
TCwho Posted February 19, 2005 Share Posted February 19, 2005 Hey! Thanks again Jack. I just installed Easy Populate and was wondering about that. ..maybe just upload calling it an optional modification or something similar etc.. Quote Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
Jack_mcs Posted February 20, 2005 Author Share Posted February 20, 2005 Thanks for letting me know. I'll probably add it as a new version at some point. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
dpc Posted February 23, 2005 Share Posted February 23, 2005 (edited) Updated the code and tested, all seems to work ok. Thanks and a big :thumbsup: btw, i'm using UK settings only. Edited February 23, 2005 by dpc Quote Link to comment Share on other sites More sharing options...
Guest Posted February 23, 2005 Share Posted February 23, 2005 if theeasy populate text file is edited in text mode, which is the default download/upload not necessary to do any formatting . . Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted February 23, 2005 Author Share Posted February 23, 2005 Not on mine. All my EP files are .txt but if I don't change the format of the date, it doesn't get updated. My default date is mm/dd/yyyy which EP does not accept. Maybe yours is set differently. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Legend107 Posted April 19, 2005 Share Posted April 19, 2005 thank you, this fix works great.. Quote Link to comment Share on other sites More sharing options...
Rutilia Posted July 15, 2005 Share Posted July 15, 2005 This fix works really great. I was having lots of headaches with the dates, but not anymore! :thumbsup: Quote Link to comment Share on other sites More sharing options...
nbercasio Posted August 12, 2005 Share Posted August 12, 2005 This fix works really great. I was having lots of headaches with the dates, but not anymore! :thumbsup: <{POST_SNAPBACK}> Not working for me. Why these two fields v_date_avail and v_date_added keep replacing my date, for example 8/3/2005 11:44:53 PM into a format and values of 0000-00-00 00:00:00? I am using Easy Populate Basic 2.75, Create Export Field Complete Download then do my updates using Excel then use Upload EP File for Import. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 13, 2005 Author Share Posted August 13, 2005 Did you check first that you needed to make this change. Not everyone does for some reason. As for the date, it is changing it because that the is the format EP expects. Try removing the changes and uploading a file. Then view one of the products you just uploaded on your site. If the date added is correct, then you don't need the change. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
El Salto 999 Posted March 25, 2006 Share Posted March 25, 2006 Thanks for a wonderful fix! My big beef with Easy Populate has been eliminated! Quote Link to comment Share on other sites More sharing options...
carthrina Posted March 23, 2007 Share Posted March 23, 2007 Thanks for the fix but It did not work for me too.. I should mention here that my EP worked perfectly before, but recently i deleted one categorie and added another categories with the same name but different products.. but when I checked my website I can only see names of the products and their descriptions and prices.. but no pictures neither their places.. looking around i noticed that some of these hidden pictures are considered as UpComing products with a date expected (a past date)... I made the modification mentioned by Jack but there is still no pictures even if the Upcoming products message has disappeared.. Should I delete these products and upload them again? Or is there something wrong? Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted March 23, 2007 Author Share Posted March 23, 2007 You don't need this change if Easy Populate was working OK. But if it never worked and the problem was to do with the dates as you describe, then you need it. Be sure that the dates in the Easy Populate file are set correctly. If you put an old date in there, then that is what will be used. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons 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.