I try to disable the 5th step in the checkout process and it seems to work fine - except one thing.
To do this i've followed partially this post viewtopic.php?t=139023 for the checkout.tpl with additional changes in the controller. Then i've placed the "agree" parts from the controller (payment_method.php) and from the view (payment_method.tpl) in the confirm.php and confirm.tpl. Everything works.
Now my problem: The order is successful even without the checked agree-checkbox. Eventually the shop recognize the already checked checkbox in the step 4. This modification was necessary to pass this step. Where can i insert or find the control mechanism of this checkbox?
I've tried to rename the value of the checkbox but without success. Any idea?
Here the last steps from the confirm.tpl:
Code: Select all
<?php foreach ($totals as $total) { ?>
<tr>
<td colspan="4" class="text-right"><strong><?php echo $total['title']; ?>:</strong></td>
<td class="text-right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
</tfoot>
</table>
</div>
<!-- AGREE PART FROM PAYMENT_METHOD -->
<?php if ($text_agree) { ?>
<div class="pull-right"><?php echo $text_agree; ?>
<?php if ($agree) { ?>
<input type="checkbox" name="agree" value="0" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="agree" value="0" />
<?php } ?>
</div>
</div>
<?php } ?>
</br>
<!-- AGREE END --->
<?php echo $payment; ?>
<?php } else { ?>
<script type="text/javascript"><!--
location = '<?php echo $redirect; ?>';
//--></script>
<?php } ?>
Here the already checked position in the payment_method.tpl:
Code: Select all
<?php if ($agree) { ?>
<input type="checkbox" name="agree" value="1" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="agree" value="1" checked="checked"/> <!-- checked="checked" to skip the controlling -->
<?php } ?>
And here the additional parts at the end in the confirm.php of the controller:
Code: Select all
/* AGREE FUNCTION */
$data['scripts'] = $this->document->getScripts();
if ($this->config->get('config_checkout_id')) {
$this->load->model('catalog/information');
$information_info = $this->model_catalog_information->getInformation($this->config->get('config_checkout_id'));
if ($information_info) {
$data['text_agree'] = sprintf($this->language->get('text_agree'), $this->url->link('information/information/agree', 'information_id=' . $this->config->get('config_checkout_id'), true), $information_info['title'], $information_info['title']);
} else {
$data['text_agree'] = '';
}
} else {
$data['text_agree'] = '';
}
if (isset($this->session->data['agree'])) {
$data['agree'] = $this->session->data['agree'];
} else {
$data['agree'] = '';
}
if ($this->config->get('config_checkout_id')) {
$this->load->model('catalog/information');
$information_info = $this->model_catalog_information->getInformation($this->config->get('config_checkout_id'));
if ($information_info && !isset($this->request->post['agree'])) {
$json['error']['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
}
}
if (!$json) {
$this->session->data['confirm'] = $this->session->data['confirm'][$this->request->post['confirm']];
$this->session->data['comment'] = strip_tags($this->request->post['comment']);
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
/* AGREE END */
$this->response->setOutput($this->load->view('checkout/confirm', $data));
}
}