How addresses work when anonymous user is shopping?

Abilnet - November 28, 2008 - 12:43
Project:Ubercart Addresses
Version:5.x-2.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:freixas
Status:closed
Description

Thanks for the important module for Ubercart! ...may I ask for some help, please...

When taking a look at the orders, I can see client addresses normally. When I go to the user profiles, I can see his orders, but NOT his addresses (even if I'm Drupal #1 user with all permissions)

For me it seems, that addresses are not properly saved for later use... OR ...they are saved but not appear in the address list?

Some of my Ubercart settings:
* not requiring to register, anonymous can shop, accounts are created automatically during check out
* Access Control:

  • add/edit addresses ---> anon: NO ---> Authenticated: YES
  • view all addresses ---> NO for all
  • view default addresses ---> NO for all

From the module description:

"Any new addresses entered during the order process are automatically added to the user's list...

Is this the case also when an anonymous user is shopping for the first time and his account is created by Ubercart during check out? ...or is it required to be "logged in" before the addresses are saved during check out?

As the shop in question is quite busy at the moment, I was afraid to "test" with the permissions for anonymous users.

Some help appreciated, thanks!

#1

freixas - November 28, 2008 - 16:31
Assigned to:Anonymous» freixas
Status:active» postponed (maintainer needs more info)

One of the problems with uc_addresses is that it is grafted on to Ubercart. Ubercart came with an address system of its own: each time a user places an order, the address is saved into one of the order systems database tables.

uc_addresses only deals with addresses stored in the user's profile.

The connection between the two is 1) that the user's profile addresses can be used as defaults in placing an order and 2) that when an order is placed, the order's address can also be added to the user's profile.

Since uc_addresses can be added to an existing system, users are not required to have addresses in their profile. However, once uc_addresses is added, any addresses entered by any user (including anonymous users whose accounts are auto-created) should get saved.

To find out if there is a problem, the first test is to look at the uc_addresses table in the database. Does this table exist? Does it have records? Given an arbitrary record, can you identify the corresponding user and then view their address information through the normal Web interface (as user #1)? Are you sure you are user #1?

If the answers are Yes, yes, no and yes, then there is definitely a problem of some sort.

I just checked this feature on my test system and reviewed the code. All permissions go through user_access() and user_access() always returns TRUE for user #1. There may be something special about your setup that is creating a problem.

Let me know what you find.

#2

Abilnet - November 28, 2008 - 21:13

...To find out if there is a problem, the first test is to look at the uc_addresses table in the database. Does this table exist? Does it have records?...

Yes, uc_addresses table exists and there are records. However, there's only one of them (and one of my tests) ...it looks like the record is written manually through the user profile (just like my test)

...Given an arbitrary record, can you identify the corresponding user and then view their address information through the normal Web interface (as user #1)? Are you sure you are user #1?...

Yes, I am logged in as User#1 ...and yes, when I go to the user profile (who has the record in uc_addresses) and who has made a verified order, I can see his addresses from his profile... but ...I can't see his order from his profile!

About the other users, I can see their orders through their profiles, but not addresses (as there are no record in the uc_addresses table)

...There may be something special about your setup that is creating a problem...

I've tried to keep everything as simple as possible... just to avoid problems.

I have the following in permissions:
add/edit addresses ---> anon: NO ---> Authenticated: YES
...should it be:
add/edit addresses ---> anon: YES ---> Authenticated: YES

As a non coder I'm confused and can't find the logic what's up.

Anyhow, thanks for taking your valuable time and taking a look at this, appreciated!

#3

freixas - November 28, 2008 - 22:22

Yes, I am logged in as User#1 ...and yes, when I go to the user profile (who has the record in uc_addresses) and who has made a verified order, I can see his addresses from his profile... but ...I can't see his order from his profile!

The order system is completely separate—can't help you there. I can see both orders and addresses on my test system.

I have the following in permissions:
add/edit addresses ---> anon: NO ---> Authenticated: YES
...should it be:
add/edit addresses ---> anon: YES ---> Authenticated: YES

You need to understand that the permissions are for viewing/editing other people's addresses. Everyone can always view/edit their own address. The #1 user can always view/edit everyone's addresses.

I would not allow either user type to edit other people's addresses. Viewing addresses may also not be a good idea. Set these to NO for everyone except administrators.

It seems that your problem is that people are placing orders (presumably with addresses) and the addresses are not winding up in their profile (i.e. they are not winding up in the uc_addresses table).

I just tried the following test: I had a test user with no addresses and no orders. I signed on as the test user and placed an order. I entered an address. Once the order was finished, I looked at the account information and there was the address. Signing on as administrator, I went to the test user's account and could view both the order and the address.

Then I tried placing an order while logged out. I used my test user's email and entered a completely new address. The order went through but the new address was not added. If everyone is placing their orders anonymously, then you may not get any addresses added. This is definitely a bug, so let me research this a bit more and get back to you.

#4

Abilnet - November 29, 2008 - 09:06

...I used my test user's email and entered a completely new address. The order went through but the new address was not added. If everyone is placing their orders anonymously, then you may not get any addresses added. This is definitely a bug, so let me research this a bit more and get back to you.

Yes, that was exactly the case I was wondering in the first place; does addresses get recorded when an anonymous user is shopping.

Thanks so much taking your time to look at this, appreciated!

#5

freixas - December 14, 2008 - 23:20
Status:postponed (maintainer needs more info)» fixed

Ok, I checked in a fix. Look for the next dev release dated Dec 14 or later.

Please let me know if this fixes your problem.

If an anonymous user places an order, I save the address information in the user's session. When (and if) the order system finds an existing user (by matching the email address), uc_addresses will look to see if there is any saved address information and add it to the matched account.

#6

Abilnet - December 15, 2008 - 15:32
Status:fixed» active

Thank you for the fix. I had to wait a little to get the next order to be able to verify how it works. Sorry to say, but one part of the problem is still there.

When an anon. user is shopping his first time (his email is not yet recorded to the system) ...then the situation remains the same and his address is not saved nor show up in his profile.

Hope this helps.

#7

freixas - December 15, 2008 - 20:34
Status:active» postponed (maintainer needs more info)

I can't reproduce your problem. I just went to my test system without logging in and placed an order with a completely new e-mail address. A new account was created and I received a username and password. When I went to the newly created account and checked on the addresses, the address I had entered with the order had been copied to the account's profile.

I had actually tested this before checking in the fix, so I was surprised you had a problem.

There may be some difference in the way your system is set up vs. mine, but I couldn't find a setting that would explain the different results we are getting.

#8

Abilnet - December 16, 2008 - 09:14

Hmm... strange. I have quite a simple installation, nothing special. The "uc_addresses" upgrade I used, was dated on 15th. Dec. and can't see any related error messages. However, I just upgraded once again, complete deleted the earlier folder as before, then run "update.php" to empty the cache.

I'll take a look for a couple of more orders and report back.

Thanks for your help, appreciated!

#9

Abilnet - December 18, 2008 - 23:40

I've monitored the situation on a live site and unfortunately the addresses are not saved when an anonymous user is shopping (unfortunately I've not any data of a case, does addressed get saved if the user already has his email saved on the system)

I've tried to find out, if there's something special in the configuration, but as far as I understand, the configuration of the shop in question is very simple & basic.

Does someone else have any information, if the addresses are saved or not, when an anonymous user is shopping?

Thanks!

#10

freixas - December 19, 2008 - 00:14

Sorry to hear you continue to have problems. It works OK for me so it's difficult to figure out what to fix.

Go through your watchdog log and see if there are any error messages that might be relevant. One problem got fixed that way.

By the way, it really helps to have a testing system that is a clone of the live system.

#11

freixas - December 29, 2008 - 23:00
Status:postponed (maintainer needs more info)» closed

Closed due to inability to reproduce and because the site experiencing the problem is temporary and may have already been shut down.

 
 

Drupal is a registered trademark of Dries Buytaert.