Terms and condition depends on usergroups?

  • Posts: 152
  • Thank you received: 11
11 years 5 months ago #73326

We have created some user groups and categorizes existing customers in these.
Is it possible that you can set the shop so that only the individual user to accepetere terms and condition when they purchase?

/EDIT: have placed this topic in a wrong category..


I'm using firebug, forumsearch, dokumentation and then I ask.. It's so easy ;)
Last edit: 11 years 5 months ago by holm76.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #73393

Hi,

You can try to edit the view "checkout / terms" and use this code:

<div id="hikashop_checkout_terms" class="hikashop_checkout_terms">
<?php
	$user =& JFactory::getUser();
	$individual = 1;
	foreach($user->groups as $group){
		if($group != '8'){
			$individual = 0;
		}
	}
	if($individual){
?>
	<input class="hikashop_checkout_terms_checkbox" id="hikashop_checkout_terms_checkbox" type="checkbox" name="hikashop_checkout_terms" value="1" <?php echo $this->terms_checked; ?> />
<?php
	}
		$text = JText::_('PLEASE_ACCEPT_TERMS_BEFORE_FINISHING_ORDER');
		$terms_article = $this->config->get('checkout_terms');
		if(!empty($terms_article)){
			JHTML::_('behavior.modal');
			$text = '<a href="'.JRoute::_('index.php?option=com_content&view=article&id='.$terms_article.'&tmpl=component').'" class="modal" rel="{handler: \'iframe\', size: {x: 450, y: 480}}" target="_blank">'.$text.'</a>';
		}
	?>
	<label for="hikashop_checkout_terms_checkbox"><?php echo $text; ?></label>
</div>
<?php
	if(!$individual){
		?>
		<input class="hikashop_checkout_terms_checkbox" id="hikashop_checkout_terms_checkbox" type="checkbox" name="hikashop_checkout_terms" value="1" <?php echo $this->terms_checked; ?> />
		<script type="text/javascript">
			document.getElementById('hikashop_checkout_terms').style.display = 'none';
			document.getElementById('hikashop_checkout_terms_checkbox').style.display = 'none';
		</script>
		<?php
	}
?>

Change the number '8' by the id of your individual group.

Last edit: 11 years 5 months ago by Xavier.

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

  • Posts: 152
  • Thank you received: 11
11 years 5 months ago #74111

what if I have more groups, is it then with commas between or how to do


I'm using firebug, forumsearch, dokumentation and then I ask.. It's so easy ;)

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #74243

Hi,

In the "if" condition you can add more group id like in this example:

if($group != '8' && $group != '9' && ...){

The following user(s) said Thank You: holm76

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

  • Posts: 152
  • Thank you received: 11
11 years 5 months ago #74498

Hello
I have now made ​​the changes you propose. It works when checkbox is no longer visible. But when I test a purchase with it, the system will still have to be checked. The field is no longer displayed and therefore I can not continue ..

Is it possible to remove this?


I'm using firebug, forumsearch, dokumentation and then I ask.. It's so easy ;)

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #74542

Instead of

$group != '8' && $group != '9'

Can you try:
$group == '8' || $group == '9'

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

  • Posts: 152
  • Thank you received: 11
11 years 5 months ago #75060

I have made the proposed amendment and at first glance it seems.
but maybe not, when I would go further payment is not checked (set it to the invoice) and when I feel it in the radiobuton, says that I must accept the terms


I'm using firebug, forumsearch, dokumentation and then I ask.. It's so easy ;)

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #75242

Hi,

try to replace:

	if(!$individual){
		?>
		<input class="hikashop_checkout_terms_checkbox" id="hikashop_checkout_terms_checkbox" type="checkbox" name="hikashop_checkout_terms" value="1" <?php echo $this->terms_checked; ?> />
By:
	if(!$individual){
		?>
		<input class="hikashop_checkout_terms_checkbox" id="hikashop_checkout_terms_checkbox" type="checkbox" name="hikashop_checkout_terms" value="1" checked="checked" />

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

Time to create page: 0.076 seconds
Powered by Kunena Forum