Forums / All Other Contributions/Addons / PDOFC Order Centre - howto print only 1st comment?

PDOFC Order Centre - howto print only 1st comment?

Started by pejot on 14 Jun 2011, 10:55 AM · Views: 577

Results 1 to 2 of 2
14 Jun 2011, 10:55 AM
#1
pejot avatar

pejot

New Zenner

Join Date:
Jul 2008
Posts:
16
Plugin Contributions:
0

PDOFC Order Centre - howto print only 1st comment?

I've been modifying built in templates to suit my needs and I'm looking for a way to create a template that would add only the 1st comment to the invoice. Any ideas how to do it?

Otherwise I can only recommend using PDOFC - awesome mod. I can only wish the templates would be easier to customize :D

14 Jun 2011, 1:06 PM
#2
pejot avatar

pejot

New Zenner

Join Date:
Jul 2008
Posts:
16
Plugin Contributions:
0

Re: PDOFC Order Centre - howto print only 1st comment?

Ok , SO I fured out I need to make changes somewhere here:

if ($show_comments) {  // print out all comments for this order
  
    $innum = $orders->fields['orders_id'];
    $orders_comments = $db->Execute("select comments,date_added from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$innum . "' order by date_added");

    if ($orders_comments->RecordCount()>0) {
  
	  // resume printing comments where we left off,
	  // if page was split 	
	  for ($i=0; $i<$nextcomment; $i++)
	  {
		  $orders_comments->MoveNext();
	  }
      while (!$orders_comments->EOF) {
    
        if(zen_not_null($orders_comments->fields['comments'])) {
      
			// check whether too far down page to print more comments
		    //
		    if ($pos < PDFOC_BOTTOM_MARGIN) {
		       $secondpage = true;
		       return;
		    }
          $pdf->ezSetY($pos);
          $cy = $pdf->ezText(zen_date_short($orders_comments->fields['date_added']) ,7); // 7 is font size here
          $pdf->ezText("<b>". PDFOC_TEXT_COMMENTS . "</b>",PDFOC_COMMENTS_FONT_SIZE);
          $cx = $pdf->getTextWidth(PDFOC_COMMENTS_FONT_SIZE,PDFOC_TEXT_COMMENTS) + PDFOC_LEFT_MARGIN;
          $pdf->ezSetY($cy);
          $y = $pdf->ezText(pdfoc_html_cleanup($orders_comments->fields['comments']),PDFOC_COMMENTS_FONT_SIZE, array('aleft'=>$cx+10));
          $pos = ($y -5);
        
        }  // EOIF zen_not_null
      
        $orders_comments->MoveNext();
        $nextcomment++;
      } // EOWHILE $orders_comments
    
    } // EOIF $orders_comments->RecordCount()

  } // EOIF $show_comments

But to be honest I don't understand how it works. Any help would be greatly appreciated.