X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Delivery Date Chooser (https://forum.x-cart.com/showthread.php?t=32974)

xgarb 08-02-2007 05:00 AM

Delivery Date Chooser
 
1 Attachment(s)
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...

Attachment 496

I'm not the best coder so use at your own risk etc.. Improvements welcome.

DataViking 08-02-2007 05:16 AM

Re: Delivery Date Chooser
 
nice

I will try it

thanks

i4ni 09-26-2007 11:16 PM

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

neroag 10-01-2007 12:24 AM

Re: Delivery Date Chooser
 
Code:

{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 ?

Thanks

chadweston 12-02-2007 05:48 PM

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}';
-->
</script>
{include file="modules/Product_Options/check_options.tpl"}
</td></tr>
{/if}
{foreach from=$product_options item=v}
{if $v.options ne '' || $v.is_modifier eq 'T'}
<tr>
<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`]"}
{else}
{assign var="poname" value="product_options[`$v.classid`]"}

{/if}
{if $v.is_modifier eq 'T'}
<input id="po{$v.classid}" type="text" name="{$poname}" value="{$v.default|escape}" />
{else}
<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>
{/foreach}
</select>
{/if}

</td>
</tr>
{/if}
{/foreach}
{/if}

{if $product_options_ex ne ""}
<tr>
<td colspan="2"><font id="exception_msg" color="red"></font></td>
</tr>
{if $err ne ''}
<tr>
<td colspan="2"><font class="CustomerMessage">{$lng.txt_product_options_ combinations_warn}:</font></td>
</tr>
{foreach from=$product_options_ex item=v}
<tr>
<td>{foreach from=$v item=o}{if $usertype eq "A"}{$o.class}{else}{$o.classtext}{/if}: {$o.option_name}<br />{/foreach}<br /></td>
</tr>
{/foreach}
{/if}
{/if}

TanyaG 06-20-2008 05:12 AM

Re: Delivery Date Chooser
 
Does it work for 4.1.9?

Many thanks,

Learner 10-06-2009 09:43 AM

Re: Delivery Date Chooser
 
Will it work on 4.1.9 and 4.1.11?


All times are GMT -8. The time now is 05:55 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.