Forums / General Questions / Date attribute

Date attribute

Locked

Views: 3,562

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
5 Jul 2006, 3:08 PM
#1
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Date attribute

I have a florist client who would like to have her customers be able to select a delivery date from a calendar. She would like to be able to black out Sundays and certain other dates she is either closed, or oversold.
Is there a mod that includes these functions?

5 Jul 2006, 4:42 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,682
Plugin Contributions:
0

Re: Date attribute

I have heard this sort of request before, but I am not aware of a drop in mod that covers it. The Admin uses the "Spiffy Cal" for setting dates for specials etc. Perhaps you could adapt it?

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

31 Aug 2006, 2:57 PM
#3
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Date attribute

TecBrat:

I have a florist client who would like to have her customers be able to select a delivery date from a calendar. She would like to be able to black out Sundays and certain other dates she is either closed, or oversold.
Is there a mod that includes these functions?

I ended up hard coding some java into the checkout process that adds date and time to the order comments. I then made the comment box read-only on the next page. If this is of great interest to someone, contact me and I will try to assist. (This was on an old version of the cart that was made without overrides, so I can't {or really don't want to} upgrade it.)

4 Sep 2006, 12:25 AM
#4
violetcandy avatar

violetcandy

New Zenner

Join Date:
Aug 2006
Posts:
14
Plugin Contributions:
0

Re: Date attribute

I would love to know how you did that.

This is the zencart I am currently working on.
http://www.memphisriverboats.net/cart
ZC v. 1.3.6
Super Orders

5 Sep 2006, 11:13 AM
#5
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Date attribute

violetcandy:

I would love to know how you did that.
Just acknowledging I read this. I am on the job at the moment, but after work, I'll try to put something together that makes it easy to understand what I did. I have not practiced making documentation for others to read very much.

24 Sep 2006, 3:01 AM
#7
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Date attribute

TecBrat:

Just acknowledging I read this. I am on the job at the moment...

Sorry I haven't had the chance to come back and give the details, or to check out the oscart mod. I want to help, but I find myself so busy that I can't write this up. I haven't given up on it though.

27 Sep 2006, 7:15 PM
#8
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Date attribute

I wrote this out in notepad.
I am going to put it all in a code box in case code might otherwise cause problems in the board. just rip out what you need.
I am sure this is very much against any form of standards that exist, :lamo: but it worked.

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.
27 Sep 2006, 7:45 PM
#9
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Date attribute

TecBrat:

** 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);

In the section above, there is a custom shipping mod called "Delivery" that I don't remember where it came from. My boss added it to this cart before I came to work for him. He might even have made it himself. Edit as needed for your own shipping choices.

29 Sep 2006, 3:20 PM
#10
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Date attribute

I have taken this concept and moved it into the tp_checkout_payment_default.php file. It works better because the delivery choice has already been made, and I needed to offer a different kind of schedule for pickups than for delivery.

17 Dec 2006, 2:41 PM
#11
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Date attribute

Anything solved for adding a delivery date by the customer to the newest ZC?
First I was just trying to make it for the login information, like changing the second address field as "delivery date" but that won't work since it must be in the order procedure if the customer is ordering a second time that she/he can have change to change the delivery date.

I may be blond but at least I found Zen.

29 Dec 2006, 4:17 PM
#12
hws avatar

hws

New Zenner

Join Date:
Dec 2006
Posts:
8
Plugin Contributions:
0

Re: Date attribute

I have just developed a 'Delivery Date Picker' mod that allows the customer to choose a delivery date on Step 1 of the checkout process using a popup calendar by Calendarxp.net

The mod is totally customizable with the following features....- Calendar colors can be changed to match site colors

  • All past dates are automatically disabled from being chosen
  • Any single or recurring date can be automatically disabled from being chosen
  • Conditional rules can be used to disable dates from being chosen. Such as, date or time that the date was chosen. This can be useful if you had a cutoff time for next day delivery.
  • The date field is not writtable directly. This prevents the customer from entering in a date that is not acceptable for delivery.
  • Validation is used so that the customer cannot continue with the order unless they have chosen an availale date from the popup calendar.
  • The chosen delivery date is incorporated into the order emails for both customer and admin
  • The chosen delivery date is displayed with the rest of the order information in the admin backend.We are currently working on a release package and demo site.
    For configuration demo purposes the release package will automatically disable all past days, Sundays and Mondays, the day after some holidays (eg, Thanks Giving, Christmas Day, July 4th) and the following day if after 11am PST.

Once the demo site is up and running we will make the link available for anyone interested to take a look.

We also have integrated the DOTS address validation services into ZenCart to verify customers postal addresses. This too will be on the demo site.

1 Mar 2007, 1:15 AM
#13
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Date attribute

A date attribute would be fantastic... For us, it would need to be an attribute, not a checkout step, because our products (cakes) have individualised delivery dates. A customer may order 2 cakes - one that needs to be delivered in 7 days, and another that needs to be delivered in 10 days.

Right now, I just use a simple text box attribute and ask customers to type in the date they require the cake.

This works... but a spiffy cal feature would be better!

20 years a Zencart User