Studio IT Posted January 2, 2011 Share Posted January 2, 2011 Why some dates in BO are displayed differently?I've setup d.m.Y date format and in front is everything ok but in BO some dates are OK and some are in format Y-m-d. How to change all the dates to display in d.m.Y format? Link to comment Share on other sites More sharing options...
rocky Posted January 3, 2011 Share Posted January 3, 2011 Did you change the format in classes/Tool.php? In the displayDate function, edit lines 344-347: if ($language AND strtolower($language['iso_code']) == 'fr') return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : '')); else return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : '')); to: /*if ($language AND strtolower($language['iso_code']) == 'fr') return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : '')); else return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : '')); */ return ($tmpTab[2].'.'.$tmpTab[1].'.'.$tmpTab[0].($full ? $hour : '')); Link to comment Share on other sites More sharing options...
Studio IT Posted January 3, 2011 Author Share Posted January 3, 2011 Yes but as I said earlier some dates are ok but some are not. a.e the dates in Product Reduction amount available from and to, the date on Order detail Invoice #IN000004 Created on: 2011-01-02 22:12:25, calendar From: and To: in stats and home page, date in Merchandise return table and so on... Link to comment Share on other sites More sharing options...
rocky Posted January 4, 2011 Share Posted January 4, 2011 Those reduction and calendar dates are in MySQL date format, so you can't change the format of them. The date on the Orders tab is definitely a bug. The displayDate function isn't being called. Try changing line 560 of admin/tabs/AdminOrders.php (in PrestaShop v1.3.5) from: '.$this->l('Created on:').' '.$order->invoice_date.' to: '.$this->l('Created on:').' '.Tools::displayDate($order->invoice_date, intval($cookie->id_lang), true).' Link to comment Share on other sites More sharing options...
Studio IT Posted January 4, 2011 Author Share Posted January 4, 2011 Thx, that works but I also would the date fields in right format. I understand that is MYSQL date format but why is not possible to change the display to right format? Or is possible to change the field to read-only or text that is changed only by datepicker? Link to comment Share on other sites More sharing options...
rocky Posted January 5, 2011 Share Posted January 5, 2011 PrestaShop v1.4 already does that. The "Available from" fields are read-only and a date picker is used. Link to comment Share on other sites More sharing options...
Kelvin Koh Posted January 5, 2011 Share Posted January 5, 2011 Did you change the format in classes/Tool.php? In the displayDate function, edit lines 344-347: if ($language AND strtolower($language['iso_code']) == 'fr') return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : '')); else return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : '')); to: /*if ($language AND strtolower($language['iso_code']) == 'fr') return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : '')); else return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : '')); */ return ($tmpTab[2].'.'.$tmpTab[1].'.'.$tmpTab[0].($full ? $hour : '')); Hi Rocky, I'd like to change the date format to dd-mm-yyyy too and tried what you have recommended. However, this modification to the code caused a number of issues to my current Prestashop v1.3.5:1. Customer login, registration and checkout returned white black pages2. Random or persistent errors in accessing or loading categories and product pages3. Logging out of BO is erratic and gave blank white pageIs there another method of changing and standardising the date formats throughout the BO and FO other than modifying the codes manually? Are there any modules or new version of PS addresses this issue?Any suggestions on this is very much appreciated as my region (Asia) uses the dd-mm-yyyy format extensively. Link to comment Share on other sites More sharing options...
rocky Posted January 5, 2011 Share Posted January 5, 2011 No, changing the displayDate function is the only way to change the date. It shouldn't have caused any white pages. I've successfully changed my website to dd-mm-yyyy before by changing the code. Link to comment Share on other sites More sharing options...
Kelvin Koh Posted January 5, 2011 Share Posted January 5, 2011 No, changing the displayDate function is the only way to change the date. It shouldn't have caused any white pages. I've successfully changed my website to dd-mm-yyyy before by changing the code. Thank you for the clarification. I gave it another try and all seems fine at the moment. Seems like I didn't do the url-friendly, generation of .htaccess file process and changing of Tools.php file's permissions properly, hence the white pages. Link to comment Share on other sites More sharing options...
Recommended Posts