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)
-   -   Must "Accept terms" before submitting the order (https://forum.x-cart.com/showthread.php?t=20597)

soyuz02 09-13-2006 06:44 AM

Re: Must "Accept terms" before submitting the order
 
Hmm, cant seem to get this to work in 4.1.3. I had it working just fine in my 4.1.1 version but now Ive upgraded and doing all my mods again and I cant get it to work. It just keeps displaying the old way with no checkbox and nothing. Very weird.

My checkout_3_place.tpl

Code:

{* $Id: checkout_3_place.tpl,v 1.8.2.2 2006/08/04 06:07:30 max Exp $ *}

<h3>{$lng.lbl_place_order}</h3>

{capture name=dialog}

<script type="text/javascript">
{literal}
//"Accept terms" form submission- By Dynamic Drive
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="button")
tempobj.disabled=!checkobj.checked
}}}
{/literal}
</script>

{if $config.Appearance.show_cart_details eq "Y" or ($config.Appearance.show_cart_details eq "L" and $smarty.get.paymentid ne "" and $smarty.get.mode eq "checkout")}
{include file="customer/main/cart_details.tpl" link_qty="Y"}
{else}
{include file="customer/main/cart_contents.tpl" link_qty="Y"}
{/if}

<br />
{include file="customer/main/cart_totals.tpl" link_shipping="Y"}
<br /><br />

<form action="{$payment_data.payment_script_url}" method="post" name="checkout_form">
<input type="hidden" name="paymentid" value="{$payment_data.paymentid}" />
<input type="hidden" name="action" value="place_order" />
<table cellpadding="0" cellspacing="0" width="100%">
<tr><td>
{include file="customer/main/subheader.tpl" title=$lng.lbl_personal_information}
<div align="right">{include file="buttons/modify.tpl" href="register.php?mode=update&amp;action=cart&amp;paymentid=`$smarty.get.paymentid`"}</div>

<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="20"><img src="{$ImagesDir}/spacer.gif" width="20" height="1" alt="" /></td>
<td>
{include file="modules/Fast_Lane_Checkout/customer_details_html.tpl"}
</td>
</tr>
</table>

<br /><br />

{include file="customer/main/subheader.tpl" title="`$lng.lbl_payment_method`: `$payment_data.payment_method`"}
{if $ignore_payment_method_selection eq ""}
<div align="right">{include file="buttons/button.tpl" button_title=$lng.lbl_change_payment_method href="cart.php?mode=checkout"}</div>
{/if}

<input type="hidden" name="{$XCARTSESSNAME}" value="{$XCARTSESSID}" />
<script type="text/javascript">
<!--
requiredFields = new Array();
-->
</script>
{include file="check_required_fields_js.tpl"}

<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="20"><img src="{$ImagesDir}/spacer.gif" width="20" height="1" alt="" /></td>
<td>
{if $payment_data.payment_template ne ""}
{capture name=payment_template_output}
{include file=$payment_data.payment_template hide_header="Y"}
{/capture}
{if $smarty.capture.payment_template_output ne ""}
{include file="customer/main/subheader.tpl" title=$lng.lbl_payment_details class="grey"}
{$smarty.capture.payment_template_output}
<br />
{/if}
{/if}

{if $payment_cc_data.cmpi eq 'Y' && $config.CMPI.cmpi_enabled eq 'Y'}
{include file="main/cmpi.tpl"}
{/if}
{include file="customer/main/checkout_notes.tpl"}
</td>
</tr>
</table>

<br />
<input type="hidden" name="payment_method" value="{$payment_data.payment_method_orig}" />
<center>
<input name="agreecheck" type="checkbox" onclick="agreesubmit(this)" /> {$lng.txt_terms_and_conditions_note}

<p />

{if $js_enabled}
{assign var="button_href" value="javascript: "}
{if $config.General.check_cc_number eq "Y" and ($payment_cc_data.type eq "C" or $payment_data.paymentid eq 1 or  ($payment_data.processor_file eq "ps_paypal_pro.php" and $payment_cc_data.paymentid ne $payment_data.paymentid)) and $payment_cc_data.disable_ccinfo ne "Y"}
{assign var="button_href" value=$button_href|cat:"if(checkCCNumber(document.checkout_form.card_number,document.checkout_form.card_type) && checkExpirationDate(document.checkout_form.card_expire_Month,document.checkout_form.card_expire_Year)"}
{if $payment_cc_data.disable_ccinfo ne "C"}
{assign var="button_href" value=$button_href|cat:" && checkCVV2(document.checkout_form.card_cvv2,document.checkout_form.card_type)"}
{/if}
{assign var="button_href" value=$button_href|cat:")"}
{/if}
{assign var="button_href" value=$button_href|cat:" if(checkRequired(requiredFields)) document.checkout_form.submit()"}

{if $payment_data.processor_file eq 'ps_gcheckout.php'}
{include file="buttons/gcheckout.tpl" onclick=$button_href}
{else}
<input type="button" value="{$lng.lbl_submit_order}" onclick="{$button_href}" style="padding: 4px; color: #BD0000; font-weight: bold;" disabled="disabled" />
{/if}

{else}

{if $payment_data.processor_file eq 'ps_gcheckout.php'}
{include file="buttons/gcheckout.tpl"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_submit_order}
{/if}

{/if}
</center>
</td></tr>
</table>
</form>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_payment_details content=$smarty.capture.dialog extra='width="100%"'}


Continued in next post....

soyuz02 09-13-2006 06:45 AM

Re: Must "Accept terms" before submitting the order
 
My checkout.tpl

Code:

{* $Id: checkout.tpl,v 1.70.2.1 2006/07/29 07:27:43 max Exp $ *}
{capture name=checkout_dialog}

<script type="text/javascript">
{literal}
//"Accept terms" form submission- By Dynamic Drive
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="button")
tempobj.disabled=!checkobj.checked
}}}
{/literal}
</script>

<form action="cart.php" method="post" name="cartform">

<input type="hidden" name="cart_operation" value="cart_operation" />

{if $config.Appearance.show_cart_details eq "Y" or ($config.Appearance.show_cart_details eq "L" and $smarty.get.paymentid ne "" and $smarty.get.mode eq "checkout")}
{include file="customer/main/cart_details.tpl"}
{else}
{include file="customer/main/cart_contents.tpl"}
{/if}

<hr noshade="noshade" size="1" /><br />
{include file="customer/main/cart_totals.tpl"}
<br /><br />

{if $js_enabled}
{include file="buttons/update.tpl" href="javascript: document.cartform.submit()" js_to_href="Y"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_update}
{/if}

</form>

{/capture}
{assign var="_dlg_title" value=$lng.lbl_checkout_step_x_of_y|substitute:"X":$checkout_step:"Y":$total_checkout_steps}
{include file="dialog.tpl" title=$_dlg_title content=$smarty.capture.checkout_dialog extra='width="100%"'}
<p />
{if $smarty.get.mode eq "auth"}
{include file="main/error_login_incorrect.tpl"}
{/if}
{if $payment_data.payment_method ne ""}
<h5>{$lng.lbl_payment_method}: {$payment_data.payment_method}</h5>
{capture name=dialog}
<form action="{$payment_data.payment_script_url}" method="post" name="checkout_form">
<input type="hidden" name="paymentid" value="{$payment_data.paymentid}" />
<input type="hidden" name="action" value="place_order" />
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
        <td>

<pre>
{include file="customer/main/customer_details.tpl"}
</pre>

{if $paypal_express_active}
&nbsp;&nbsp;&nbsp;&nbsp;
{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="return"}
{else}
{include file="buttons/modify.tpl" href="register.php?mode=update&action=cart&paymentid=`$smarty.get.paymentid`"}
{/if}

<p />

{if $ignore_payment_method_selection eq ""}
<div align="right">
{include file="buttons/button.tpl" button_title=$lng.lbl_change_payment_method href="cart.php?mode=checkout"}
</div>
{/if}

<input type="hidden" name="{$XCARTSESSNAME}" value="{$XCARTSESSID}" />
<script type="text/javascript">
<!--
requiredFields = new Array();
-->
</script>

{include file="check_required_fields_js.tpl"}

{if $payment_data.payment_template ne ""}
{include file=$payment_data.payment_template}
{/if}

{if $payment_cc_data.cmpi eq 'Y' && $config.CMPI.cmpi_enabled eq 'Y'}
{include file="main/cmpi.tpl"}
{/if}

{include file="customer/main/checkout_notes.tpl"}

<br />
<input type="hidden" name="payment_method" value="{$payment_data.payment_method_orig}" />

<center>
<input name="agreecheck" type="checkbox" onclick="agreesubmit(this)" /> {$lng.txt_terms_and_conditions_note}
</center>

<br /><br />

<center>
{if $js_enabled}
{assign var="button_href" value="javascript: "}
{if $config.General.check_cc_number eq "Y" and ($payment_cc_data.type eq "C" or $payment_data.paymentid eq 1 or  ($payment_data.processor_file eq "ps_paypal_pro.php" and $payment_cc_data.paymentid ne $payment_data.paymentid)) and $payment_cc_data.disable_ccinfo ne "Y"}
{assign var="button_href" value=$button_href|cat:"if(checkCCNumber(document.checkout_form.card_number,document.checkout_form.card_type) && checkExpirationDate(document.checkout_form.card_expire_Month,document.checkout_form.card_expire_Year)"}
{if $payment_cc_data.disable_ccinfo ne "C"}
{assign var="button_href" value=$button_href|cat:" && checkCVV2(document.checkout_form.card_cvv2,document.checkout_form.card_type)"}
{/if}
{assign var="button_href" value=$button_href|cat:")"}
{/if}

<script type="text/javascript">
<!--
var so_click = false;
{literal}
function checkDBClick() {
        if (so_click)
                return false;
        so_click = true;
        return true;
}
{/literal}
-->
</script>

{assign var="button_href" value=$button_href|cat:" if(checkRequired(requiredFields)) if(checkDBClick()) document.checkout_form.submit()"}

{if $payment_data.processor_file eq 'ps_gcheckout.php'}
{include file="buttons/gcheckout.tpl" onclick=$button_href}
{else}
<input type="button" value="{$lng.lbl_submit_order}" onclick="{$button_href}" style="padding: 4px; color: #BD0000; font-weight: bold;" disabled="disabled" />
{/if}

{else}

{if $payment_data.processor_file eq 'ps_gcheckout.php'}
{include file="buttons/gcheckout.tpl"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_submit_order}
{/if}

{/if}
</center>
</td></tr>
</table>
</form>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_payment_details content=$smarty.capture.dialog extra='width="100%"'}

{elseif $payment_methods ne ""}

{capture name=dialog}
<form method="get" action="cart.php" name="checkout_form">
<table align="center" width="400">
{section name=payment loop=$payment_methods}
{if not ($display_cod eq "" and $payment_methods[payment].is_cod eq "Y")}
<tr>
<td><input type="radio" name="paymentid" id="pm{$payment_methods[payment].paymentid}" value="{$payment_methods[payment].paymentid}"{if $payment_methods[payment].is_default eq "1"} checked="checked"{/if} /></td>
{if $payment_methods[payment].processor eq "ps_paypal_pro.php"}
<td colspan="2">
<table cellpadding="0" cellspacing="0"><tr>
<td>{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="logo"}</td>
<td>&nbsp;&nbsp;</td>
<td><label for="pm{$payment_methods[payment].paymentid}">{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="text"}</label></td>
</tr></table>
</td>
{else}
<td nowrap="nowrap" style="padding-left: 15px;"><label for="pm{$payment_methods[payment].paymentid}"><b>{$payment_methods[payment].payment_method}</b></label></td>
<td>{$payment_methods[payment].payment_details|default:"&nbsp;"}</td>
{/if}
</tr>
{/if}
{/section}
</table>
<input type="hidden" name="mode" value="checkout" />
<br />
<div align="center">
{if $js_enabled}
{include file="buttons/continue.tpl" style="button" href="javascript: document.checkout_form.submit()"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_continue}
{/if}
</div>
</form>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_payment_method content=$smarty.capture.dialog extra='width="100%"'}
{/if}


Any help would be greatly appreciated, thanks

Zaja 09-13-2006 07:01 AM

Re: Must "Accept terms" before submitting the order
 
Did you cleaned out the templates_c directory?

soyuz02 09-13-2006 07:10 AM

Re: Must "Accept terms" before submitting the order
 
that was it, thanks :)

soyuz02 09-20-2006 03:32 AM

Re: Must "Accept terms" before submitting the order
 
Is this possible too for the user registration page? Cheers

nft 09-24-2006 06:44 AM

Re: Must "Accept terms" before submitting the order
 
Hi All,
This is a great mod. Only problem I can see is that there is no prompt to accept the terms and conditions when a customer clicks 'Submit Order' without checking the terms and conditions.

Is anyone aware of a mod which gives this prompt?

Thanks

James

Zaja 09-24-2006 06:57 AM

Re: Must "Accept terms" before submitting the order
 
Quote:

Originally Posted by nft
Hi All,
This is a great mod. Only problem I can see is that there is no prompt to accept the terms and conditions when a customer clicks 'Submit Order' without checking the terms and conditions.

Is anyone aware of a mod which gives this prompt?

Thanks

James


Hmm..the basic idea of the "Accept terms" mod is disabling the Submit button until the check box indicate compliance.
So.. how can you click on disabled Submit button without checking the terms and conditions? 8-O

photo 09-24-2006 09:00 AM

Re: Must "Accept terms" before submitting the order
 
Quote:

Originally Posted by nft
Hi All,
This is a great mod. Only problem I can see is that there is no prompt to accept the terms and conditions when a customer clicks 'Submit Order' without checking the terms and conditions.

Is anyone aware of a mod which gives this prompt?

Thanks

James


If you are using 4.1.x version this may work for you, http://forum.x-cart.com/showthread.php?t=24840

massagewear 10-07-2006 01:46 PM

Re: Must "Accept terms" before submitting the order
 
Will this mod work for LiteCommerce as well?



Quote:

Originally Posted by Zaja
http://www.7dana.com/img/I_agree_demo.gif

1. open skin/customer/main/checkout.tpl and add following code after {capture name=checkout_dialog}:
Code:

<script type="text/javascript">
{literal}
//"Accept terms" form submission- By Dynamic Drive
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="button")
tempobj.disabled=!checkobj.checked
}}}
{/literal}
</script>


2. replace:
Code:

{$lng.txt_you_are_agree} "{$lng.lbl_terms_n_conditions}" {$lng.lbl_and} "{$lng.lbl_privacy_statement}".
with:
Code:

<input name="agreecheck" type="checkbox" onclick="agreesubmit(this)" /> {$lng.txt_you_are_agree} "{$lng.lbl_terms_n_conditions}" {$lng.lbl_and} "{$lng.lbl_privacy_statement}".

3. replace:
Code:

{include file="buttons/button.tpl" button_title=$lng.lbl_submit_order style="button" href=$button_href}
with:
Code:

<input type="button" value="{$lng.lbl_submit_order}" onclick="{$button_href}" style="padding: 4px; color: #BD0000; font-weight: bold;" disabled="disabled" />

Thats it! Using this hack, I have reduced the numbers of absurd questions by 30-40%. 8O


nft 10-07-2006 08:44 PM

Re: Must "Accept terms" before submitting the order
 
Hi,
I am not all that familiar with litecommerce, but if the code is the same in Litecommerce as it is with X-Cart then it is worth a try. Certainly no harm in having a look at the code and giving it a try.

James


All times are GMT -8. The time now is 09:14 PM.

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