fernandokerber Posted June 11, 2012 Share Posted June 11, 2012 Im working on a chinese food online store and I'd like to know if anyone knows about any way to play a sound when shop's owner receive new orders. I think It should use Ajax to retrieve new orders information in real time and then play the sound.. I appreciate the help Link to comment Share on other sites More sharing options...
fernandokerber Posted June 14, 2012 Author Share Posted June 14, 2012 It would be great. no one knows? Link to comment Share on other sites More sharing options...
fernandokerber Posted June 17, 2012 Author Share Posted June 17, 2012 (edited) I think neither God knows it....... Im gonna cry....... Edited June 17, 2012 by fernandokerber (see edit history) Link to comment Share on other sites More sharing options...
Rhapsody Posted June 18, 2012 Share Posted June 18, 2012 The simple way is to use the message sent by mail alerts to trigger a sound and notify you when it is received. Depending on your mail client, you could setup a rule that detects the message and makes a sound on the PC. 2 Link to comment Share on other sites More sharing options...
omnitroy Posted June 18, 2012 Share Posted June 18, 2012 You are right about the idea: 1) plant an ajax (.js link included) in the back-end 2) when logged in as an admin, the js runs. 3) js has a timer (set to N minute loop) to initialize a request to your php 4) the php scans the database for new orders 5) feedbacks to js 6) if "yes" for new orders, js triggers a jquery to play an .mp3 sound. Actually, one of my client suggested that he might be very interested in having this sound-warning stuff. Are you a developer yourself? Link to comment Share on other sites More sharing options...
fernandokerber Posted June 22, 2012 Author Share Posted June 22, 2012 (edited) You are right about the idea: 1) plant an ajax (.js link included) in the back-end 2) when logged in as an admin, the js runs. 3) js has a timer (set to N minute loop) to initialize a request to your php 4) the php scans the database for new orders 5) feedbacks to js 6) if "yes" for new orders, js triggers a jquery to play an .mp3 sound. Actually, one of my client suggested that he might be very interested in having this sound-warning stuff. Are you a developer yourself? yeah maybe I could delevop something like that... but not in a 'module style'... I can implement this to my store changing some core files, but I dont know how to create a module to do this Edited June 24, 2012 by fernandokerber (see edit history) Link to comment Share on other sites More sharing options...
omnitroy Posted June 23, 2012 Share Posted June 23, 2012 yeah maybe I could delevop something like that... but dont in a 'module style'... I can implement this to my store changing some core files, but I doesnt know how to create a module to do this lol~ I am still new to module development on Prestashop but on my way. As I went through some tutorials on this official site, I came cross something about "hook". There might be a hook for you to listen to the event of the incoming updated order. If so, the process will be a lot easier. Otherwise, ajax to check the order updates. And I agree with you that a simple php authorized with database access will do. No module. hehe. Good luck, mate. Link to comment Share on other sites More sharing options...
fernandokerber Posted June 24, 2012 Author Share Posted June 24, 2012 lol~ I am still new to module development on Prestashop but on my way. As I went through some tutorials on this official site, I came cross something about "hook". There might be a hook for you to listen to the event of the incoming updated order. If so, the process will be a lot easier. Otherwise, ajax to check the order updates. And I agree with you that a simple php authorized with database access will do. No module. hehe. Good luck, mate. I read something about hooks too, but not too much specific to solve my problem... there is a "new-order" hook, right? what does this hook actually do? how does it works in fact? it would call a function after the users checkout? and then...? Link to comment Share on other sites More sharing options...
devilsown Posted June 24, 2012 Share Posted June 24, 2012 You should look into just setting up a thunderbird, or outlook to auto print the emails of the invoices. There are plugins for this. I like hearing my printers going off I wrote a free ups xml modual thats on this site. You can do simlar with the auto print and setup the email clent to save attachments like the xml file for worldship input file so you can get the shipping lables also automated printed out along with the invoice. Link to comment Share on other sites More sharing options...
bellini13 Posted June 24, 2012 Share Posted June 24, 2012 I read something about hooks too, but not too much specific to solve my problem... there is a "new-order" hook, right? what does this hook actually do? how does it works in fact? it would call a function after the users checkout? and then...? a "hook" just allows you to respond to certain events that occur on your site. the newOrder hook allows you to respond to a new order being created. so yo u would create a module that listens for the newOrder hook, and then react in some way.i I like Rhapsody's approach, but it assumes you are running an email client that can play a sound based on receiving an email. Link to comment Share on other sites More sharing options...
mim Posted June 24, 2012 Share Posted June 24, 2012 (edited) I’ve to do the same for a client as well in future months, ) I think your best bet’d be to use orderConfirmation hook instead of new order one because if I am not wrong it’ll be triggered once an order proceeds and not necessarily confirmed. and by the way using email APIs doesn’t look enough reliable I think, although it would looks easier to do but it’s more dependence on third parties and I can imagine would add some delay of notifications and difficulties on debugging level as well, but you know you have to see if other technics just working or not! And I think also using a module in backoffice would be better than changing the PS cores since I guess it’s possible all the way, Edited June 24, 2012 by mim (see edit history) Link to comment Share on other sites More sharing options...
mim Posted June 24, 2012 Share Posted June 24, 2012 btw there is some modules who sends sms notifications if you look for something easy and ready Link to comment Share on other sites More sharing options...
omnitroy Posted June 24, 2012 Share Posted June 24, 2012 In prestashop version 1.5 which I checked, there is a notification option in the back-end: Administration Tag -> Preferences -> Notifications. You can put a tick to "Show notifications for new orders"... Then, you know what to do. Perhaps override that thing and put a jquery sound to it. Haha~ Link to comment Share on other sites More sharing options...
Logical IT Posted June 25, 2012 Share Posted June 25, 2012 Hi, I have already written a blog post on how to print new orders automatically in PrestaShop. Instead of printing the order you can play a sound or do both. Please read my blog post for more information: http://www.logicalit.com/blog/how-to-automatically-print-new-orders-in-prestashop/ Hope it helps. Chris. 1 Link to comment Share on other sites More sharing options...
gabryel80 Posted June 25, 2012 Share Posted June 25, 2012 I think the files which need to me modified for this new function are: Notification.php and Notification.js - Available in prestahsop 1.5 I made some tries ...but no chance for my knowledge. Maybe somebody will help us with a response. Link to comment Share on other sites More sharing options...
fernandokerber Posted June 25, 2012 Author Share Posted June 25, 2012 I was thinking about using my email client to do that, but as "mim" said, I could have trouble with delays and mail failures. I'll take a look at all your suggestions refering to use the 1.5 native features and/or hook functions for 1.4.x versions. By the way, what's the difference between the orderConfirmation hook and the newOrder hook? When each one starts working? Thanks Link to comment Share on other sites More sharing options...
bellini13 Posted June 25, 2012 Share Posted June 25, 2012 the newOrder hook is executed after you click the confirm order button, and after the payment module has performed its functions. However it is before the customer is redirected to the order confirmation page is displayed. It is easier to say that once the order is created in the database, the newOrder hook is executed. The orderConfirmation hook is executed when the customer is redirected to the order confirmation page. 1 Link to comment Share on other sites More sharing options...
omnitroy Posted June 26, 2012 Share Posted June 26, 2012 I think the files which need to me modified for this new function are: Notification.php and Notification.js - Available in prestahsop 1.5 I made some tries ...but no chance for my knowledge. Maybe somebody will help us with a response. I looked up the Notification.js, I believe it is quite easy to facilitate it with a sound. We need to re-write the Notification.js with jquery plugin. Here we choose jquery.jmp3.js (you may google it), modify the jmp3 a bit about the path of swf/flash player (you may put it right next to the js file), switch it to autoplay. In the Notification.js, we put add a line of soundTrigger() there: function getPush(refresh) { $.post("ajax.php",{"getNotifications" : "1"}, function(data) { if (data) { soundTrigger(); ...... Write a function according to jmp3's way and get the sound autoplayed. That's it. Link to comment Share on other sites More sharing options...
fernandokerber Posted June 26, 2012 Author Share Posted June 26, 2012 I looked up the Notification.js, I believe it is quite easy to facilitate it with a sound. We need to re-write the Notification.js with jquery plugin. Here we choose jquery.jmp3.js (you may google it), modify the jmp3 a bit about the path of swf/flash player (you may put it right next to the js file), switch it to autoplay. In the Notification.js, we put add a line of soundTrigger() there: function getPush(refresh) { $.post("ajax.php",{"getNotifications" : "1"}, function(data) { if (data) { soundTrigger(); ...... Write a function according to jmp3's way and get the sound autoplayed. That's it. hi! I'm trying these notifications but agreeing with my tests, it's not a self refreshing functionality, right? I've checked the 'new order' and 'new account' notification, and I made a new order by myself but the notification didn't appear in my back-end automatically (like Facebook does). It just appeared when I did a refresh by myself in the the back-end (clicking in any link in the back-end). Link to comment Share on other sites More sharing options...
gabryel80 Posted June 26, 2012 Share Posted June 26, 2012 (edited) hi! I'm trying these notifications but agreeing with my tests, it's not a self refreshing functionality, right? I've checked the 'new order' and 'new account' notification, and I made a new order by myself but the notification didn't appear in my back-end automatically (like Facebook does). It just appeared when I did a refresh by myself in the the back-end (clicking in any link in the back-end). Please take a look at rows : 44-45 // getPush(autorefresh_notifications); and 114-115// if(refresh) setTimeout("getPush(1)",60000); from file notification.js. I THINK we can modify the 60000 value and add a new one. This change will make a new refresh according with what value we set there. I would be happy to see this post as RESOLVED. I found this : you can add at the final of the code of the file which you want to be refresded echo('<meta http-equiv="refresh" content="6000">'); Edited June 26, 2012 by gabryel80 (see edit history) Link to comment Share on other sites More sharing options...
fernandokerber Posted June 27, 2012 Author Share Posted June 27, 2012 Please take a look at rows : 44-45 // getPush(autorefresh_notifications); and 114-115// if(refresh) setTimeout("getPush(1)",60000); from file notification.js. I THINK we can modify the 60000 value and add a new one. This change will make a new refresh according with what value we set there. I would be happy to see this post as RESOLVED. I found this : you can add at the final of the code of the file which you want to be refresded echo('<meta http-equiv="refresh" content="6000">'); hi! nice approach. I tried to modify this value to 1000 milliseconds without any success in self refresh the notifications. I saw a commented line that says "// call it once immediately, then use setTimeout if refresh is activated". I think we need to activate the 'refresh'. But I dont know how to do it Link to comment Share on other sites More sharing options...
fernandokerber Posted June 27, 2012 Author Share Posted June 27, 2012 I was thinking about how to make the refresh be automatic and i've got a solution!!! In the end of notification.js we need to comment a line that tests a condition. the line is (before): if(refresh) setTimeout("getPush(1)",600000); After editing the line and set a smaller time we got: //if(refresh) setTimeout("getPush(1)",10000); Doing this, we make its self refreshing. 1 Link to comment Share on other sites More sharing options...
Altan Posted August 4, 2013 Share Posted August 4, 2013 Hello , I also need sound when recieving order. Is this working with "setTimeout("getPush(1)",10000);" WE must write to Prestashop developers to make module about this. Link to comment Share on other sites More sharing options...
rhayy Posted October 25, 2013 Share Posted October 25, 2013 (edited) in the DB, correct PS_ADMIN_REFRESH_NOTIFICATION in the table 'configuration' and set it to 1 if it's not already done i'm still looking for the sound notification Edited October 25, 2013 by rhayy (see edit history) Link to comment Share on other sites More sharing options...
jgullstr Posted October 25, 2013 Share Posted October 25, 2013 Shouldn't be a lot of work to make a module that does this. Luckily, I got some free time atm, brb Link to comment Share on other sites More sharing options...
rhayy Posted October 25, 2013 Share Posted October 25, 2013 i think a module has been done (30€) Link to comment Share on other sites More sharing options...
rhayy Posted October 25, 2013 Share Posted October 25, 2013 (edited) i was editing the wrong files here is the solution in 3 steps : 1/ correct an error in the database : PS_ADMIN_REFRESH_NOTIFICATION is the correct name, an '_' has been forgotten. 2/ add in the header.tpl (between the body tags of course) (adminxxx/your_theme/template/ directory) : <audio id="the_id"> <source src="path/to/the/file.mp3" type="audio/mpeg"> </audio> for more about audio tag, please see : http://www.w3schools.com/html/html5_audio.asp 3/ add, in notification.js ( js/ directory), inside the if (html != "")'s braces after $.each(json.order, function(property, value) : document.getElementById("the_id").play(); BUT it will be played every xx ms (set in setTimeout) until there's no more notification displayed Edited October 25, 2013 by rhayy (see edit history) Link to comment Share on other sites More sharing options...
jgullstr Posted October 25, 2013 Share Posted October 25, 2013 i think a module has been done (30€) That's kind of steep when you can get one for free Link to comment Share on other sites More sharing options...
rhayy Posted October 25, 2013 Share Posted October 25, 2013 i will try it later. a module is better than modifying the PS core files. Link to comment Share on other sites More sharing options...
robert98 Posted January 5, 2021 Share Posted January 5, 2021 is anyone find this solution? if anyone knows kindly explain . i also want to achieve that Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now