Jump to content

Another checkbox in checkout page


Recommended Posts

Hello,

 

I'm using PS 1.4.8.3

 

I need to add another checkbox with validation like terms of service and in the checkout page.You have to click both to proceed with the payment.

I tried to make some modifies but the validation doesn't work.

Can someone help me?

 

The code for the checkbox in order-carrier.tpl should be:

 

 

{literal}
function acceptCGV()
{
if ($('#cgv').length && !$('input#cgv:checked').length)
{
alert(msg);
return false;
}
else
return true;
}
{/literal}

 

 

then 

 

 

 

{if $conditions AND $cms_id}
<h3 class="condition_title">{l s='Terms of service'}</h3>
<p class="checkbox">
<input type="checkbox" name="cgv" id="cgv" value="1" {if $checkedTOS}checked="checked"{/if} />
<label for="cgv">{l s='I agree to the terms of service and adhere to them unconditionally.'}</label> <a href="{$link_conditions}" class="iframe">{l s='(read)'}</a>
</p>
<script type="text/javascript">$('a.iframe').fancybox();</script>
{/if}
 
 
and in order-opc.js
 
// TOS
$('#cgv').click(function() {
if ($('#cgv:checked').length != 0)
var checked = 1;
else
var checked = 0;
 
$('#opc_payment_methods-overlay').fadeIn('slow');
$.ajax({
           type: 'POST',
           url: orderOpcUrl,
           async: true,
           cache: false,
           dataType : "json",
           data: 'ajax=true&method=updateTOSStatusAndGetPayments&checked=' + checked + '&token=' + static_token,
           success: function(json)
           {
$('div#HOOK_TOP_PAYMENT').html(json.HOOK_TOP_PAYMENT);
$('#opc_payment_methods-content div#HOOK_PAYMENT').html(json.HOOK_PAYMENT);
$('#opc_payment_methods-overlay').fadeOut('slow');
           }
       });
});
 
I tried to make some changes but without results :(
 
thank you

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...