Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2006
    Posts
    199
    Plugin Contributions
    0

    Default PDF Order Center tweak help

    I'm happy to say that PDF Order Center works fine in 1.3.8a and I'm using it for packing slips with success. I'm hoping someone with experience can help me tweak one small item in the output. I'd like to format the product lines so they are easier to read across. Right now the background is all light grey. I'd like it to alternate light grey and white or to have a very thin line between each product line. Here's the code that's relevant:
    PHP Code:
      // products , model etc table layout
      
    PDFOC_change_color(PDFOC_TABLE_HEADER_BKGD_COLOR);
      
    $pdf->filledRectangle(PDFOC_LEFT_MARGIN,$pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT,PDFOC_PRODUCT_TABLE_HEADER_WIDTH,PDFOC_PRODUCT_TABLE_ROW_HEIGHT);

      
    $x PDFOC_LEFT_MARGIN PDFOC_PRODUCT_TABLE_LEFT_MARGIN;
      
    $pos = ($pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT) + PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;

      
    PDFOC_change_color(PDFOC_GENERAL_FONT_COLOR);

      
    $pdf->ezSetY($pos+PDFOC_PRODUCT_TABLE_ROW_HEIGHT);
      
    $pdf->ezText(PDFOC_TABLE_HEADING_PRODUCTS,PDFOC_TABLE_HEADER_FONT_SIZE, array('aleft'=>$x));
      
    $x += PDFOC_PRODUCTS_COLUMN_SIZE;
      
    $pdf->ezSetY($pos+PDFOC_PRODUCT_TABLE_ROW_HEIGHT);
      
    $pdf->ezText("Shipped        Dropped      Delayed",PDFOC_TABLE_HEADER_FONT_SIZE, array('aleft'=>$x));


      
    $pos -= PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;

      
    // Sort through the products

      
    for ($i $nextproduct$n sizeof($order->products); $i $n$i++) {

        
    // check whether too far down page to print more products; assume enough margin
        // to account for a product with wrapped text and a couple of attributes
        //
        
    if ($pos PDFOC_BOTTOM_MARGIN) {
           
    $secondpage true;
           return;
        }

        
    $prod_str $order->products[$i]['qty'] . " x " $order->products[$i]['name'];

        
    PDFOC_change_color(PDFOC_PRODUCT_LISTING_BKGD_COLOR);
        
    $pdf->filledRectangle(PDFOC_LEFT_MARGIN,$pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT,PDFOC_PRODUCT_TABLE_HEADER_WIDTH,PDFOC_PRODUCT_TABLE_ROW_HEIGHT);

        
    $x PDFOC_LEFT_MARGIN PDFOC_PRODUCT_TABLE_LEFT_MARGIN;
        
    $pos = ($pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT) + PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;

        
    PDFOC_change_color(PDFOC_GENERAL_FONT_COLOR);
        
    $truncated_str $pdf->addTextWrap($x,$pos,PDFOC_PRODUCTS_COLUMN_SIZE,PDFOC_TABLE_HEADER_FONT_SIZE,$prod_str);

        
    $pdf->ezSetY($pos+PDFOC_PRODUCT_TABLE_ROW_HEIGHT-PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN);
        
    $x += PDFOC_PRODUCTS_COLUMN_SIZE;
        
    $pdf->ezText(pdfoc_html_cleanup($order->products[$i]['model']),PDFOC_TABLE_HEADER_FONT_SIZE,array('aleft'=>$x));


        
    $pos -= PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;

        if (
    $truncated_str) {
        
        
    PDFOC_change_color(PDFOC_PRODUCT_LISTING_BKGD_COLOR);
        
    $pdf->filledRectangle(PDFOC_LEFT_MARGIN,$pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT,PDFOC_PRODUCT_TABLE_HEADER_WIDTH,PDFOC_PRODUCT_TABLE_ROW_HEIGHT);
        
    $pos = ($pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT) + PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;
        
    PDFOC_change_color(PDFOC_GENERAL_FONT_COLOR);
        
    $reset_x PDFOC_LEFT_MARGIN PDFOC_PRODUCT_TABLE_LEFT_MARGIN;
        
    $pdf->addText($reset_x,$pos,PDFOC_TABLE_HEADER_FONT_SIZE,$truncated_str);
        
    $pos -= PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;
        
        } 
    // EOIF $truncated_str
        
        
    if ( ($k sizeof($order->products[$i]['attributes'])) > 0) {

          for (
    $j 0$j $k$j++) {

            
    $attrib_string '<i> - ' $order->products[$i]['attributes'][$j]['option'] . ': ' $order->products[$i]['attributes'][$j]['value'];
            
            if (
    $order->products[$i]['attributes'][$j]['price'] != '0') {
              
    $attrib_string .= ' (' $order->products[$i]['attributes'][$j]['prefix'] .
              
    pdfoc_html_cleanup($currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true$order->info['currency'], $order->info['currency_value'])) . ')';
            }
            
            
    $attrib_string .= '</i>';
          
    PDFOC_change_color(PDFOC_PRODUCT_LISTING_BKGD_COLOR);
          
    $pdf->filledRectangle(PDFOC_LEFT_MARGIN,$pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT,PDFOC_PRODUCT_TABLE_HEADER_WIDTH,PDFOC_PRODUCT_TABLE_ROW_HEIGHT);
          
    $pos = ($pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT) + PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;
          
    PDFOC_change_color(PDFOC_GENERAL_FONT_COLOR);
          
    $reset_x PDFOC_LEFT_MARGIN PDFOC_PRODUCT_TABLE_LEFT_MARGIN;

            if (
    PDFOC_PRODUCT_ATTRIBUTES_TEXT_WRAP) {
              
    $wrapped_str $pdf->addTextWrap($reset_x,$pos,PDFOC_PRODUCTS_COLUMN_SIZE,PDFOC_PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
            } else {
              
    $pdf->addText($reset_x,$pos,PDFOC_PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
            }

            
    $pos -= PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;
                      
            if (
    $wrapped_str) {
            
            
    PDFOC_change_color(PDFOC_PRODUCT_LISTING_BKGD_COLOR);
            
    $pdf->filledRectangle(PDFOC_LEFT_MARGIN,$pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT,PDFOC_PRODUCT_TABLE_HEADER_WIDTH,PDFOC_PRODUCT_TABLE_ROW_HEIGHT);
            
    $pos = ($pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT) + PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;
            
    PDFOC_change_color(PDFOC_GENERAL_FONT_COLOR);
            
    $pdf->addText($reset_x,$pos,PDFOC_PRODUCT_ATTRIBUTES_FONT_SIZE,$wrapped_str);
            
    $pos -= PDFOC_PRODUCT_TABLE_BOTTOM_MARGIN;
            
          } 
    // EOIF $wrapped_str
          
        
    // EOFOR $j = 0
        
        
    // EOIF $k = sizeof(...
        
        
    $nextproduct++;

      } 
    Thanks for any help you can!

  2. #2
    Join Date
    Dec 2006
    Posts
    199
    Plugin Contributions
    0

    Default Re: PDF Order Center tweak help

    Nevermind. I answered my own question with some research. here's where I dropped a line in place of the background color in case anyone finds this later:
    PHP Code:
        $prod_str $order->products[$i]['qty'] . " x " $order->products[$i]['name'];
     
    $pdf->setLineStyle(0.1);  
      
    $pdf->line(PDFOC_LEFT_MARGIN,$pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT,PDFOC_PRODUCT_TABLE_HEADER_WIDTH,$pos-PDFOC_PRODUCT_TABLE_ROW_HEIGHT); 

 

 

Similar Threads

  1. PDF Order Center
    By scubes13 in forum Addon Admin Tools
    Replies: 52
    Last Post: 9 Jan 2019, 03:06 PM
  2. PDF Order Center help.
    By drgr33n in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 6 Oct 2010, 11:07 AM
  3. pdf order center
    By tavikki in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 23 Nov 2008, 07:36 PM
  4. Urgent Help Required - PDF order center is canceling my orders!!
    By redmonds in forum All Other Contributions/Addons
    Replies: 10
    Last Post: 5 Jul 2008, 08:52 AM
  5. can someone help please -- Problems with PDF Order Center
    By londoner1988 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 4 Mar 2008, 03:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg