Code:
NOTE: THIS IS FROM AN OLD VERSION OF THE CART, AND IS NOT USING OVERRIDE.
USE CAUTION AND BACKUP, BACKUP, BACKUP.
in tpl_checkout_shipping_default.php make these changes:
first, change the form action. You'll have to append the zenid to it. the javascript function mycheckrequired() is defind in scw.js I downloaded it somewhere, and added it to the simple calendar widget I also downloaded.
$myquerystring="?main_page=checkout_shipping&$_GET[zenid]";
<form onSubmit="return mycheckrequired(this)" name="checkout_address" action="https://secure.mysite.net/~myclient/index.php<?echo($myquerystring);?>" method="post" >
** takes the place of **
echo zen_draw_form('checkout_address', zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . zen_draw_hidden_field('action', 'process');
next we'll write our own form fields.
** replace **
php echo zen_draw_textarea_field('comments', 'soft', '60', '5');
** with**
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
<tr>
<td width="100%">
<script type='text/JavaScript' src='scw.js'></script>
<input type=hidden name="comments">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5">
<tr>
<td width="50%">
<img src='https://secure.mysite.net/~myclient/images/scw.gif'
title='Click Here'
alt='Click Here'
onclick="scwShow(document.getElementById('date1'),this,0,6);" width="16" height="16" align="right" /><font face="Verdana" style="font-size: 9pt">Select
a Date:</font></td>
<td width="50%"><input required onclick="scwShow(this,this,0,6);" readonly id='date1' type="text" name="requiredmycdate" size="20"></td>
</tr>
<tr>
<td width="50%">
<font face="Verdana" style="font-size: 9pt">Enter a Time:</font></td>
<td width="50%">
<select name=requiredmyctime size="1" >
<option value= "">Please select the earliest we may deliver.</option>
<option value= "9:00am">9:00am</option>
<option value= "10:00am">10:00am</option>
<option value= "11:00am">11:00am</option>
</select><br>
<select name=requiredmyctime2 size="1" >
<option value= "">Please select the latest we may deliver</option>
<option value= "3:00pm">3:00pm</option>
<option value= "4:00pm">4:00pm</option>
<option value= "5:00pm">5:00pm</option>
</select>
</td>
</tr>
<tr>
<td width="50%" valign="top"><font face="Verdana" style="font-size: 9pt">Please Enter Comments:</font></td>
<td width="50%">
<textarea cols="60" rows="5" id='myccomments' name="myccomments" ></textarea></td>
</tr>
<tr>
<td width="100%" colspan="2">
<p align="center">
</td>
</tr>
</table>
</td>
</tr>
</table>
** replace **
<?php echo zen_image_submit(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT); ?>
** with **
<?//[[Pickup/Delivery]] below is str_replace()ed in tpl_checkout_payment.php?>
<input type="image" src="https://secure.mysite.net/~myclient/includes/templates/template_default/buttons/english/button_continue.gif"
onclick="comments.value=('[[Pickup/Delivery]] Date ' + requiredmycdate.value + '\n[[Pickup/Delivery]] Begin Time: ' + requiredmyctime.value + ' End Time: '+requiredmyctime2.value+'\n[[Pickup/Delivery]] will be made between the selected times.\n' + myccomments.value)"
alt="Continue" title=" Continue " width="75" height="20" />
==========
since I don't remember where I got the "check required" code, I will include the entire function here with my alterations.
i am re-modifying this to remove client specific info, but it should still work as I made corresponding changes to the code above.
Like I said earlier, I just dropped this into the bottom of the other js file I was already useing.
function mycheckrequired(which) {
var mypass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
mypass=false;
break;
}
}
}
}
if (!mypass) {
shortFieldName=tempobj.name.substring(11,30).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}
==========
** find on google **
// Simple Calendar Widget - Cross-Browser Javascript pop-up calendar.
//
// Copyright (C) 2005-2006 Anthony Garrett
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version. ...
** near the top you'll find **
var scwDateNow = new Date(Date.parse(new Date().toDateString()));
** add **
var yesterday = new Date()-86400000;
** set these vars **
var scwBaseYear = scwDateNow.getFullYear();
// How many years do want to be valid and to show in the drop-down list?
var scwDropDownYears = 2;
** paste this near the disable date code **
<?PHP
$deadline=11; // use 24 hour clock, 100th min time so 1:30pm is 13.5
$deadline=$deadline*60;
$t=time();
$h=date("H",$t)+1; //server time is one hour behind my local time.
$m=date("i",$t)+($h*60);
$dlmet=($m<$deadline); //dlmet is short for deadline met.
if ($dlmet){
print('scwDisabledDates[0] = [new Date(2004,11,25),new Date(yesterday)]; ');
}
else{print('scwDisabledDates[0] = [new Date(2004,11,25),new Date()]; ');}
// disables all dates from 2004,11,25 to yesterday or today
?>
** and make this changes as well: **
var scwActiveToday = <?php print "'".$dlmet."'"; ?>;
//var scwActiveToday = true;
//sets the "today" link active if deadline is met or inactive if not.
** read through Anthony Garrett's code to see if there are any other changes you need. **
** in tpl_checkout_payment_default.php **
** put this right below the zen comments **
$mycshipmthd=$order->info['shipping_method'];
$mycstorepickup="(Store Pickup)";
if (ereg($mycstorepickup,$mycshipmthd)){$pu_dlv="Pickup";}else{$pu_dlv="Delivery";}
$comments=str_replace('[[Pickup/Delivery]]',$pu_dlv,$comments);
** around line 220 change **
echo zen_draw_textarea_field('comments', 'soft', '60', '5');
** to **
<?echo("This area is read-only. Please <a href='javascript:history.go(-1);'><font style='color: red;'>go back</font></a> if corrections are needed.");?>
<?
echo zen_draw_textarea_field('comments', 'soft', '60', '5', '','readonly');
?>
</td>
I think this is all. I hope it is helpful.