Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    25
    Thanks
    5
    Thanked 0 Times in 0 Posts

    delete the 4 zeros in the description code

    how can i delete the 4 zeros in the description code? see the image below with the red highlight. code also included:







    PHP Code:
    <?php 

        $pdf
    ->SetY($Y_Table_Position);
        
    $pdf->SetX(6);
        
    $num $i 1;
        
    $pdf->MultiCell(9,6,$num,1,'C''1');              

        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(15);

            
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                           
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                           
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                           
    $pdf->SetFillColor240240240 ); 
                           
    $pdf->Rect15$Y_Table_Position836,'F');                       
                           
                 
    $attrcode=tep_db_query("SELECT orders_id, products_options_values_code FROM `orders_products_attributes` where orders_products_id = '".$order->products[$i]['jid']."'");
                       
                    
                        while(
    $attrcodex tep_db_fetch_array($attrcode)) {
                            if(
    $attrcodex['products_options_values_code'] !=""){                                        
                            
    $pdf->Write(6,$attrcodex['products_options_values_code']);
                            }
                        }
                    
                    
                        

                    
    $attrcode2=tep_db_query("SELECT p.products_id, p.inv_code, p.products_jdesc, desc_line1, desc_line2, desc_line3, desc_line4, desc_line5, desc_line6, desc_line7, desc_line8, desc_line9, desc_line10, desc_line11, desc_line12, desc_line13, o.products_id FROM `products` p, `orders_products` o where orders_products_id = '".$order->products[$i]['jid']."' and o.products_id = p.products_id");
                    
    $attrcodex2 tep_db_fetch_array($attrcode2);                             
           
                    if(
    $attrcodex['products_options_values_code'] == ""){
                    
    $pdf->Write(6,$attrcodex2['inv_code']);
                    }                     
                    
        
        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(98);               

        
    $pdf->MultiCell(9,6,tep_display_tax_value($order->products[$i]['qty']),1,'C''1');
        
        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(107);
        
        
        
    $wtotal tep_db_query("SELECT * FROM `orders_products` WHERE orders_id='".$order->products[$i]['id']."'");                                             
         
    $countwtotal tep_db_fetch_array($wtotal);
        
        
    $computer $order->products[$i]['total']+$order->products[$i]['weight'];

        
    $weight $computer*$order->products[$i]['qty'];

        
    $pdf->MultiCell(20,6,$weight,1,'C''1');
        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(127);               


    $jspecials tep_db_query("SELECT p.deltime, count(p.products_id), s.products_id FROM `specials` s, `products` p WHERE s.products_id = '".$order->products[$i]['id']."' and p.products_id = '".$order->products[$i]['id']."'");                                             
         
    $jcountspec tep_db_fetch_array($jspecials);
            
    // Check first if X stock
            
    if($jcountspec['count(p.products_id)'] == "1"){
                 
    $deltime 'Ex-Stock';
            } elseif (
    $jcountspec['deltime'] != "") {
                
    $deltime $jcountspec['deltime'];
            } else {
                
    $deltime '6 - 8';
            }


        
    $pdf->MultiCell(23,6,$deltime,1,'C''1');

        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(150);
        
    //$pdf->SetFont('Arial','',10);
        
    $pdf->SetFont(PDF_INV_PRODUCTS_TEXT_FONT,
                      
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                      
    PDF_INV_PRODUCTS_TEXT_HEIGHT);  

        
    $pdf->MultiCell(25,6,substr($order->products[$i]['final_price'], 0,-2),1,'C''1');
        
        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(175);
        
    $pdf->MultiCell(22,6,str_replace('S$'''$currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty'])),1,'C''1');

        
    $item_count += ;
        
    $Y_Table_Position += 7;
        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(15);
        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                       
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                       
    PDF_INV_PRODUCTS_TEXT_HEIGHT);    
        
    $pdf->MultiCell(150,6,'MODEL: '.strtoupper($order->products[$i]['name']),1,'L''0');
        
            
        
    //$Y_Table_Position += 7;
        //$pdf->SetY($Y_Table_Position);
        //$pdf->SetX(15);
            //$pdf->SetFont( PDF_INV_PRODUCTS_TEXT_FONT,
                           //PDF_INV_PRODUCTS_TEXT_EFFECT,
                         //  PDF_INV_PRODUCTS_TEXT_HEIGHT);
          // show desc and brand
        // $jorder = tep_db_query("SELECT products_id  FROM `orders_products` WHERE orders_id ='".$HTTP_GET_VARS['order_id']."'");                                             
        // $jxorders = tep_db_fetch_array($jorder);
         
        // $jproducts = tep_db_query("SELECT * FROM `products` WHERE products_id ='".$order->products[$i]['id']."'");                                             
        // $jxproducts = tep_db_fetch_array($jproducts);
        // if($jxproducts['products_jbrand'] ==""){
        // $jxout = '';
        // $jyout = '';
        // } else { 
         //$jxout = $jxproducts['products_jbrand'];
        // $jyout = $jxproducts['products_jdesc'];
        //}                        
        //    $pdf->MultiCell(69,6,'Brand: '.$jxout,1,'L', '');
            
        //$Y_Table_Position += 7;
        //$pdf->SetY($Y_Table_Position);
        //$pdf->SetX(15);
            //$pdf->SetFont( PDF_INV_PRODUCTS_TEXT_FONT,
                   //        PDF_INV_PRODUCTS_TEXT_EFFECT,
                //           PDF_INV_PRODUCTS_TEXT_HEIGHT);  
            //$pdf->MultiCell(300,6,'Description: '."\n". $jyout,1,'L', '');
            
    $item_count += ;
        
    $Y_Table_Position += 7;
        
    $pdf->SetY($Y_Table_Position);                
        
    //get attribs 
        
    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
                 
            for (
    $j=0$n2=sizeof($order->products[$i]['attributes']); $j<$n2$j++) {
                
                
    $pdf->SetX(15);
                
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                               
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                               
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                            if(
    $order->products[$i]['attributes'][$j]['option'] !="Model"){
                               
                            
    $pdf->MultiCell(150,4," - " .strtoupper($order->products[$i]['attributes'][$j]['option']) . ': ' strtoupper($order->products[$i]['attributes'][$j]['value']), '0');
                            
        
    $Y_Table_Position += 4;
              
    //Check for product line overflow
              
    $item_count++;
              if ( 
    $item_count 30) {
                 
    $pdf->AddPage();
                 
    //Fields Name position
                 
    $Y_Fields_Name_position 120;
                 
    //Table position, under Fields Name
                 
    $Y_Table_Position 109;
                 
    output_table_heading($Y_Table_Position);
                 
    $item_count 1;
                 
    $text_color=explode(",",PDF_INV_PRODUCTS_TEXT_COLOR );
                 
    $pdf->SetTextColor(000);   
                 
                 
    $text_color=explode(",",PDF_INV_PRODUCTS_LINE_COLOR );
                 
    $pdf->SetDrawColor00);    
                                       }
                                      }
            }
            

       }
       
               
            
            
    $attrcode=tep_db_query("SELECT p.products_id, p.inv_code, p.products_jdesc, desc_line1, desc_line2, desc_line3, desc_line4, desc_line5, desc_line6, desc_line7, desc_line8, desc_line9, desc_line10, desc_line11, desc_line12, desc_line13, o.products_id FROM `products` p, `orders_products` o where orders_products_id = '".$order->products[$i]['jid']."' and o.products_id = p.products_id");
                
    $attrcodex tep_db_fetch_array($attrcode);
                if(
    $attrcodex['products_jdesc'] == "1"){    
                
                    if(
    $attrcodex['desc_line1'] != ""){
                    
    $item_count += ;
                    
    $Y_Table_Position += 0;
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'- '.strtoupper($attrcodex['desc_line1']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line2'] != ""){
                         if(
    strlen($attrcodex['desc_line1']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line1']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'- '.strtoupper($attrcodex['desc_line2']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line3'] != ""){
                         if(
    strlen($attrcodex['desc_line2']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line2']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line3']), '0');
                     }
                     
                          if(
    $attrcodex['desc_line4'] != ""){
                         if(
    strlen($attrcodex['desc_line3']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line3']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line4']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line5'] != ""){
                         if(
    strlen($attrcodex['desc_line4']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line4']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line5']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line6'] != ""){
                         if(
    strlen($attrcodex['desc_line5']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line5']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line6']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line7'] != ""){
                         if(
    strlen($attrcodex['desc_line6']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line6']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line7']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line8'] != ""){
                         if(
    strlen($attrcodex['desc_line7']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line7']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line8']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line9'] != ""){
                         if(
    strlen($attrcodex['desc_line8']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line8']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line9']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line10'] != ""){
                         if(
    strlen($attrcodex['desc_line9']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line9']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line10']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line11'] != ""){
                         if(
    strlen($attrcodex['desc_line10']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line10']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line11']), '0');
                     }
                     
                     if(
    $attrcodex['desc_line12'] != ""){
                         if(
    strlen($attrcodex['desc_line11']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line11']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line12']), '0');
                     }
                     
                     
                     if(
    $attrcodex['desc_line13'] != ""){
                         if(
    strlen($attrcodex['desc_line12']) > 150 ){                     
                          
    $item_count += ;
                    
    $Y_Table_Position += 8;
                        } elseif(
    strlen($attrcodex['desc_line12']) > 300 ){
                          
    $item_count += ;
                    
    $Y_Table_Position += 12;
                        } else {
                          
    $item_count += ;
                    
    $Y_Table_Position += 4;                                    
                            }
                        
    $pdf->SetY($Y_Table_Position);                        
                        
    $pdf->SetX(15);
                        
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                                   
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                                   
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                         
    $pdf->MultiCell(170,4,'-'.strtoupper($attrcodex['desc_line13']), '0');
                     }
                     
                }
                
                
    $item_count += ;
                
    $Y_Table_Position += 7;
                    
    $pdf->SetY($Y_Table_Position);                        
                    
    $pdf->SetX(15);
                    
    $pdf->MultiCell(150,4,'''0');
                
    //$pdf->MultiCell(150,4,$order->products[$i]['jid'], '0');
                //testing
                //$Y_Table_Position += 7;
                    //$pdf->SetY($Y_Table_Position);                        
                    //$pdf->SetX(15);
                //$pdf->MultiCell(150,4,$order->products[$i]['jid'], '0');
                // end
     








        //Check for product line overflow
        
    $item_count += 1;
    //    if ((is_long($item_count / 32) && $i >= 20) || ($i == 20)){
        
    if ( $item_count 30 ) {    
            
    $pdf->AddPage();

            
    //Fields Name position
            
    $Y_Fields_Name_position 120;
            
    //Table position, under Fields Name
            
    $Y_Table_Position 109;
            
    output_table_heading($Y_Table_Position);
            
    //if ($i == 20) 

            
    $text_color=explode(",",PDF_INV_PRODUCTS_TEXT_COLOR );
            
    $pdf->SetTextColor(000); 
            
    $item_count 1;
            
    $text_color=explode(",",PDF_INV_PRODUCTS_LINE_COLOR );
            
    $pdf->SetDrawColor00);    
            
        }
    }
            
    $item_count 1;
    $pdf->SetFontPDF_INV_ORDERTOTAL1_TEXT_FONT,
                   
    PDF_INV_ORDERTOTAL1_TEXT_EFFECT,
                   
    PDF_INV_ORDERTOTAL1_TEXT_HEIGHT);  

    $text_color=explode(",",PDF_INV_ORDERTOTAL1_TEXT_COLOR );
    $pdf->SetTextColor(000);

        


        
    ?>
    Last edited by scott_white85; 09-15-2011 at 07:06 AM.

  • #2

  • #3
    New Coder
    Join Date
    Aug 2011
    Posts
    25
    Thanks
    5
    Thanked 0 Times in 0 Posts
    where can i insert that code? kindly see the attach code. the variable name is products_options_values_code.

  • #4
    New Coder
    Join Date
    Sep 2011
    Posts
    43
    Thanks
    6
    Thanked 6 Times in 6 Posts
    If you know what string your char data is in, you could shorten it by X chars like this:
    Code:
    //take 4 chars off the end
    $string = substr($string, 0, -4);
    Conversely, if 4 is positive, it takes the chars off the start.

    If all you need is a shortened display for the pdf, this would do it, however if you need this format to persist in a db table, you need to re-write your product codes (from what I can gather).

    (I see gvre beat me to it)
    Last edited by morongo47; 09-15-2011 at 09:07 AM.

  • Users who have thanked morongo47 for this post:

    scott_white85 (09-16-2011)

  • #5
    New Coder
    Join Date
    Aug 2011
    Posts
    25
    Thanks
    5
    Thanked 0 Times in 0 Posts
    can you look at the code to where i can insert that one. the variable name is products_options_values_code

    PHP Code:
    $pdf->SetFontPDF_INV_PRODUCTS_TEXT_FONT,
                           
    PDF_INV_PRODUCTS_TEXT_EFFECT,
                           
    PDF_INV_PRODUCTS_TEXT_HEIGHT);
                           
    $pdf->SetFillColor240240240 ); 
                           
    $pdf->Rect15$Y_Table_Position836,'F');                       
                           
                 
    $attrcode=tep_db_query("SELECT orders_id, products_options_values_code FROM `orders_products_attributes` where orders_products_id = '".$order->products[$i]['jid']."'");
                       
                    
                        while(
    $attrcodex tep_db_fetch_array($attrcode)) {
                            if(
    $attrcodex['products_options_values_code'] !=""){                                        
                            
    $pdf->Write(6,$attrcodex['products_options_values_code']);
                            }
                        }
                    
                    
                        

                    
    $attrcode2=tep_db_query("SELECT p.products_id, p.inv_code, p.products_jdesc, desc_line1, desc_line2, desc_line3, desc_line4, desc_line5, desc_line6, desc_line7, desc_line8, desc_line9, desc_line10, desc_line11, desc_line12, desc_line13, o.products_id FROM `products` p, `orders_products` o where orders_products_id = '".$order->products[$i]['jid']."' and o.products_id = p.products_id");
                    
    $attrcodex2 tep_db_fetch_array($attrcode2);                             
           
                    if(
    $attrcodex['products_options_values_code'] == ""){
                    
    $pdf->Write(6,$attrcodex2['inv_code']);
                    }                     
                    
        
        
    $pdf->SetY($Y_Table_Position);
        
    $pdf->SetX(98);               

        
    $pdf->MultiCell(9,6,tep_display_tax_value($order->products[$i]['qty']),1,'C''1'); 

  • #6
    New Coder
    Join Date
    Sep 2011
    Posts
    43
    Thanks
    6
    Thanked 6 Times in 6 Posts
    Around line 23, save the the array value $attrcodex['products_options_values_code'] to a string:
    Code:
    $string=$attrcodex['products_options_values_code'];
    Now perform the substr() on $string.
    Next write it to the pdf invoice.
    Code:
    $pdf->Write(6,$string);
    Try it before you use it on customers.

  • #7
    New Coder
    Join Date
    Aug 2011
    Posts
    25
    Thanks
    5
    Thanked 0 Times in 0 Posts
    it doesnt work, i tried to insert the code based on your suggestion. see the bold text below.

    PHP Code:
    $attrcode=tep_db_query("SELECT orders_id, products_options_values_code FROM `orders_products_attributes` where orders_products_id = '".$order->products[$i]['jid']."'");
                       
                    
                        while(
    $attrcodex tep_db_fetch_array($attrcode)) {
                            if(
    $attrcodex['products_options_values_code'] !=""){                                        
                            
    $pdf->Write(6,$attrcodex['products_options_values_code']);
                            }
                        }
                    
                    
                        

                    
    $attrcode2=tep_db_query("SELECT p.products_id, p.inv_code, p.products_jdesc, desc_line1, desc_line2, desc_line3, desc_line4, desc_line5, desc_line6, desc_line7, desc_line8, desc_line9, desc_line10, desc_line11, desc_line12, desc_line13, o.products_id FROM `products` p, `orders_products` o where orders_products_id = '".$order->products[$i]['jid']."' and o.products_id = p.products_id");
                    
    $attrcodex2 tep_db_fetch_array($attrcode2);                             
           
                       [
    B]$string=$attrcodex['products_options_values_code'];
                    
    $string substr($string0, -4);[/B]
           
                    if(
    $attrcodex['products_options_values_code'] == ""){
                    
    $pdf->Write(6,$attrcodex2['inv_code']);
                    [
    B]$pdf->Write(6,$string);[/B]
                    } 

  • #8
    New Coder
    Join Date
    Sep 2011
    Posts
    43
    Thanks
    6
    Thanked 6 Times in 6 Posts
    Scott, you're still writing the original array value to the invoice, but I messed up too, it looks like we need to work on $attrcodex2['inv_code'], so...

    Code:
    if($attrcodex['products_options_values_code'] == ""){ 
    
    //you don't want to write this anymore...$workstring replaces it                
    //$pdf->Write(6,$attrcodex2['inv_code']);
    
    //instead, copy this value to our own string 
    $string=$attrcodex2['inv_code'];
    
    //now, knock 4 chars off the end...
    $workstring = substr($string, 0, -4);
    
    //write our work-string out...
    $pdf->Write(6,$workstring); 
    
    }//if
    Try that...

    Delete the other stuff you copied in, it's not doing anything except cluttering your code.

    To avoid further confusion, the above code -replaces- the last 'if(){}' statement in your previous post.
    .

    .
    Last edited by morongo47; 09-15-2011 at 07:49 PM.

  • Users who have thanked morongo47 for this post:

    scott_white85 (09-16-2011)


  •  

    Posting Permissions

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