Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Whats the difference (int)tep_session_is_registered('customer_id') / (int)$customer_id


Recommended Posts

Working in our 2.3.1 test shop and I found a problem that makes no sense to me.


I imported over our live database information to our test site.


Logged in then went to my address_book page. It was displaying the wrong addresses, so I decided to check the query and found



I echoed this variable and it was giving a customer id of 1 no mater which account I logged in as.


So I changed the address_book.php query to that of our version 2.2

 $addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_street_address_2 as street_address_2, 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)$customer_id . "' order by firstname, lastname");

Which uses (int)$customer_id instead of (int)tep_session_is_registered('customer_id'). Now all the address book information is correct.


That said, I want to be sure that the problem with (int)tep_session_is_registered('customer_id') not working is not indicative of something else I should be fixing.

When I echo its value I get a value of 1 no matter which account I log in as, what computer I log in from, or how many different browsers and accounts I log in with.


Any thoughts or insights would be greatly appreciated.

Link to comment
Share on other sites

(int)tep_session_is_registered('customer_id') only determines whether the customer is registered/logged in. It has nothing to do with the customer ID. However, $customer_id will not be valid if the customer is not logged in.




See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I just looked at a unmodified copy of the file, while I don't remember changing this query, its possible I did and used the wrong variable. Anyway, by default it uses the (int)$customer_id


Not sure what I did, but that confused the hell out of me.


Thanks Jim,



Link to comment
Share on other sites


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

  • Create New...