Hello,
I've looked at the super_invoice code that relates to displaying comments. I noticed that the code first retrieves all comments linked to an order [1], but then only checks the first comment [2] if its empty or not to decide whether comments should be displayed.
For an order i just generated the first comment is empty, and the second (admin generated) comment has text. Unfortunately, due to [2] the text does not get displayed. Also, the $customer_note assignment in [2] suggests that only one comment exists and is displayed.
In my humble opinion this section of code needs to be rewritten. I would probably remove [2] altogether and instead create a loop at the end (instead of the if [3] that checks for $display_notes=1, and display all comments that are non empty.
Did i misunderstand something here? Or, do my suggestions make sense.
thank you,
Dan
code that retrieves all comment from the db
[1] $orders_history = $db->Execute("SELECT orders_status_id, date_added, customer_notified, comments
FROM " . TABLE_ORDERS_STATUS_HISTORY . "
WHERE orders_id = '" . $oID . "'
ORDER BY date_added");
Code that checks only one comment field (the first amongst those retrieved), whether its empty or not.
[2] if ($orders_history->fields['comments'] != '') {
$customer_notes = $orders_history->fields['comments'];
$display_notes = 1;
}
else {
$display_notes = 0;
}
[3] code that displays one comment
<?php if ($display_notes == 1) { ?>
<tr>
<td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
</tr>
<tr>
<td class="main" colspan="2"><strong><?php echo HEADER_CUSTOMER_NOTES; ?></strong></td>
</tr>
<tr>
<td class="main" colspan="2"><?php echo $customer_notes; ?></td>
</tr>
<?php } ?>