Accept terms checked by default

  • Posts: 317
  • Thank you received: 17
  • Hikashop Business
8 years 1 month ago #251519

-- HikaShop version -- : 2.6.4

Can be configured that is check box for terms and conditions, checked by default?
If not, how to override?

Please Log in or Create an account to join the conversation.

  • Posts: 200
  • Thank you received: 75
8 years 1 month ago #251548

Hi,

there doesn't seem to be an option for that, but you can override it by going to "Display -> Views".
Select the view "checkout" and your template, there you will find the view "terms" where the input box is defined on line 11:

<input class="hikashop_checkout_terms_checkbox" id="hikashop_checkout_terms_checkbox" type="checkbox" name="hikashop_checkout_terms" value="1" <?php echo $this->terms_checked; ?> />

You could replace the part <?php echo $this->terms_checked; ?> by checked="checked", then the checkbox will always be checked.

Hikashop actually stores this setting whether the terms are checked in the user's session so that if a user goes to another page and comes back to the terms, it will remember whether the box was checked or not, which it won't with the above solution. So if you want to remember the user's setting (which is probably not that important in this case since the user needs to accept the terms anyway to continue) but you could, instead of forcing the checkbox, set the session variable by adding something like this before line 11:
<?php
$app = JFactory::getApplication();
if($app->getUserState( HIKASHOP_COMPONENT.'.checkout_terms')===null){
	$app->setUserState(HIKASHOP_COMPONENT.'.checkout_terms',1);
	$this->terms();
}
?>

Hope this helps. Kind regards,

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
8 years 1 month ago #251581

Hi,

Hmm, what i did i added this:

checked="checked"

inside input and it does the job.

So question for u GW. What is the difference?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 200
  • Thank you received: 75
8 years 1 month ago #251586

Hi,

Hikashop stores the value of the T&C checkbox in the user session (so whether it is checked or not).
This means if a user unchecks the T&C, goes to another page, and then comes back to the T&C, it will remember the setting from before and the checkbox will still be unchecked.

If you use checked="checked" however, it will simply always be checked and you don't use the remembered state anymore. So in the above situation, if a user unchecks the T&C, goes to another page, comes back, it will be checked again (even though the user last unchecked it).
Like I said, probably not a problem for many, since by default the T&C need to be checked to be able to continue with the checkout, but just thought I would give that solution for completeness.

Kind regards,

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
8 years 1 month ago #251587

I see now. Thanks for explanation.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum