I have 3 Terms and Conditions for checkout process. All 3 T&C are just checkboxes because I did some changes in template hiding the content box. By default Magento is listing the terms one after other based on their ID's. Did anyone change the module inserting in checkout_agreement table a new field called position and let Magento sorting by it?

  • Upvoted because sounds like i missing feature, that I also would use ... full code comes tomorrow (if i have some time for it :) )
    – sv3n
    Commented May 13, 2017 at 20:45
  • I agree it is a feature missing. Imagine having lots of terms how you order them in checkout. For example I am asking customers to check the boxes for many things being legal. I am still editing ID's to re-order the terms.
    – ADDISON74
    Commented May 15, 2017 at 9:47
  • Another thing which is missing, wysiwyg editor is not working for editing content in html. This can be activate in /Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php $fieldset 'content', wysiwyg = true.
    – ADDISON74
    Commented May 15, 2017 at 9:48
  • One more thing I did for good is making content required => false. In this way the database is filled in with NULL then in agreement template I can evaluate if content is NULL not showing the html code. Sometimes you couldn't have content for all terms (my case).
    – ADDISON74
    Commented May 15, 2017 at 9:50

1 Answer 1


Here we go ...



/** @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$installer = $this;

if (version_compare(Mage::getVersion(), '1.6', '<')) {
        ALTER TABLE `{$installer->getTable('checkout/agreement')}`
        ADD `position` SMALLINT( 2 ) NOT NULL COMMENT 'Agreement Position'

} else {
            'type'      => Varien_Db_Ddl_Table::TYPE_SMALLINT,
            'length'    => 2,
            'nullable'  => false,
            'default'   => 0,
            'comment'   => 'Agreement Position'



<?xml version="1.0"?>



class Sr_AgreementPosition_Model_Observer
     * Add "Postion" to Checkout Agreements
    public function addAgreementsPosition(Varien_Event_Observer $observer)
        $block = $observer->getEvent()->getBlock();
        if ($block instanceof Mage_Adminhtml_Block_Checkout_Agreement_Edit_Form) {
            $helper = Mage::helper('sr_agreement');
            $form = $block->getForm();


            /** @var Varien_Data_Form_Element_Fieldset $fieldset */
            $fieldset = $form->getElement('base_fieldset');

            $fieldset->addField('position', 'text', array(
                'label'    => $helper->__('Position'),
                'title'    => $helper->__('Position'),
                'name'     => 'position',
                'value'    => '0',
                'class'    => 'validate-zero-or-greater',

            $model = Mage::registry('checkout_agreement');

        return $this;

     * Sort agreements
    public function sortAgreements(Varien_Event_Observer $observer)
        $block = $observer->getEvent()->getBlock();
        if ($block->getType() == 'checkout/agreements') {
            if ($agreements = $block->getAgreements()) {
                $agreements->setOrder('position', Varien_Data_Collection::SORT_ORDER_ASC);

                $collection = new Varien_Data_Collection();
                foreach ($agreements as $agreement) {

        return $this;

Didn't post helper and modules xml ... download here: https://github.com/sreichel/magento-Sr-AgreementPosition

Note: If you find issues please open a ticket at Github.

Edit: making content optional is just a one liner in observer and will be added later (no more time now)

  • I appreciate for your help. I will test your solution and coming back with impressions. I have a long list of Magento 1 issues which are not resolved yet, same like this one. Bug Tracker is not working at all for Magento 1 and I don't like this. I will follow your advice related to reporting, I have the same nickname in Github.
    – ADDISON74
    Commented May 15, 2017 at 18:37
  • If you had told me, that you are using Firegento_MageSetup, i had just made this only PR there, instead of creatinge a standalone module :P For your long list of issues ... this one is more a missing feature request, but if you know "real" bugs - or things that affect should be imporved for everybody - you can open a ticket here: github.com/OpenMage/magento-lts Btw ... i've already seen you add github :P
    – sv3n
    Commented May 15, 2017 at 20:08
  • I've updated code at github and add missing fields validation.
    – sv3n
    Commented May 17, 2017 at 8:32
  • Please update the code for making content optional too. Of course when you have some time. In this way we can implement the whole solution. Any thoughts why wysiwyg editor is not working for content if set to true in php file?
    – ADDISON74
    Commented May 17, 2017 at 15:39
  • I'll add optional content later .... but i'll not add WYSIWYG for now, b/c i'm not sure if all filters (for widgets etc. will work correctly ther - and i dont like this editor in general. Shouldn't be too hard to write some basic HTML for terms & conditions ... ;) ) I'll leave a comment ASAP.
    – sv3n
    Commented May 17, 2017 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.