Jump to content

Disable Ajax For Terms Of Service?


theillo

Recommended Posts

Hey there

 

I am using One Page Checkout, and only sell Virtual Products. I want Terms of Service to show up, but I also want the Payment methods to show up, even when the TOS are not checked.

 

I got this in my theme, should be pretty standard: 

<!-- TOS -->
{if $conditions AND $cms_id}
	<b>{l s='Terms of service'}</b>
	<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 and conditions.'}</label>
		<a href="{$link_conditions|escape:'html':'UTF-8'}" class="iframe" rel="nofollow">{l s='(Read the Terms and Conditions)'}</a>
	</p>
{/if}		
<!-- END TOS -->			

And this is what my HTML does:

<div id="opc_payment_methods-content">
  <div id="HOOK_PAYMENT">
   <p class="warning">Please accept the Terms of Service.</p>
  </div>
</div>

Of course once the box for TOS is checked, this p tag disappears, and the actual payment methods show up.

 

But there is a gigantic lag between checking the box and the Payment methods showing up, so I just want to disable this.

 

 

My question:

 

Where is the Javascript that makes the Payment methods appear on AJAX? 

 

 

Edited by theillo (see edit history)
Link to comment
Share on other sites

Okay I found the file...:

 

theme/js/order-opc.js

 

And then there's

function updatePaymentMethodsDisplay()
{
	var checked = '';
	 if ($('#cgv:checked').length !== 0)
		 checked = 1;
	 else
		 checked = 0;
	
	$('#opc_payment_methods-overlay').fadeIn('slow', function(){
		$.ajax({
			type: 'POST',
			headers: { "cache-control": "no-cache" },
			url: orderOpcUrl + '?rand=' + new Date().getTime(),
			async: true,
			cache: false,
			dataType : "json",
			data: 'ajax=true&method=updateTOSStatusAndGetPayments&checked=' + checked + '&token=' + static_token,
			success: function(json)
			{
				updatePaymentMethods(json);
				if (typeof bindUniform !=='undefined')
					bindUniform();
			}
		});
		$(this).fadeOut('slow');		
	});
}

I tried tricking this into thinking that checked is always =1, but it didn't help... ?! :huh2:

Edited by theillo (see edit history)
  • Like 1
Link to comment
Share on other sites

Well, I ended up turning TOS off, and instead using the displayPaymentTop Hook to show a little message "by submitting your payment, you agree to the TOS" and then a link to them. Of course I had to get a config page for my module, where you can chose which CMS page should be displayed.

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