I am working to print multiple order once. I have used the following code to get order email html section.

foreach($orderIds as $orderId):

    $order = Mage::getModel('sales/order')->load($orderId);
    Mage::register('current_order', $order);

    echo $this->getChildHtml('sales.order.print');

But If I have multiple orders it repeats every time. but showing the same order. Every time same Child HTML loading, not changing dynamically. My question is how to load child block dynamically with changed value every time.

1 Answer 1


You get the same order for all the cases because the children html is 'cached' in a member variable. See how the Mage_Core_Block_Abstract::_getChildHtml() method looks like (that one is called by getChildHtml).
To get the new html each time you need to transform this line:

echo $this->getChildHtml('sales.order.print');

into this one:

echo $this->getChildHtml('sales.order.print', false);

The second parameter means the content is not cached, and it's recreated each time.

  • @Great Marius .. Thanks a lot .. saved my day Commented Jul 29, 2013 at 13:07
  • Also saved my day, cheers Commented Dec 3, 2015 at 11:37

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.