2

I'm struggling to make my custom checkbox a required on the onepage checkout page in the order review step (last step)

i have added my code in

app/design/frontend/base/default/template/checkout/onepage/agreements.phtml

<?php $storeCode = Mage::app()->getStore()->getCode();?>
    <?php if($storeCode == "uk" || $storeCode == "eu" || $storeCode == "au" || $storeCode == "usa" || $storeCode == "nz"):?>

<br>
<form action="" onsubmit="return false;">
<p><input type="checkbox" id="field_terms" required name="terms"><strong style="padding-left: 7px;">Prices shown do not include any local duties or taxes. Carrol Boyes is not liable for these costs that may be charged by local customs and duties offices.</strong></p>

</form>

<br>
<?php endif;?>

<?php if (!$this->getAgreements()) return; ?>
<form action="" id="checkout-agreements" onsubmit="return false;">
<ol class="checkout-agreements">
<?php foreach ($this->getAgreements() as $_a): ?>
    <li>
        <div class="agreement-content"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
            <?php if ($_a->getIsHtml()):?>
                <?php echo $_a->getContent() ?>
            <?php else:?>
                <?php echo nl2br($this->escapeHtml($_a->getContent())) ?>
            <?php endif; ?>
        </div>
        <p class="agree">
            <input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->escapeHtml($_a->getCheckboxText()) ?>" class="checkbox" /><label for="agreement-<?php echo $_a->getId()?>"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->escapeHtml($_a->getCheckboxText()) ?></label>
        </p>
    </li>
<?php endforeach ?>
</ol>
</form>

See my screenshot below showing the checkbox on the checkout page, but i'm stuck as i need this box required and customers can't place the order without this box checked, it's working fine on the agreement checkbox

can someone please shade me some light as to what i need to do in order to accomplished this

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.