osCmax v2.5 User Manual
Results 1 to 5 of 5

Primary Address Changing After Session Timeout

This is a discussion on Primary Address Changing After Session Timeout within the osCommerce 2.2 Discussion forums, part of the osCommerce 2.2 Forums category; Hi Guys, I'm having a problem with my address book. In particular, when I go into the address book and ...

      
  1. #1
    New Member
    Join Date
    Sep 2008
    Posts
    10
    Rep Power
    0


    Default Primary Address Changing After Session Timeout

    Hi Guys,

    I'm having a problem with my address book. In particular, when I go into the address book and change one of the addresses to "Primary Address", the Primary Address changes to a different address after the session times out.

    It's giving me a bit of a headache trying to figure this one out. I've checked the database and the Primary Address is set to the selected address after I go into address_book_process.php and set the desired Primary Address. However, upon timeout of the session (i.e. the customer is automatically logged out after being idle for too long, or returns to the account the next day for example), the database value is rewritten to a different default address.

    I think something is being written incorrectly into the session, but haven't been able to find a solution. Has anyone come across this or have any ideas for a fix?

    Thanks!

  2. #2
    New Member
    Join Date
    Sep 2008
    Posts
    10
    Rep Power
    0


    Default Re: Primary Address Changing After Session Timeout

    Well, it took over a week to find the cause but I got it
    The problem didn't stem from session timeouts, but from a coding issue in the admin section.

    For anyone else who experiences this (it's a standard installation of oscmax, so this should affect everyone), there's a dodgy piece of code in admin/customers.php:

    Code:
    <?php // BOF: MOD - Edit Order - Ajout/edite commande et compte client
      $customersrecords = mysql_query("SELECT * FROM customers") or die ("Wha Happen??? Error 1");
      while($customerrows = tep_db_fetch_array($customersrecords)) {
        $e = mysql_query("SELECT * FROM address_book WHERE customers_id ='$customerrows[customers_id]'") or die ("What Happen??? Error 2"); 
        $real = tep_db_fetch_array($e);
        $updatedefaultaddress = mysql_query("UPDATE customers SET customers_default_address_id = '$real[address_book_id]' WHERE customers_id='$customerrows[customers_id]'") or die ("What Happen??? Error 3");
      }
    // BOF: MOD - Edit Order - Ajout/edite commande et compte client ?>
    Whenever customers.php is accessed through admin, it will update every customer's primary address to the first entry for that customer in the 'address_book' table.

    Hope this saves someone else some time!

  3. #3
    New Member
    Join Date
    Sep 2008
    Posts
    10
    Rep Power
    0


    Default Re: Primary Address Changing After Session Timeout

    I probably should have said, just delete the code above from your customers.php file to remove this bug.
    See oscMax in action at Gifty Gifts

  4. #4
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default Re: Primary Address Changing After Session Timeout

    Could anyone else confirm this please? Makes me wonder why this hasn't gone on the bugtracker or what on earth that code is supposed to do in there...

  5. #5
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default Re: Primary Address Changing After Session Timeout

    It was never reported, so that is why it was never in the bugtracker. The bug has been documented now:
    http://bugtrack.oscmax.com/view.php?id=256


    I just checked the order editor mod, and this is in fact deprecated code that should be removed.

    This was fixed in the order editor mod as of v1.72, so osCMax does need this bugfix too:
    v1.72
    Modified so that Customer, Shipping, and Billing address fields are all displayed and are editable. My versions are built off v1.61b and in that version only Billing and Shipping address fields were shown, except that the info for Billing Address was being taken from Customer Address fields which is WRONG WRONG WRONG.

    When done this way, any time you updated an order, the customer address information would overwrite the billing address information. I changed that so it makes sense.

    Also I added a line into the language definition file so that you can have "Customer Address" as a table heading as well as just "Address" as a line heading.

    Which reminds me, I have not updated any of the included language definition files besides the english version for the changes I have made. Sorry. If you are using any of the other languages on your shop, you will have to update the appropriate language definition files.
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

Similar Threads

  1. Timeout for Admin-NOW I'm mad!
    By Mushroom in forum osCMax v2 Features Discussion
    Replies: 14
    Last Post: 11-26-2007, 10:22 AM
  2. customer primary address not set when new account created?
    By chrismole in forum osCmax v2 Customization/Mods
    Replies: 10
    Last Post: 04-06-2006, 04:07 PM
  3. RC2 Bug? Changing address from checkout_shipping_address.ph
    By Redeye_Joe in forum osCmax v2 Installation issues
    Replies: 1
    Last Post: 01-29-2006, 11:17 AM
  4. primary address doesn't show
    By gmartini42 in forum osCmax v1.7 Discussion
    Replies: 2
    Last Post: 02-06-2005, 04:56 PM
  5. changing store name/address -- can't remember how I did it!
    By gheffron in forum osCmax v1.7 Discussion
    Replies: 3
    Last Post: 04-12-2004, 11:11 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •