Sanook Posted March 11, 2009 Share Posted March 11, 2009 Hela :-)Is it possible to display the current (server) date and timein one of the sidebars of my shop?Any help is much appreciated.Best regards,Sanook Link to comment Share on other sites More sharing options...
newpresto Posted March 11, 2009 Share Posted March 11, 2009 http://www.prestashop.com/forums/viewthread/12807/modules/flash_clock___calendar_module Link to comment Share on other sites More sharing options...
Sanook Posted March 13, 2009 Author Share Posted March 13, 2009 Thanks for your reply :-)The module looks great, but I was looking for something a bit simpler since my shop is rather crowded already.Displaying something like: 18:00 hoursMonday January 1..is al I really need.Anyone know how to do this?Cheers,Sanook Link to comment Share on other sites More sharing options...
Star Posted March 13, 2009 Share Posted March 13, 2009 This will do...http://www.dynamicdrive.com/dynamicindex6/clock3.htm Link to comment Share on other sites More sharing options...
Sanook Posted March 14, 2009 Author Share Posted March 14, 2009 Thanks for your reply.But this script will display the time of the user's computer if I'm not mistaken.I am looking for a script that displays the current date and time set on my server.Perhaps I should have made this more clear in my question, sorry.My server is located in Thailand, and my customers are from the US and UK, amongst others.I would like to show them the Thai date and time, for customer service reasons etc.Anyone? Link to comment Share on other sites More sharing options...
rocky Posted March 16, 2009 Share Posted March 16, 2009 Try adding this code to one of your modules. For example, on line 101 of modules/blockinfos/blockinfos.php, before the return, you could add: $today = getdate(); echo $today['hours'] . ':' . $today['minutes'] . ' hours ' . $today['weekday'] . ' ' . $today['month'] . ' ' . $today['mday']; There is probably a better place you could place it. You could also store the date in a string and pass it into a tpl file. Link to comment Share on other sites More sharing options...
Sanook Posted March 16, 2009 Author Share Posted March 16, 2009 Thanks Rocky, it works nicely :-) You could also store the date in a string and pass it into a tpl file. Can you tell me how do this, I don't know much about php.I understand what you mean, but I just don't know where to put the code.My aim is to display this time in the right column/sidebar of my shop.I was able to put a little flash clock using the footer.tpl file,but I don't know how to make php or smarty code work there.Best regards,Sanook Link to comment Share on other sites More sharing options...
rocky Posted March 16, 2009 Share Posted March 16, 2009 To be more specific, if, for example, you have the information block in your right sidebar and want to add the current time above it, you could edit modules/blockinfos/blockinfo.php and add the following code at line 102, before the return: $today = getdate(); $smarty->assign('current_time', $today['hours'] . ':' . $today['minutes'] . ' hours ' . $today['weekday'] . ' ' . $today['month'] . ' ' . $today['mday']); You could then edit modules/blockinfos/blockinfo.tpl and add something like the following to the top of the file: {$current_time} Link to comment Share on other sites More sharing options...
Sanook Posted March 18, 2009 Author Share Posted March 18, 2009 To be more specific, if, for example, you have the information block in your right sidebar and want to add the current time above it, you could edit modules/blockinfos/blockinfo.php and add the following code at line 102, before the return:$today = getdate(); $smarty->assign('current_time', $today['hours'] . ':' . $today['minutes'] . ' hours ' . $today['weekday'] . ' ' . $today['month'] . ' ' . $today['mday']); You could then edit modules/blockinfos/blockinfo.tpl and add something like the following to the top of the file: {$current_time} You're the greatest! Everything is working :-)Thanks so much for your help.Best regards,Sanook Link to comment Share on other sites More sharing options...
Sanook Posted March 18, 2009 Author Share Posted March 18, 2009 Am trying to put a flash clock.Everything works until I put the last two params: &UTCTime;and &timeoffset; <object type="application/x-shockwave-flash" data="media/devAnalogClock.swf" width="200" height="200"> </object> It should be getting the time from my server, but it doesn't work.The clock stops working.Btw: I have put the code in footer.tpl to be displayed in the right column.Anyone know how to make this work? Link to comment Share on other sites More sharing options...
Sanook Posted March 18, 2009 Author Share Posted March 18, 2009 I got a javascript version too, but don't know where to put either code... [removed]<!-- var flashvars = { clockSkin: "media/skins/skin004.png", arrowSkin: "7", showSeconds: "no", arrowScale: "70", UTCTime: "<?php echo gmdate('H:i:s'); ?>", timeOffset: "3600" }; swfobject.embedSWF( "devAnalogClock.swf", "devAnalogClock", "220", "220", "8", "expressInstall.swf", flashvars, {scale: "noscale", wmode: "transparent"} ); // -->[removed] Updated: [removed] means jscript :-) Link to comment Share on other sites More sharing options...
babyewok Posted May 5, 2009 Share Posted May 5, 2009 Rocky - your solution works OK, but it doesn't adjust for daylight savings time and alo it shows (for example) 12:4 instead of 12:04.How can I get it to account for daylight saving and sort out the missing 0?? Otherwise, this is a nice easy to use bit of code.The javascript version on dynamic drive looks good as it uses the time of the users's computer, so this gets around daylight savings and all that. However, I don't know how to get it to work - it breaks the page if I just pop the coded in as it instructs. Link to comment Share on other sites More sharing options...
rocky Posted May 10, 2009 Share Posted May 10, 2009 Hi babyewok,You may be right. I didn't fully test the code. I think changing $today['minutes'] to ($today['minutes'] < 10 ? '0' : '') . $today['minutes'] will fix the missing 0, but I just assumed that PHP would handle daylight savings. If you give me a link to the javascript, I can try to get it to work in Prestashop.Rocky Link to comment Share on other sites More sharing options...
babyewok Posted May 11, 2009 Share Posted May 11, 2009 Hi, I went to a php forum and also to the hosting provider and discovered that the daylight savings issue was down to a setting in config.inc.php. It read on line 16: date_default_timezone_set('Europe/Paris'); so I changed it to date_default_timezone_set('Europe/London'); I hadn't realised that Prestashop was controlling the timezone.With regards to the zero, a guy at php builder gave me this to use instead and it works fine: $today = getdate(); $smarty->assign('current_time', date('l F j Y H:i')); Link to comment Share on other sites More sharing options...
Proglamour Posted June 20, 2009 Share Posted June 20, 2009 Hi guys,I’ve change my system date to ‘Asia/Kuala_lumpur’ and work great. But format are different at BO and user email. Below is the example:2009-06-20 23:03:26 << date display at BO (Orders) – 24hours formatOrder: #000037 placed on 2009-06-20 11:03:27 << date display at user email (Order Confirmation) – 12 hours formatWhere to change the format for user email to 24hours format? Link to comment Share on other sites More sharing options...
Lalo Landa Posted November 2, 2009 Share Posted November 2, 2009 hi, i've got a problem here... this code shows the name of the days and months in english, and i need the names in spanish...hmmm Link to comment Share on other sites More sharing options...
Scrapper Posted April 18, 2011 Share Posted April 18, 2011 To be more specific, if, for example, you have the information block in your right sidebar and want to add the current time above it, you could edit modules/blockinfos/blockinfo.php and add the following code at line 102, before the return:$today = getdate(); $smarty->assign('current_time', $today['hours'] . ':' . $today['minutes'] . ' hours ' . $today['weekday'] . ' ' . $today['month'] . ' ' . $today['mday']); You could then edit modules/blockinfos/blockinfo.tpl and add something like the following to the top of the file: {$current_time} I wanted to put this code in the verses. 1.4 to display the date in the title of the products on display. I wish I had written this: the new products in April and make changes alone, but I can not get it working in my php file to parse error, I do not know php so I'm not able to correct any error Link to comment Share on other sites More sharing options...
DARKF3D3 Posted May 28, 2013 Share Posted May 28, 2013 (edited) I'm trying to show actual month name in <h4> of the home featured module, there's no way to put the code directly into the tpl file? I have tried this but it doesn't work: <h4><?php $today = getdate(); echo $today['month']; ?></h4> Edited May 28, 2013 by DARKF3D3 (see edit history) Link to comment Share on other sites More sharing options...
ruisonika Posted July 6, 2017 Share Posted July 6, 2017 Hello can someone help in this problem...I've looked this solution and for me it should be work...I only want to know where i can put the php code that are show in this forum, my result it would be this:I have unavailable products and when there is a date for product to be available i would like to put the date in the flag (done), but in some products the available date is pass that the current time and i wanna only show the date if current time < available date .is there a $current_time or similar in prestashop or i must create one and if so where can i put the code for that? Link to comment Share on other sites More sharing options...
Recommended Posts