Magento Payment Info Block

Magento Payment Info Block

August 21, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento Payment Info Block

Displaying Custom Payment Details in Magento Without Database Storage

As an experienced Magento developer working for Laravel Company, I often encounter requests to display additional payment information without saving it to the database. This allows us to maintain the standard look and feel of the admin area while providing a more personalized checkout experience.

In your scenario, you’ve created a custom payment method that requires additional data like Name, Person Age, Profit, Credit Term, etc., which is sent directly to the bank. To display this information in the Payment Method info block without storing it in the database, you can follow these steps:

Step 1: Storing Data in Core Session

You’re already on the right track by using Magento’s core/session to temporarily store the additional payment data. In your Payment Model (OS_LacPayCS_Model_Payment), include a method like assignData() which saves the session data as shown below:

class OS_LacPayCS_Model_Payment extends Mage_Payment_Model_Method_Abstract
{
    ...
    public function assignData($data)
    {
        parent::assignData($data);
        $session = Mage::getSingleton('core/session');
        $session->setData('payment_additional', $data);
        return $this;
    }
    ...
}

Step 2: Retrieving Data in Payment Info Block

Next, create a custom Payment Info block (OS_LacPayCS_Block_Payment_Info) that retrieves the session data:

class OS_LacPayCS_Block_Payment_Info extends Mage_Payment_Block_Info
{
    ...
    public function getPaymentInfo()
    {
        $session = Mage::getSingleton('core/session');
        return $session->getData('payment_additional');
    }
    ...
}

Step 3: Displaying the Data

To display this data in the Payment Method info block, you’ll need to create a custom template. In your theme folder (app/design/frontend/your_package/your_theme/template/payment/info), create a new file named info_os_lacpaycs.phtml. Inside it, use PHP logic to loop through and display the additional fields:

<?php if ($this->getPaymentInfo()): ?>
    <h4><?php echo $this->__('Additional Payment Details') ?></h4>
    <?php foreach ($this->getPaymentInfo() as $field => $value): ?>
        <p><strong><?php echo $field ?>:</strong> <?php echo $value ?></p>
    <?php endforeach; ?>
<?php endif; ?>

Step 4: Adding Additional Rows to Order Review Tab

To add additional rows in the Order Review tab during checkout without rewriting the template or block, you can use the observer pattern.

Create a new module (e.g., OS_LacPayCS) with an Observer that modifies the order review block:

class OS_LacPayCS_Model_Observer
{
    public function addAdditionalRowsToReview($observer)
    {
        $block = $observer->getBlock();
        if ($block instanceof Mage_Checkout_Block_Onepage_Totals) {
            $additionalRows = [
                ['title' => 'Name', 'value' => 'John Doe'],
                ['title' => 'Person Age', 'value' => '30'],
                // Add more rows as needed
            ];

            foreach ($additionalRows as $row) {
                $block->addTotal($row, 'subtotal');
            }
        }
    }
}

Don’t forget to configure the observer in your module’s etc/config.xml:

<config>
    <global>
        <events>
            <checkout_onepage_totals</events>
            <observers>
                <os_lacpaycs_additional_rows_to_review>
                    <type>singleton</type>
                    <class>OS_LacPayCS_Model_Observer</class>
                    <method>addAdditionalRowsToReview</method>
                </os_lacpaycs_additional_rows_to_review>
            </observers>
        </events>
    </global>
</config>

Remember to clear your cache after making these changes.

By following this approach, you can display additional payment information without cluttering the admin area or modifying core files. This ensures a clean and maintainable codebase while providing the desired user experience during checkout.

Checkout Database Admin

Our network