Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Delivery Date Chooser

   X-Cart forums > X-Cart 4 > Dev Questions
Thread Tools Search this Thread
Old 08-02-2007, 05:00 AM
xgarb xgarb is offline

Join Date: Jul 2004
Location: UK
Posts: 262

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..

# 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} "

{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:	288
Size:	20.1 KB
ID:	496

I'm not the best coder so use at your own risk etc.. Improvements welcome.
Core version: 5.3.xx
PHP: 5.6
MySQL: 5.5.50-cll
Web server: Apache
Reply With Quote
Old 08-02-2007, 05:16 AM
  DataViking's Avatar 
DataViking DataViking is offline

Join Date: Jan 2003
Location: Las Vegas, NV
Posts: 361

Default Re: Delivery Date Chooser


I will try it

Web Design Web Design and Custom X-Cart Projects

Mention the forums for discounts!
x-cart Version 4.1.8
Reply With Quote
Old 09-26-2007, 11:16 PM
i4ni i4ni is offline

Join Date: Apr 2007
Posts: 1

Thumbs up Re: Delivery Date Chooser

Thanks for sharing that, it was exactly what i was after.

I managed to get it working on the 'personal details' section of the cart so that a user can choose the shipping date whilst entering the shipping info by using an 'additional field' in the 'user profile option' section of admin
Reply With Quote
Old 10-01-2007, 12:24 AM
neroag neroag is offline

Senior Member
Join Date: May 2005
Location: UK
Posts: 171

Default Re: Delivery Date Chooser

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

Nice Mod,
I have it all working apart from it actually appearing on the invoice.
When i select the date from the drop down options it doesnt copy the selected option into the text field, is there a way to get the selected date to populate the Text field called 'Delivery Date'

Can anyone help out ?

X-cart Gold - 4.0.18 - 4.1.9 - 4.1.10 - 4.3.0
Reply With Quote
Old 12-02-2007, 05:48 PM
chadweston chadweston is offline

Join Date: Oct 2007
Location: Nottingham, UK
Posts: 14

Default Re: Delivery Date Chooser

Wow, I just found this modification and am trying to use it in 4.1.8. I seem to get errors if I insert the code above into the customer_options.tpln as specified.
I am just a web designer and not much of a code monkey, so can you please advise as to how it fits into this code.
Many Thanks

{* $Id: customer_options.tpl,v 1.24 2006/04/07 05:19:21 svowl Exp $ *}
{if $product_options ne ''}
{if $nojs ne 'Y'}
<tr style="display: none;"><td>
<script type="text/javascript" language="JavaScript 1.2">
var alert_msg = '{$alert_msg}';
{include file="modules/Product_Options/check_options.tpl"}
{foreach from=$product_options item=v}
{if $v.options ne '' || $v.is_modifier eq 'T'}
<td valign="middle" height="25">{if $usertype eq "A"}{$v.class}{else}{$v.classtext|default:$v.class }{/if}</td>
<td valign="middle">
{if $cname ne ""}
{assign var="poname" value="$cname[`$v.classid`]"}
{assign var="poname" value="product_options[`$v.classid`]"}

{if $v.is_modifier eq 'T'}
<input id="po{$v.classid}" type="text" name="{$poname}" value="{$v.default|escape}" />
<select id="po{$v.classid}" name="{$poname}"{if $disable} disabled="disabled"{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}>
{foreach from=$v.options item=o}
<option value="{$o.optionid}"{if $o.selected eq 'Y'} selected="selected"{/if}>{$o.option_name}{if $v.is_modifier eq 'Y' && $o.price_modifier ne 0} ({if $o.modifier_type ne '%'}{include file="currency.tpl" value=$o.price_modifier display_sign=1 plain_text_message=1}{else}{$o.price_modifier}%{/if}){/if}</option>


{if $product_options_ex ne ""}
<td colspan="2"><font id="exception_msg" color="red"></font></td>
{if $err ne ''}
<td colspan="2"><font class="CustomerMessage">{$lng.txt_product_options_ combinations_warn}:</font></td>
{foreach from=$product_options_ex item=v}
<td>{foreach from=$v item=o}{if $usertype eq "A"}{$o.class}{else}{$o.classtext}{/if}: {$o.option_name}<br />{/foreach}<br /></td>
Welcome to my world !!
(I use version 4.1.
Reply With Quote
Old 06-20-2008, 05:12 AM
TanyaG TanyaG is offline

Advanced Member
Join Date: Nov 2007
Posts: 94

Default Re: Delivery Date Chooser

Does it work for 4.1.9?

Many thanks,

x-cart version: 4.1.7 4.1.9. 4.2
Reply With Quote
Old 10-06-2009, 09:43 AM
Learner Learner is offline

Join Date: Dec 2008
Posts: 807

Default Re: Delivery Date Chooser

Will it work on 4.1.9 and 4.1.11?
4.6.1 Platinum

Reply With Quote
   X-Cart forums > X-Cart 4 > Dev Questions

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -8. The time now is 12:29 AM.


X-Cart forums © 2001-2020