<CustomerLevelID>0</CustomerLevelID> <RegisterDate>5/15/2009</RegisterDate> <EMail>email@somthing.com</EMail> <Password>test123</Password> <FirstName>Name</FirstName> <LastName>Name</LastName>" /> Adding Billing and Shipping Address when adding New Customers
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 15 of 15

Thread: Adding Billing and Shipping Address when adding New Customers

  1. #1
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default Adding Billing and Shipping Address when adding New Customers

    Below is the example I got from the manual. How do you set which address is the billing or shipping address when creating a new customer?

    <AspDotNetStorefrontImport Verbose="false">
    <Customer Action="Add">
    <CustomerLevelID>0</CustomerLevelID>
    <RegisterDate>5/15/2009</RegisterDate>
    <EMail>email@somthing.com</EMail>
    <Password>test123</Password>
    <FirstName>Name</FirstName>
    <LastName>Name</LastName>
    <Phone>111-111-1111</Phone>
    <OkToEMail>1</OkToEMail>
    <IsAdmin>0</IsAdmin>
    <BillingAddress />
    <ShippingAddress />
    <Over13Checked>1</Over13Checked>
    <StoreCCInDB>1</StoreCCInDB>
    <AdminCanViewCC>1</AdminCanViewCC>
    <IsRegistered>0</IsRegistered>
    <PwdChangeRequired>0</PwdChangeRequired>
    <Active>1</Active>
    <Addresses AutoCleanup="false">
    <Address Action="Add">
    <FirstName>Name</FirstName>
    <LastName>Name</LastName>
    <Company>Company Name</Company>
    <Address1>123 Shipping Address St</Address1>
    <Address2>
    </Address2>
    <Suite>
    </Suite>
    <City>San Francisco</City>
    <State>CA</State>
    <Zip>55555</Zip>
    <Country>United States</Country>
    <ResidenceType>0</ResidenceType>
    <Phone>111-111-1111</Phone>
    <Email>email@something.com</Email>
    </Address>
    <Address Action="Add">
    <FirstName>Name</FirstName>
    <LastName>Name</LastName>
    <Company>Company Name</Company>
    <Address1>123 Billing Address St</Address1>
    <Address2>
    </Address2>
    <Suite>
    </Suite>
    <City>San Francisco</City>
    <State>CA</State>
    <Zip>55555</Zip>
    <Country>United States</Country>
    <ResidenceType>0</ResidenceType>
    <Phone>111-111-1111</Phone>
    <Email>email@something.com</Email>
    </Address>
    </Addresses>
    </Customer>
    </AspDotNetStorefrontImport>
    ...AllStar

  2. #2
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    I'm sure we support that. I have to go check the syntax
    Last edited by Rob; 05-15-2009 at 05:22 PM.
    AspDotNetStorefront
    Shopping Cart

  3. #3
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default

    Any update yet?
    ...AllStar

  4. #4
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default

    Is there an attribute that I can add to the node <address>? This should be listed in the manual...
    ...AllStar

  5. #5
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    In the customer table, there are fields named ShippingAddressId and BillingAddressId, the value of these should be the AddressID from the Address table. If the customer has two different addresses (shipping/billing), you should place the corresponding addressid in ShippingAddressId/BillingAddressId node.

    e.g.
    Code:
    <ShippingAddressID>125<ShippingAddressID>
    <BillingAddressID>127<BillingAddressID>

  6. #6
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default

    Alfred, what you're specifying are addresses that already exist in the address table. I understand that much from reading the manual.

    Perhaps you misunderstood me. I'm asking how do you set which address is the billing or shipping address when CREATING a new customer? To clarify things, in the example I gave above, is there an attribute that I can add to the node <address> to specify which address is the billing/shipping?
    Last edited by allstar; 05-20-2009 at 02:21 PM.
    ...AllStar

  7. #7
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    Need G1 to chime in here. I think this is something WSI doesn't do, but could...You could do it as a 2 step process via WSI now, but I agree, it should be able to be done/added in one pass.
    AspDotNetStorefront
    Shopping Cart

  8. #8
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default

    Would be a good feature to have.
    ...AllStar

  9. #9
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    The only way to do this at the same time that you are adding the customer is to specify unique identifiers for the addresses when you create them. You can then reference those unique identifiers in the BillingAddress and ShippingAddress nodes of the customer node. For example:
    Code:
    <Customer Action="Add">
      <EMail>email@address.com</EMail>
      <Password>password</Password>
      <FirstName>First Name</FirstName>
      <LastName>Last Name</LastName>
      <BillingAddress GUID="f98fe683-4efa-4ce6-909e-1d5e7a4a8531"/>
      <ShippingAddress GUID="e86c1be1-abca-4be0-a6e1-b0735c19d4a9"/>
      <Addresses>
        <Address Action="Add" GUID="f98fe683-4efa-4ce6-909e-1d5e7a4a8531">
          <FirstName>First Name</FirstName>
          <LastName>Last Name</LastName>
          <Address1>123 Main St.</Address1>
          <City>City</City>
          <State>OH</State>
          <Country>United States</Country>
          <Zip>44145</Zip>
          <Phone>1234567890</Phone>
          <EMail>email@address.com</EMail>
        </Address>
        <Address Action="Add" GUID="e86c1be1-abca-4be0-a6e1-b0735c19d4a9">
          <FirstName>Shipping Address First Name</FirstName>
          <LastName>Shipping Address Last Name</LastName>
          <Address1>123 Main St.</Address1>
          <City>Shipping Address City</City>
          <State>OH</State>
          <Country>United States</Country>
          <Zip>44145</Zip>
          <Phone>1234567890</Phone>
          <EMail>email@address.com</EMail>
        </Address>
      </Addresses>
    </Customer>
    The flow here is that the customer is created, then the addresses are created with an AddressGUID that is the one specified in the Address nodes, and then the customer record is updated with the AddressIDs that WSI finds based on the GUID you are passing in BillingAddress and ShippingAddress. When I run this, I get
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <AspDotNetStorefrontImportResult Version="" DateTime="5/21/2009 3:44:37 PM">
      <Item NodeType="Customer" Name="" GUID="0D9C8742-A97C-4126-BD30-6DC681D93C1D" ID="58748" ActionTaken="Add" Status="OK" Message="" />
      <Item NodeType="Address" Name="" GUID="f98fe683-4efa-4ce6-909e-1d5e7a4a8531" ID="124" ActionTaken="Add" Status="OK" Message="" />
      <Item NodeType="Address" Name="" GUID="e86c1be1-abca-4be0-a6e1-b0735c19d4a9" ID="125" ActionTaken="Add" Status="OK" Message="" />
    </AspDotNetStorefrontImportResult>
    so my addresses were created with IDs 124 and 125. If you go and take a look at the customer record after running this, you'll see that the BillingAddressID is correctly set to 124 and the ShippingAddressID is correctly set to 125
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  10. #10
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default

    George, your example did work. However, aren't these unique identifiers generated on the storefront side? How can I get these unique identifiers when the addresses don't exist in the DB yet? Are the unique identifiers you specified in your examples defaults?
    Last edited by allstar; 05-21-2009 at 01:14 PM.
    ...AllStar

  11. #11
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    No...they are random. If you do not specify a GUID when creating the address they are created using a random GUID that the database generates. However if you do specify one, it will be inserted into the database with that GUID instead of the random one. It's really simple to generate new random GUIDs...you could even create a little desktop application that would generate a GUID at the click of a button (System.Guid.NewGuid().ToString()). You could then copy/paste into your xml that you are running through WSI.

    So...using the XML I provided in my last post, you can replace the GUID in the address with any random GUID that you want. As long as you then specify the same GUID in the BillingAddress or ShippingAddress node the application knows not to process the BillingAddress or ShippingAddress nodes until after it has processed the Address nodes, which are created with the GUID that you specify. If you leave out the GUID when creating the Address, there is no way to designate the address as a billing or shipping address for the customer until the next import.
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  12. #12
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    Here you go. A simple little executable with a text box and a button. Every time you need a new GUID to create a new address, just open it up and go
    Attached Files Attached Files
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  13. #13
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default

    This is probably the only work around that will work since there is no such attribute in the address node to identify which address is billing/shipping when adding a new customer.

    I would rather have it to be a one step process. Perhaps, this could be added on the TO DO LIST for the new WSI update. George, thank you for the suggestion.

    UPDATE:
    George suggestion is a quick and easy fix. :-)

    EXAMPLE (C#):
    //create new GUID
    string guidBillingResult = System.Guid.NewGuid().ToString();
    string guidShippingResult = System.Guid.NewGuid().ToString();

    Plug the newly created GUID ID's into the GUID attribute of the address node that George used in his example.
    Last edited by allstar; 05-21-2009 at 03:47 PM.
    ...AllStar

  14. #14
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    We need to make this 1-pass possible. Sending to Dev here...
    AspDotNetStorefront
    Shopping Cart

  15. #15
    TheSkyWinner is offline Junior Member
    Join Date
    Jul 2010
    Posts
    5

    Thumbs up

    Quote Originally Posted by George the Great View Post
    The only way to do this at the same time that you are adding the customer is to specify unique identifiers for the addresses when you create them. You can then reference those unique identifiers in the BillingAddress and ShippingAddress nodes of the customer node. For example:
    Code:
    <Customer Action="Add">
      <EMail>email@address.com</EMail>
      <Password>password</Password>
      <FirstName>First Name</FirstName>
      <LastName>Last Name</LastName>
      <BillingAddress GUID="f98fe683-4efa-4ce6-909e-1d5e7a4a8531"/>
      <ShippingAddress GUID="e86c1be1-abca-4be0-a6e1-b0735c19d4a9"/>
      <Addresses>
        <Address Action="Add" GUID="f98fe683-4efa-4ce6-909e-1d5e7a4a8531">
          <FirstName>First Name</FirstName>
          <LastName>Last Name</LastName>
          <Address1>123 Main St.</Address1>
          <City>City</City>
          <State>OH</State>
          <Country>United States</Country>
          <Zip>44145</Zip>
          <Phone>1234567890</Phone>
          <EMail>email@address.com</EMail>
        </Address>
        <Address Action="Add" GUID="e86c1be1-abca-4be0-a6e1-b0735c19d4a9">
          <FirstName>Shipping Address First Name</FirstName>
          <LastName>Shipping Address Last Name</LastName>
          <Address1>123 Main St.</Address1>
          <City>Shipping Address City</City>
          <State>OH</State>
          <Country>United States</Country>
          <Zip>44145</Zip>
          <Phone>1234567890</Phone>
          <EMail>email@address.com</EMail>
        </Address>
      </Addresses>
    </Customer>
    The flow here is that the customer is created, then the addresses are created with an AddressGUID that is the one specified in the Address nodes, and then the customer record is updated with the AddressIDs that WSI finds based on the GUID you are passing in BillingAddress and ShippingAddress. When I run this, I get
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <AspDotNetStorefrontImportResult Version="" DateTime="5/21/2009 3:44:37 PM">
      <Item NodeType="Customer" Name="" GUID="0D9C8742-A97C-4126-BD30-6DC681D93C1D" ID="58748" ActionTaken="Add" Status="OK" Message="" />
      <Item NodeType="Address" Name="" GUID="f98fe683-4efa-4ce6-909e-1d5e7a4a8531" ID="124" ActionTaken="Add" Status="OK" Message="" />
      <Item NodeType="Address" Name="" GUID="e86c1be1-abca-4be0-a6e1-b0735c19d4a9" ID="125" ActionTaken="Add" Status="OK" Message="" />
    </AspDotNetStorefrontImportResult>
    so my addresses were created with IDs 124 and 125. If you go and take a look at the customer record after running this, you'll see that the BillingAddressID is correctly set to 124 and the ShippingAddressID is correctly set to 125
    George the Great....Thanks a lot for your post, it saved hours of time...

    Thanks once again.