View Single Post
  #1  
Old 08-02-2007, 05:00 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Delivery Date Chooser

This mod displays a pulldown next to products with a list of dates for the customer to choose for delivery. It's quite simple at the moment, someone might like to run with it to improve it.

Currently set up to not show Sundays or the next day if the time is after 2pm.

above "func_display("customer/home.tpl",$smarty); " in products.php insert..

Code:
# Assign some delivery dates $i=1; $dayofweek=date("w"); //today as an integer if (date(G)>13) {$i++ ;} // if time (G) past 2pm add day to skip tomorrow while($i<=21) { if (($dayofweek+$i)%7){ // don't include Sundays $smarty->append("del_days", strtotime("+".$i." day")); } $i++; }


In /modules/Product_Options/customer_options.tpl below " {assign var="poname" value="product_options[`$v.classid`]"}{/if} "


Code:
{if $v.class eq "Delivery Date"} <SELECT id="po{$v.classid}" name="{$poname}"> {html_options values=$del_days|date_format:"%A, %b %e" output=$del_days|date_format:"%A, %b %e"} </SELECT> {else}


To get the pulldown to appear for a particular product you need to add a product option as a Text field called 'Delivery Date'.

Should look like this in the product screen...

Click image for larger version

Name:	dates.jpg
Views:	381
Size:	20.1 KB
ID:	496

I'm not the best coder so use at your own risk etc.. Improvements welcome.
__________________
Core version: 5.5.xx
Reply With Quote