My shipping software .php file pulls notes in from Magento. Problem is, after a certain number of "note" characters, the invoice does not print properly on my thermal printer (not sure the character limit, so I will need to use trial-by-error. I am assuming there should be an easy string limiter code to cut the excess characters and possibly append an ellipsis? Please help!
writeStartTag("Notes");
// check for order-level gift messages
if ($order->getGiftMessageId())
{
$message = Mage::helper('giftmessage/message')->getGiftMessage($order->getGiftMessageId());
$messageString = "Gift message for ". $message['recipient']. ": ". $message['message'];
if (trim($message['recipient']) != '') {
writeFullElement("Note", $messageString, array("public" => "true"));
}
}
$orderComments = $order->getAllStatusHistory();
foreach ($orderComments as $comment) {
$body = $comment->getData('comment');
if ($body != '' && strpos($body, 'Order imported from') === false) {
writeFullElement("Note", "*** Buyer message: $body", array("public" => "true"));
}
}
writeCloseTag("Notes");