Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 12 of 12

Thread: Retrieve Customer's Email Address?

  1. #1
    donato is offline Senior Member
    Join Date
    Jun 2009
    Posts
    215

    Default Retrieve Customer's Email Address?

    I wanted to know if there was a way to String a customer's email address if they are logged in? I need to retrieve this email address for various uses. . .

    I would also like to retrieve other fields, such as their first name, last name, address, city, state, zip, et cetera. . . for sending custom emails to Customer Service for service requests.

    We are on v8.0.1.2.

    Thank you,

    ~D
    Last edited by donato; 07-09-2010 at 06:24 AM.

  2. #2
    ZachJ85 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philadelphia, PA
    Posts
    99

    Default

    To grab just that info?

    Code:
    if (ThisCustomer.IsRegistered)
    {
    FirstName.Text = ThisCustomer.FirstName; LastName.Text = ThisCustomer.LastName; EMail.Text = ThisCustomer.EMail.ToLowerInvariant().Trim(); Phone.Text = ThisCustomer.Phone;
    }

    This will get you going. Checks if they are registered then uses ThisCustomer to populate the strings.
    SQL 2008, Visual Studio 2010
    Source: C#
    Version: AspDotNetStorefront ML 8.0.1.1/8.0.1.1
    Framework: .Net 4.0 (Running)

  3. #3
    donato is offline Senior Member
    Join Date
    Jun 2009
    Posts
    215

    Default

    Thank you. I actually just found this in the namespace and in the account.aspx page. . . I'll give this a shot.

    Thanks again!

  4. #4
    donato is offline Senior Member
    Join Date
    Jun 2009
    Posts
    215

    Default

    Quote Originally Posted by ZachJ85 View Post
    To grab just that info?

    Code:
    if (ThisCustomer.IsRegistered)
    {
    FirstName.Text = ThisCustomer.FirstName; LastName.Text = ThisCustomer.LastName; EMail.Text = ThisCustomer.EMail.ToLowerInvariant().Trim(); Phone.Text = ThisCustomer.Phone;
    }

    This will get you going. Checks if they are registered then uses ThisCustomer to populate the strings.
    What about grabbing their address?

  5. #5
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    Surely that only gets information of registered customers and NOT logged in customers. For logged in you'd have to look at the CustomerSession table and join that to the Customer table and then determine if they were registered, otherwise they are an anonymous customer.

  6. #6
    donato is offline Senior Member
    Join Date
    Jun 2009
    Posts
    215

    Default

    Quote Originally Posted by esedirect View Post
    Surely that only gets information of registered customers and NOT logged in customers. For logged in you'd have to look at the CustomerSession table and join that to the Customer table and then determine if they were registered, otherwise they are an anonymous customer.
    That's what what I want. . . I want to get that information from a registered customer.

    Thank you.

  7. #7
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    select * from customer
    where customerid in (select customerid from customersession)
    and isregistered=1

    Not an exact science, since the customer may have disappeared from the session. You could check the [lastactivity] field in [customersession] to see if it's within the last hour.

    The you'd want to join to the [address] table to get their address on either the [billingaddressid] or [shippingaddressid]

  8. #8
    donato is offline Senior Member
    Join Date
    Jun 2009
    Posts
    215

    Default

    So, there's no easy way of just stringing out their address - like their first name, last name, et cetera. . . ?

  9. #9
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    Where/when do you want to do it?

    From within the admin application? Or using SQL Server Management Studio? Or from another application?

  10. #10
    ZachJ85 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philadelphia, PA
    Posts
    99

    Default

    Quote Originally Posted by esedirect View Post
    select * from customer
    where customerid in (select customerid from customersession)
    and isregistered=1

    Not an exact science, since the customer may have disappeared from the session. You could check the [lastactivity] field in [customersession] to see if it's within the last hour.

    The you'd want to join to the [address] table to get their address on either the [billingaddressid] or [shippingaddressid]

    He wants info for ONLY registered users.

    Wouldn't ThisCustomer.IsRegistered handle the same thing as your query? If they are registered then ThisCustomer.Whatever will grab the data he needs. If they aren't registered or not logged in it won't grab that data.
    SQL 2008, Visual Studio 2010
    Source: C#
    Version: AspDotNetStorefront ML 8.0.1.1/8.0.1.1
    Framework: .Net 4.0 (Running)

  11. #11
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    In his original post he says 'logged in'. But he doesn't say what application he wants to use as his client.

  12. #12
    donato is offline Senior Member
    Join Date
    Jun 2009
    Posts
    215

    Default

    Quote Originally Posted by esedirect View Post
    In his original post he says 'logged in'. But he doesn't say what application he wants to use as his client.
    I'm not sure what you mean by which application. I want logged-in registered users. I'm all set now though. . . I used the fields from the PrimaryShippingAddress object.