Jump to content

Variable call- character limit per line


theisurgeon

Recommended Posts

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");

Link to comment
https://forums.phpfreaks.com/topic/281694-variable-call-character-limit-per-line/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.