Help needed for alerterrors in orderingscript

This is a discussion on "Help needed for alerterrors in orderingscript" within the JavaScript Forum section. This forum, and the thread "Help needed for alerterrors in orderingscript are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 2nd, 2007, 09:15
New Member
Join Date: Apr 2007
Location: netherlands
Age: 47
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Help needed for alerterrors in orderingscript

Hello there,

Hope you can really help me

I have an ordering script to modify.
The script had two shops in where people could order, and based on the users zip area and opening hours for delivery, the message was sent via email to the different shops.

now i have added a third shop, zip codes are already added, same with the email trigger.
So this already works, bu now i have really no clue to ad the extra opening hours for store C, so that if a user orders after the delivery hours they get a message like sorry, shop is closed
Reply With Quote

  #2 (permalink)  
Old Apr 2nd, 2007, 15:09
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Help needed for alerterrors in orderingscript

We are going to have to have a link to the site or at least some relevant code in order to help.
Reply With Quote
  #3 (permalink)  
Old Apr 2nd, 2007, 15:25
New Member
Join Date: Apr 2007
Location: netherlands
Age: 47
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help needed for alerterrors in orderingscript

the script is in dutch, but i can give yu the link to the test server for it htpp:// goldengatepizza.nl/testing/bestel.js,

Code: Select all
openzo ='16452155';
openma ='16452155';
opendi ='16452155';
openwo ='16452155';
opendo ='16452225';
openvr ='16452225';
openza ='16452225';
openzoa ='16152225';
openmaa ='16152225';
opendia ='16152225';
openwoa ='16152225';
opendoa ='16152225';
openvra ='16152225';
openzaa ='16152225';
are the opininghours for delivery.

I added this extra:
Code: Select all
openzob ='16152225';
openmab ='16152225';
opendib ='16152225';
openwob ='16152225';
opendob ='16152225';
openvrb ='16152225';
openzab ='16152225';
####function to check opening hours####

now i get in trouble, really don';t know how to!!

Code: Select all
function opencheck(dagen,maanden,jaren,uren,minuten,zon,maa,din,woe,don,vri,zat){
ctijd=new Array();
wopen=0;
openconf = "go";

var datum = new Date(jaren,maanden,dagen,uren,minuten,0);
var dag=datum.getDay();

if(dag==0){
 dagvar=zon;
 for(tellerta=0;tellerta<dagvar.length/8;tellerta++){
  ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
 for(tellertb=0;tellertb<dagvar.length/8;tellertb++){
  if(wopen!=1){
   btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
   etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
   tijd=(60*datum.getHours())+datum.getMinutes();
   if(tijd>=btijd&&tijd<=etijd){
    wopen=1;}
  }
 };
};
if(dag==1){dagvar=maa;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}};
};
if(dag==2){dagvar=din;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}};
};
if(dag==3){dagvar=woe;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
if(dag==4){dagvar=don;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
if(dag==5){dagvar=vri;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
if(dag==6){dagvar=zat;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
 

var nutdatum = new Date();
var nudatum =  new Date(nutdatum.getYear(),nutdatum.getMonth(),nutdatum.getDate(),nutdatum.getHours(),nutdatum.getMinutes() + 35,0);

if (datum.getYear() < nudatum.getYear()){wopen=0;}
if (datum.getMonth() < nudatum.getMonth() && datum.getYear() == nudatum.getYear()){wopen=0;}
if (datum.getDate() < nudatum.getDate() && datum.getMonth() == nudatum.getMonth() && datum.getYear() == nudatum.getYear() ){wopen=0;}
if (datum.getHours() < nudatum.getHours() && datum.getDate() == nudatum.getDate() && datum.getMonth() == nudatum.getMonth() && datum.getYear() == nudatum.getYear() ){wopen=0;}
if (datum.getMinutes() < nudatum.getMinutes() && datum.getHours() == nudatum.getHours() && datum.getDate() == nudatum.getDate() && datum.getMonth() == nudatum.getMonth() && datum.getYear() == nudatum.getYear() ){wopen=0;}
 
 
 
return wopen;
};
##################################
thanks for your reply

Last edited by karinne; Apr 2nd, 2007 at 15:32. Reason: Please use [code]...[/code] tags when displaying code!
Reply With Quote
  #4 (permalink)  
Old Apr 2nd, 2007, 19:48
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Help needed for alerterrors in orderingscript

This code is very difficult to read but it looks like there is huge scope to simplify.

As far as I can tell, it's doing the same thing mostly over and over again.

Try getting rid of the repitition and then see what happens.
Reply With Quote
Reply

Tags
aklert, java, openinghours, ordering, zipcode

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Designers needed, cloners needed. TargeTemplate Job Opportunities 0 Dec 27th, 2007 03:41
help needed please em j Introduce Yourself 4 Nov 20th, 2007 16:53
Help needed itorch JavaScript Forum 20 Dec 2nd, 2006 07:40
help with nav bar needed please help bruno89 Web Page Design 1 Feb 23rd, 2006 20:08
Help needed with <div> tag allstar Web Page Design 6 Dec 8th, 2005 20:25


All times are GMT. The time now is 22:30.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43