Magento 1.8 – Get Content of Terms and Conditions by URL

geturlmagento-1.8

I know this is how you get the content of Terms and Condition,

<?php if (!$this->getAgreements()) return; ?>
<form action="" id="checkout-agreements" onsubmit="return false;">
<ol>
<?php foreach ($this->getAgreements() as $_a): ?>
    <li>
        <div id="agreement-block-<?php echo $_a->getId();?>" class="agreement-content <?php if (Mage::helper('opc')->getTermsType()):?>hidden<?php endif?>"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
            <?php if ($_a->getIsHtml()):?>
                <?php echo $_a->getContent() ?>
            <?php else:?>
                <?php echo nl2br($this->htmlEscape($_a->getContent())) ?>
            <?php endif; ?>
        </div>
        <div class="form-group checkbox">
            <label>
                <input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->htmlEscape($_a->getCheckboxText()) ?>" />
                <a class="button-cart-simple button-agreement" data-id="<?php echo $_a->getId();?>" data-toggle="modal" data-target="#myModal"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->htmlEscape($_a->getCheckboxText()) ?></a>
            </label>
        </div>
    </li>
<?php endforeach ?>
</ol>
</form>

But can I access this page by using URL?

Best Answer

There is no page to display the agreements. They appear in the checkout.
But you can create one.
Create a static page with this content.

{{block type="core/template" template="agreements/list.phtml"}}

Then create the template file agreements/list.phtml in your theme with this content:

<?php $agreements = Mage::getModel('checkout/agreement')->getCollection()
                    ->addStoreFilter(Mage::app()->getStore()->getId())
                    ->addFieldToFilter('is_active', 1); ?>

<?php if ($agreements->count()) : ?>
<form action="" id="checkout-agreements" onsubmit="return false;">
<ol>
<?php foreach ($agreements as $_a): ?>
    <li>
        <div id="agreement-block-<?php echo $_a->getId();?>" class="agreement-content <?php if (Mage::helper('opc')->getTermsType()):?>hidden<?php endif?>"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
            <?php if ($_a->getIsHtml()):?>
                <?php echo $_a->getContent() ?>
            <?php else:?>
                <?php echo nl2br($this->htmlEscape($_a->getContent())) ?>
            <?php endif; ?>
        </div>
        <div class="form-group checkbox">
            <label>
                <input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->htmlEscape($_a->getCheckboxText()) ?>" />
                <a class="button-cart-simple button-agreement" data-id="<?php echo $_a->getId();?>" data-toggle="modal" data-target="#myModal"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->htmlEscape($_a->getCheckboxText()) ?></a>
            </label>
        </div>
    </li>
<?php endforeach ?>
</ol>
</form>
<?php endif;?>

You can adjust the markup if needed.
Then just view the page like any other cms page.