gregy Posted September 8, 2008 Posted September 8, 2008 Hi In database i have only one adress format which we use on packingslip $firstname $lastname$cr$streets$cr$cr$postcode $city$cr$country now, i have made another page, where we print some extra document on order, and on this page i would need address format like this; $firstname $lastname$cr$streets$cr$postcode$city in both document i call information with string <?php echo tep_address_format($order->customer['format_id'], $order->delivery, 1, '', '<br>'); ?> where i assume number 1 is number of adress_format_ID. In database I have added new one, with number 2 (i have deleted $country, from string .. see above) and now when i change 1 to 2 nothing happens. I must be doing something wrong. Thanx for your time and help!
spooks Posted September 8, 2008 Posted September 8, 2008 This is the function your calling: // Return a formatted address 426 // TABLES: address_format 427 function tep_address_format($address_format_id, $address, $html, $boln, $eoln) { 428 $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'"); 429 $address_format = tep_db_fetch_array($address_format_query); 430 431 $company = tep_output_string_protected($address['company']); 432 if (isset($address['firstname']) && tep_not_null($address['firstname'])) { 433 $firstname = tep_output_string_protected($address['firstname']); 434 $lastname = tep_output_string_protected($address['lastname']); 435 } elseif (isset($address['name']) && tep_not_null($address['name'])) { 436 $firstname = tep_output_string_protected($address['name']); 437 $lastname = ''; 438 } else { 439 $firstname = ''; 440 $lastname = ''; 441 } 442 $street = tep_output_string_protected($address['street_address']); 443 $suburb = tep_output_string_protected($address['suburb']); 444 $city = tep_output_string_protected($address['city']); 445 $state = tep_output_string_protected($address['state']); 446 if (isset($address['country_id']) && tep_not_null($address['country_id'])) { 447 $country = tep_get_country_name($address['country_id']); 448 449 if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) { 450 $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state); 451 } 452 } elseif (isset($address['country']) && tep_not_null($address['country'])) { 453 $country = tep_output_string_protected($address['country']['title']); 454 } else { 455 $country = ''; 456 } 457 $postcode = tep_output_string_protected($address['postcode']); 458 $zip = $postcode; 459 460 if ($html) { 461 // HTML Mode 462 $HR = '<hr>'; 463 $hr = '<hr>'; 464 if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults 465 $CR = '<br>'; 466 $cr = '<br>'; 467 $eoln = $cr; 468 } else { // Use values supplied 469 $CR = $eoln . $boln; 470 $cr = $CR; 471 } 472 } else { 473 // Text Mode 474 $CR = $eoln; 475 $cr = $CR; 476 $HR = '----------------------------------------'; 477 $hr = '----------------------------------------'; 478 } 479 480 $statecomma = ''; 481 $streets = $street; 482 if ($suburb != '') $streets = $street . $cr . $suburb; 483 if ($state != '') $statecomma = $state . ', '; 484 485 $fmt = $address_format['format']; 486 eval("\$address = \"$fmt\";"); 487 488 if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) { 489 $address = $company . $cr . $address; 490 } 491 492 return $address; 493 } 494 if you study that you'll see your error Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
Enzo_UK Posted September 8, 2008 Posted September 8, 2008 If its a page you have made from scratch, why not just pull the bits out of database seperately, rather than using the formatted address.... <?php echo $order->customer['customers_name']; ?> <?php echo $order->customer['customers_street_address']; ?> <?php echo $order->customer['customers_postcode']; ?> <?php echo $order->customer['customers_city']; ?>
gregy Posted September 8, 2008 Author Posted September 8, 2008 thanx ENZO, but this is not working, here's whole code that i use <table border="0" cellpadding="2" cellspacing="0"> <tr> <td colspan="1" width="300px"><font face="System"><?php echo $order->customer['customers_name']; ?> <?php echo $order->customer['customers_postcode']; ?></font></td> <td align="right" valign="bottom"><font face="system"><?if($po_povzetju)echo "".number_format($virman,2)."";?></font></td> </tr> <tr> <td colspan="2" rowspan="1"><font face="System"><?php for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { echo ' <tr>' . "\n"; $produkt=$order->products[$i]['name']; $produkt=explode("<br>",$produkt); $produkt=$produkt[0]; echo ' <td colspan="2"><font face="system">' . $produkt; if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) { for ($j = 0; $j < $k; $j++) { } } echo ' </font></td>' . "\n"; echo ' </tr>' . "\n"; } ?> </font></td> </tr> <tr> <td><font face="System">My name</font></td> <td><font face="System">2430 0901 0357 815</font></td> </tr> <tr> <td><font face="System">My street</font></td> <td></td> </tr> <tr> <td align="left"><font face="System">My city</font></td> <td width="350"><font face="System"><?php echo date ("dm") ?></font></td> </tr> </table>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.