Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

delete the 4 zeros in the description code


scott_white85

Recommended Posts

Posted

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

 

 

post-296310-0-93979700-1316067973_thumb.jpg

 

 

<?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->SetFont( PDF_INV_PRODUCTS_TEXT_FONT,
				   PDF_INV_PRODUCTS_TEXT_EFFECT,
				   PDF_INV_PRODUCTS_TEXT_HEIGHT);
				   $pdf->SetFillColor( 240, 240, 240 );
				   $pdf->Rect( 15, $Y_Table_Position, 83, 6,'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 += 1 ;
$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(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 += 1 ;
$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->SetFont( PDF_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(0, 0, 0);  

		 $text_color=explode(",",PDF_INV_PRODUCTS_LINE_COLOR );
		 $pdf->SetDrawColor( 0, 0, 0 );	
							   }
							  }
	}


  }



	$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 += 1 ;
			$Y_Table_Position += 0;
				$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(170,4,'- '.strtoupper($attrcodex['desc_line1']), '0');
			 }

			 if($attrcodex['desc_line2'] != ""){
				 if(strlen($attrcodex['desc_line1']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line1']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'- '.strtoupper($attrcodex['desc_line2']), '0');
			 }

			 if($attrcodex['desc_line3'] != ""){
				 if(strlen($attrcodex['desc_line2']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line2']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line3']), '0');
			 }

				  if($attrcodex['desc_line4'] != ""){
				 if(strlen($attrcodex['desc_line3']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line3']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line4']), '0');
			 }

			 if($attrcodex['desc_line5'] != ""){
				 if(strlen($attrcodex['desc_line4']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line4']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line5']), '0');
			 }

			 if($attrcodex['desc_line6'] != ""){
				 if(strlen($attrcodex['desc_line5']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line5']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line6']), '0');
			 }

			 if($attrcodex['desc_line7'] != ""){
				 if(strlen($attrcodex['desc_line6']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line6']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line7']), '0');
			 }

			 if($attrcodex['desc_line8'] != ""){
				 if(strlen($attrcodex['desc_line7']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line7']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line8']), '0');
			 }

			 if($attrcodex['desc_line9'] != ""){
				 if(strlen($attrcodex['desc_line8']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line8']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line9']), '0');
			 }

			 if($attrcodex['desc_line10'] != ""){
				 if(strlen($attrcodex['desc_line9']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line9']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line10']), '0');
			 }

			 if($attrcodex['desc_line11'] != ""){
				 if(strlen($attrcodex['desc_line10']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line10']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line11']), '0');
			 }

			 if($attrcodex['desc_line12'] != ""){
				 if(strlen($attrcodex['desc_line11']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line11']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line12']), '0');
			 }


			 if($attrcodex['desc_line13'] != ""){
				 if(strlen($attrcodex['desc_line12']) > 150 ){					
				  $item_count += 2 ;
			$Y_Table_Position += 8;
				} elseif(strlen($attrcodex['desc_line12']) > 300 ){
				  $item_count += 3 ;
			$Y_Table_Position += 12;
				} else {
				  $item_count += 1 ;
			$Y_Table_Position += 4;									
					}
				$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(170,4,'-'.strtoupper($attrcodex['desc_line13']), '0');
			 }

		}

		$item_count += 1 ;
		$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(0, 0, 0);
	$item_count = 1;
	$text_color=explode(",",PDF_INV_PRODUCTS_LINE_COLOR );
	$pdf->SetDrawColor( 0, 0, 0 );	

}
}
	$item_count = 1;
$pdf->SetFont( PDF_INV_ORDERTOTAL1_TEXT_FONT,
		   PDF_INV_ORDERTOTAL1_TEXT_EFFECT,
		   PDF_INV_ORDERTOTAL1_TEXT_HEIGHT);  

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




?>


Archived

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

×
×
  • Create New...