Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with Addresses


quantrum

Recommended Posts

Posted

Hi,

 

I've had a fully working site for a couple of months, and it wasn't until a client mentioned it to me that I realized, but the addresses aren't loading up on any page that requires it (such as address book, checkout billing and shipping pages), all that I can get it to call up is the company name. I've tried all sorts to get the addresses to call up, but I can't find a way, can anyone help.

 

<tr>
                   <td class="main" align="center" valign="top"><?php echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
                   <td class="main" valign="top"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
                 </tr>

 

the above code is off the Checkout_shipping.php page, and i've not altered it (well have, but always kept a backup and have placed the original back now)

 

and below is where the funtion is actually defined in the general.php page.

 

////
// Return a formatted address
// TABLES: customers, address_book
 function tep_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n") {
   if (is_array($address_id) && !empty($address_id)) {
     return tep_address_format($address_id['address_format_id'], $address_id, $html, $boln, $eoln);
   }

   $address_query = tep_db_query("select entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$address_id . "'");
   $address = tep_db_fetch_array($address_query);

   $format_id = tep_get_address_format_id($address['country_id']);

   return tep_address_format($format_id, $address, $html, $boln, $eoln);
 }

 

can anyone help here ? thanks in advance

 

Regards,

Mark

  • 2 weeks later...
Posted

Can you post a link to your store?

 

Hi really sorry that this reply took so long, I've been away and just got back this weekend.

 

The store address is here Economeyes

 

thanks for the help

Posted

Have you checked that $sendto has an appropriate value? The default is 1, so if it's 0, you might not get many matches in the query. You can look in phpMyAdmin and see if all/most of the address_book_id fields are a given value. Where does $sendto come from? Is it being passed implicitly as a register global variable? Maybe those are turned "off". What version of osC are you using (2.2 MS2 and earlier, and many add-ons, depend on them being "on"). Anyway, the first thing is to check that an appropriate value is being used that will result in a successful database query.

Posted

Hi MrPhil,

 

thanks for the reply. Where would I find the $sendto value to check ? I'm running version 2.2 with very few add-ons, in fact I think the only add-on I am running is 'dob_change_v1.0c'. I checked through the database and every field that requires information is filled, and no id's are duplicated or anything like that either.

Posted

In your first post, you showed some calls to tep_address_label() that used $sendto as the second argument. From that point, trace backwards in the code until you find what $sendto is set to. It should be a number corresponding to the first field in the address_book table. Then you need to use phpMyAdmin to look at the appropriate table in the database to see if that value is being used in the address_book_id field. If they don't match up, that will keep the database from returning a match.

 

You need to check that your address_book table has an entry for each customer, and the customers_id field matches up with the customers_id field in the customers table. The address_book_id doesn't seem to be used anywhere, so I wonder why it's there (future use?). Anyway, you need to find where they get the $sendto value, and whether it matches up with that field in the table. If $customer_id doesn't match up with a customers_id (note the dropped 's'... that might indicate a problem... see if $customers_id is used before) and $sendto doesn't match up with the corresponding address_book_id, you won't get a match and the information won't be printed.

Posted

I've been trying all sorts, I read back through every page regarding checkouts, and account details, and i've found nowhere at all seems to be showing addresses, only company names. I've checked through the $sendto fields and I've looked through the database and everything seems ok, every customer has its own unique id field and thats all ok, and I'm a little bit more confused then when I started now.

 

Thanks again for all of the help, I really appreciate this

 

In your first post, you showed some calls to tep_address_label() that used $sendto as the second argument. From that point, trace backwards in the code until you find what $sendto is set to. It should be a number corresponding to the first field in the address_book table. Then you need to use phpMyAdmin to look at the appropriate table in the database to see if that value is being used in the address_book_id field. If they don't match up, that will keep the database from returning a match.

 

You need to check that your address_book table has an entry for each customer, and the customers_id field matches up with the customers_id field in the customers table. The address_book_id doesn't seem to be used anywhere, so I wonder why it's there (future use?). Anyway, you need to find where they get the $sendto value, and whether it matches up with that field in the table. If $customer_id doesn't match up with a customers_id (note the dropped 's'... that might indicate a problem... see if $customers_id is used before) and $sendto doesn't match up with the corresponding address_book_id, you won't get a match and the information won't be printed.

  • 1 month later...
Posted

Just wondering if anyone has any ideas as to how to solve this issue. Sorry to be a pain,

 

I've found out last night that when an order is placed internationally (not UK) the address DOES appear on the pages, which has now confused me even more.

 

Any help is greatly appreciated

Archived

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

×
×
  • Create New...