When I print a pdf of a particular invoice, I'd like it to include order comments as well. I have no idea what files I need to edit to make this happen.
I tried following the instructions here to no avail.
The last post used the getVisibleStatusHistory method of the order object, but the first comment entered on an order is never visible. There are several methods for grabbing the status history and setting it in the order object.
That being said we might want to list all of the comments that are marked as visible on front-ed and the first comment entered when the order is created. I've substitued your formatting with a "p" tag.
<?php $_history = $order->getAllStatusHistory(); ?> <?php $_buffer = array(); ?> <?php $_i=1; ?> <?php foreach ($_history as $_historyItem): ?> <?php // Ignore the visibility for the first comment ?> <?php if ( $_historyItem->getData('is_visible_on_front') == 1 || $_i == count($_history) ): ?> <?php $_buffer = $_historyItem->getData('comment'); ?> <?php endif; ?> <?php $_i++; ?> <?php endforeach; ?> <?php if ( count($_buffer) > 0 ): ?> <p><?php echo implode( $_buffer, '</p><p>' ); ?></p> <?php endif ?>
You might be able to use this solution that solved my problem.
It requires specific extension and not sure if it works for the version of your Magento, but I think worth trying it?