Site maintenance: Sun 15 Nov, from 20:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / Display terms and conditions if an order is from a particular country

Display terms and conditions if an order is from a particular country

Started by badarac on 11 Apr 2013, 7:00 PM · Views: 573

Results 1 to 2 of 2
11 Apr 2013, 7:00 PM
#1
badarac avatar

badarac

Totally Zenned

Join Date:
Aug 2009
Location:
Longs, SC
Posts:
635
Plugin Contributions:
0

Display terms and conditions if an order is from a particular country

I want to display terms and conditions which a customer must agree to during checkout. These terms relate to international shipping and only apply if the ship to country is not the US. Since I wasn't using the built in terms and conditions regulation I thought this would be almost perfect. I was able to modify the code so that it only built the terms and conditions radio box if the country code didn't equal 223. That works perfectly when it's an international order but if it's an order from the US I get a message that the terms weren't agreed to and get redirected back to the payment page. Any idea how to get around this?

12 Apr 2013, 4:49 PM
#2
badarac avatar

badarac

Totally Zenned

Join Date:
Aug 2009
Location:
Longs, SC
Posts:
635
Plugin Contributions:
0

Re: Display terms and conditions if an order is from a particular country

I wanted to document what needed to change in case anybody else ever wants to do this. I includes/modules/pages/checkout_confirmation/header_php.php make the following changes: find the following code around line 54:```php
if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') {
if (!isset($_POST['conditions']) || ($_POST['conditions'] != '1')) {
$messageStack->add_session('checkout_payment', ERROR_CONDITIONS_NOT_ACCEPTED, 'error');
}
}
//echo $messageStack->size('checkout_payment');

require(DIR_WS_CLASSES . 'order.php');
$order = new order;

Change it to this:
```php
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
if ((DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') && ($order->delivery['country']['id'] != 223)) {
  if (!isset($_POST['conditions']) || ($_POST['conditions'] != '1')) {
    $messageStack->add_session('checkout_payment', ERROR_CONDITIONS_NOT_ACCEPTED, 'error');
  }
}

Make the following changes to includes/templates/YOUR CUSTOM TEMPLATE FOLDER/templates/tpl_checkout_payment_default.php around line 26 from ```php

<?php if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') { ?> <fieldset> <legend><?php echo TABLE_HEADING_CONDITIONS; ?></legend> <div><?php echo TEXT_CONDITIONS_DESCRIPTION;?></div> <?php echo zen_draw_checkbox_field('conditions', '1', false, 'id="conditions"');?> <label class="checkboxLabel" for="conditions"><?php echo TEXT_CONDITIONS_CONFIRM; ?></label> </fieldset> <?php } ?> ``` to: ```php if ((DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') && ($order->delivery['country']['id'] != 223)) { ?> <fieldset> <legend><?php echo TABLE_HEADING_CONDITIONS; ?></legend> <div><?php echo TEXT_CONDITIONS_DESCRIPTION;?></div> <?php echo zen_draw_checkbox_field('conditions', '1', false, 'id="conditions"');?> <label class="checkboxLabel" for="conditions"><?php echo TEXT_CONDITIONS_CONFIRM; ?></label> </fieldset> <?php }

?>