Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:47:47+00:00 2026-06-16T00:47:47+00:00

I’m editing my invoices file in /Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php And I’m running into a problem with

  • 0

I’m editing my invoices file in

/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php

And I’m running into a problem with columns running into and overlapping other columns if they have long content. eg Product description running over the next column. I’m trying to figure out how to limit the width / word wrap / create a new line for content.

Code is:

// draw Product name
$lines[0] = array(array(
    'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true),
    'feed' => 35,
));

// draw SKU
//  $lines[0][] = array(
//    'text'  => Mage::helper('core/string')->str_split($this->getSku($item), 25),
//  'feed'  => 255
//  );

// draw Brand (Added by James)
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $this->getSku($item), array('manufacturer'));

if ($product) {
    $lines[0][] = array(
        'text'  => Mage::helper('core/string')->str_split($product->getAttributeText('manufacturer'), 15),
        'feed'  => 220
    );
}
// draw Colour (Added by James)
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $this->getSku($item), array('pos_short_colour'));

if ($product) {
    $lines[0][] = array(
        'text'  => Mage::helper('core/string')->str_split($product->getAttributeText('pos_short_colour'), 15),
        'feed'  => 320
    );
}

I know that ‘feed’ is what sets how far in from the left the array starts (pretty much = to a margin-left if all items were ‘absolute’ in css terms).

But I’m not sure how I can limit their width and word-wrap so that if I have a long manufacturer it won’t run into the colour. There isn’t enough space on the invoice to just simply give each attribute more room.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:47:48+00:00Added an answer on June 16, 2026 at 12:47 am

    The answer was right there:

       $lines[0] = array(array(
            'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true),
            'feed' => 35,
        ));
    

    The 60 here is how many characters will be displayed per line ->getName(), 60, true,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.