Make the Shopping Cart date uneditable

Modifies the standard Date Prompt to open an interactive calendar in a small overlay.
Post Reply
Site Admin
Posts: 1248
Joined: Sat Feb 07, 2004 9:55 pm

Make the Shopping Cart date uneditable

Post by norman »

This is for Datepicker V1.12 and earlier. Datepicker V1.13 now has a setting to enable / disable this.

To amend the Cart display so that the customer cannot tinker with the date in the Cart.
Here are 2 methods:

1) jQuery way that avoids patching Perl Scripts:

Go to Design / Library / Layouts / JavaScript Header Functions / Standard Javascript Header Functions.
Scroll to the bottom and add the following code:

Code: Select all

<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Shopping%20Cart%22" >
	<script type="text/javascript">
		$(document).ready(function (){
			$( "select[name^='DAY_'] option:not(:selected)" ).prop('disabled', true);
			$( "select[name^='M_'] option:not(:selected)" ).prop('disabled', true);
			$( "select[name^='Y_'] option:not(:selected)" ).prop('disabled', true);

2) By patching a Perl script:

Edit file (in your Site folder - back it up first).

Look for the lines (searching for the first line below will get you there):

Code: Select all

				$sDay 	= ACTINIC::GenerateComboHTML("DAY_$nLineCount", $sDay, "%2.2d", $sStyle, (1..31));
				$sMonth	= ACTINIC::GenerateComboHTML("M_$nLineCount", $sMonth, "%s", $sStyle, @::gMonthList);
				if ($nMinYear == $nMaxYear)					# if the date range is only one year, the we generate a static text instead of year combo
					$sYear = "$nMinYear<INPUT TYPE=HIDDEN NAME=\"Y_$nLineCount\" VALUE=\"$nMinYear\">"
					$sYear 	= ACTINIC::GenerateComboHTML("Y_$nLineCount", $sYear, "%4.4d", $sStyle, ($nMinYear..$nMaxYear)); # add the year drop down list

Replace them with:

Code: Select all

				$sDay 	= "$sDay<INPUT TYPE=HIDDEN NAME=\"DAY_$nLineCount\" VALUE=\"$sDay\">";
				$sMonth	= "$sMonth<INPUT TYPE=HIDDEN NAME=\"M_$nLineCount\" VALUE=\"$sMonth\">";
				$sYear 	= "$sYear<INPUT TYPE=HIDDEN NAME=\"Y_$nLineCount\" VALUE=\"$sYear\">";

Remember that you will have to re-do this if you update SellerDeck to a new version.
Post Reply