Problema con Shipping Label per la Dymo

Questo forum è dedicato alle discussioni riguardanti le contribution per osCommerce

Moderatore: mod Generali

Rispondi
Race
membro Junior
membro Junior
Messaggi: 3
Iscritto il: 30/10/2007, 16:47

Problema con Shipping Label per la Dymo

Messaggio da Race »

Salve a tutti, sono abbastanza nuovo nella programmazione con oscommerce e mi trovo leggermente in difficoltà con una contribution che permette di stampare le etichette di spedizione in pdf...

http://addons.oscommerce.com/info/2803

in pratica, nella pagina pdf che mi genera, tramite il file label_pdf.php ho provato in tutti i modi, ma non riesco ad aggiungere in fondo, la variabile che legge il numero di telefono del cliente..

Grazie
Emanuele
Race
membro Junior
membro Junior
Messaggi: 3
Iscritto il: 30/10/2007, 16:47

Codice PHP

Messaggio da Race »

Posto qui di seguito anche il codice della pagina che non mi funziona con un ulteriore tentativo commentato :

<?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']);
//prova telefono creata da me
if (isset($address->customers['customers_id']) && tep_not_null($address->customers['customers_id'])) {
$telephone = tep_get_customers_telephone($address->customers['customers_id']);
} else {
$telephone = tep_output_string_protected($address->customers['$telephone']);
} //fine prova
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;
$line1= "$firstname $lastname";
$line2= "$company";
$line3="$street";
$line4="$city" . ', ' . "$country $zip";
$line5="$telephone"; //visualizzazione telefono
define('FPDF_FONTPATH','font/');
require('fpdf.php');
$pdf=new FPDF('L','mm',array(53, 100));
$pdf->AddPage();
$pdf->SetXY('4', '4');
$pdf->SetMargins('0','0','0');
$pdf->SetFont('Arial','B',9);
$pdf->SetX('4');
$pdf->Cell(80,4,'LINA24 - Via Duerer 14 - 39100 Bolzano Italy',0,1);
$pdf->SetX('4');
$pdf->Cell(80,4,'',T,1);
$pdf->SetX(15);
$pdf->SetFont('Arial','',12);
$pdf->Cell(40,4,"$line1",0,2);
if($line2 != ''){
$pdf->Cell(40,4,"$line2",0,2);
}
$pdf->Cell(40,4,"$line3",0,2);
$pdf->Cell(40,4,"$line4",0,2);
if($line5 != ''){
$pdf->Cell(40,4,"$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 ($telephone == '') $telephone = tep_output_string_protected($address->customers['telephone']);
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'); ?>
Race
membro Junior
membro Junior
Messaggi: 3
Iscritto il: 30/10/2007, 16:47

Soluzione

Messaggio da Race »

Ciao a tutti, ringrazio quelli che magari ci hanno provato, ma sono riuscito da solo ad ottenere quello che avevo chiesto.. per chi in futuro avesse il mio stesso problema, il codice da inserire è il seguente :

$postcode = tep_output_string_protected($address['postcode']);
$zip = $postcode;


//inizio codice telefono da inserire..
$MySql = "SELECT * FROM customers WHERE customers_telephone";
$Result = mysql_query($MySql);

while ($rs = mysql_fetch_array($Result)) {
$telephone = tep_output_string_protected($rs['customers_telephone']);
}
$rs->close;
mysql_free_result($Result);
//fine codice telefono da inserire !!

$line1= "$firstname $lastname";

Saluti
Emanuele
Rispondi