Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Good morning,

I work with recently OsCommerce and unfortunately I found the first problem ...

 

I installed the contribution "Shipping Label" for the printer labels dymo ..

 

The contrbution works perfectly. I added the telephone number of customers, but the code written by me, not by the expected results ..

 

//inizio telefono
$MySql_query = tep_db_query("select customers_telephone from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); 
$Result = ($MySql_query);
$rs = mysql_fetch_array($Result);
$telephone = tep_output_string_protected($rs["customers_telephone"]);
$rs->close;
//fine telefono

 

Rather than select the number score in the second dell'id order .. It takes a drive from the database x all customers .. Why? There is a way to say, take the phone number on the basis of current id?

 

Carryover also file label_pdf.php I changed :

 

<?php
 require('includes/application_top.php');
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();
 $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
 $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
 include(DIR_WS_CLASSES . 'order.php');
 $order = new order($oID);
function tep_dr($address_format_id, $address, $html, $boln, $eoln) {
   $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'");
   $address_format = tep_db_fetch_array($address_format_query);
   $company = tep_output_string_protected($address['company']);
   if (isset($address['firstname']) && tep_not_null($address['firstname'])) {
     $firstname = tep_output_string_protected($address['firstname']);
     $lastname = tep_output_string_protected($address['lastname']);
   } elseif (isset($address['name']) && tep_not_null($address['name'])) {
     $firstname = tep_output_string_protected($address['name']);
     $lastname = '';
   } else {
     $firstname = '';
     $lastname = '';
   }
   $street = tep_output_string_protected($address['street_address']);
   $suburb = tep_output_string_protected($address['suburb']);
   $city = tep_output_string_protected($address['city']);
   $state = tep_output_string_protected($address['state']);
   if (isset($address['country_id']) && tep_not_null($address['country_id'])) {
     $country = tep_get_country_name($address['country_id']);
     if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
       $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state);
     }
   } elseif (isset($address['country']) && tep_not_null($address['country'])) {
     $country = tep_output_string_protected($address['country']);
   } else {
     $country = '';
   }
   $postcode = tep_output_string_protected($address['postcode']);
   $zip = $postcode;
//inizio telefono
$MySql_query = tep_db_query("select customers_telephone from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); 
$Result = ($MySql_query);
$rs = mysql_fetch_array($Result);
$telephone = tep_output_string_protected($rs["customers_telephone"]);
$rs->close;
//fine telefono
$line1= "$firstname $lastname";
   $line2= "$street";
   $line3= "$city";
   $line4= "$zip" . ' - ' . "$country";
   $line5= "TEL" . ' : ' . "$telephone";
  define('FPDF_FONTPATH','font/');
require('fpdf.php');
$pdf=new FPDF('L','mm',array(59, 101));
$pdf->AddPage();
$pdf->Image('logo_dymo.jpg',0,0,0);
$pdf->SetXY('4', '4');
$pdf->SetMargins('0','8','0');
$pdf->SetFont('Arial','Bi',10);
$pdf->Cell(80,1,'',0,1);
$pdf->SetX('4');
$pdf->Cell(80,3,'Prova Lina di Timone Emanuele',0,1);
$pdf->SetX('4');
$pdf->Cell(80,3,'Via Maier 39100 Bolzano Italy - Tel. 0472232913',0,1);
$pdf->SetX('4');
$pdf->Cell(90,3,'',T,1);
$pdf->SetX(8);
$pdf->SetFont('Arial','',14);
$pdf->Cell(20,4,"$line1",0,2);
if($line2 != ''){
$pdf->Cell(20,5,"$line2",0,2);
}
$pdf->Cell(20,5,"$line3",0,2);
$pdf->Cell(20,5,"$line4",0,2);
$pdf->Cell(20,5,"$line5",0,2);
$pdf->Output();
   if ($html) {
// HTML Mode
     $HR = '<hr>';
     $hr = '<hr>';
     if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults
       $CR = '<br>';
       $cr = '<br>';
       $eoln = $cr;
     } else { // Use values supplied
       $CR = $eoln . $boln;
       $cr = $CR;
     }
   } else {
// Text Mode
     $CR = $eoln;
     $cr = $CR;
     $HR = '----------------------------------------';
     $hr = '----------------------------------------';
   }
   $statecomma = '';
   $streets = $street;
   if ($suburb != '') $streets = $street . $cr . $suburb;
   if ($country == '') $country = tep_output_string_protected($address['country']);
   if ($state != '') $statecomma = $state . ', ';

   $fmt = $address_format['format'];
   eval("\$address = \"$fmt\";");

   if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) {
     $address = $company . $cr . $address;
   }
 }
tep_dr($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); 
?>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...