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 5 of 5

Thread: Adding Field(s) to table

  1. #1
    zwheeler is offline Junior Member
    Join Date
    Apr 2010
    Posts
    2

    Default Adding Field(s) to table

    Hi All

    I am new to storefront. two weeks old.

    This is my situation. I would like to add a field to the Customer table PCustomerId - varchar(50). this field will relate to the previous ordering system.

    i also need to add the same field to the Order table.

    1. Is there a process that i have go through in order to add a field to the tables: customer and order or do i add them normally.

    2. Based on 1. Where can i go in the code behind to add the PCustomerID field so that when an order is created it will add the PCustomerId to the order table.

    Thanks for a great product
    Any help would be greatly appreciated.

    Zac

  2. #2
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    We actually recommend that you use existing fields in tables for custom information that you need to store, rather than adding to them. That makes upgrading easier in the future. Almost every table has at least one 'ExtensionData' field that can be used to store whatever you need, we don't use those in the core software. If you do want to add columns after checking those out, there's nothing special you should have to do.

    As for #2, we'd really need more info. Where is the software supposed to get the PCustomerID info to write it to the DB? That would have to be entered by the customer or pulled from somewhere first.

  3. #3
    zwheeler is offline Junior Member
    Join Date
    Apr 2010
    Posts
    2

    Default

    ok, thanks Scott

    1. Is there a process that i have go through in order to add a field to the tables: customer and order or do i add them normally.

    I will add the PcustomerData to the extension data field in the Customer Table

    2. Based on 1. Where can i go in the code behind to add the PCustomerID field so that when an order is created it will add the PCustomerId to the order table.

    So based on me putting the information into the extension data field in the customer table. when a user creates an order i want to take the information from the extension data field in CustomerTable and put it in the extension data field in the OrdersTable.

    Where is the best place to do this in the codebehind so when the order is created we store the data in the extension data field from the CustomerTable into the extension data field in the OrderTable.

    Thanks

  4. #4
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    The best way would be as a source code mod, making this part of the Gateway.MakeOrder code. If you don't have source code access, I would do a direct SQL select/insert in orderconfirmation.aspx.cs. At that point you still have the order information available, and the order record has already been created so you can just do an insert.

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

    Default

    But, more importantly, why would you put the pCustomerID in the Orders table if you already have it in the Customer table? That would be redundant. Use the CustomerID column to join Orders and Customer.