Page 1 of 1

Adding our own fields to a table, sales receipt

Posted: Mon Oct 18, 2010 1:24 pm
by Brewhaus
In order to help track sales to specific customers (or more accurately, to allow our export / import software to properly attribute sales to the correct sales rep) we would like to add one or two fields to the Users table (actually, it likely needs to be added to the Addresses table). Then, we would need this to be used as part of the information included with each sale (although we would not include it on the printed invoice).

If we add fields to the Addresses table, will we start having problems? Or, will adding a couple of fields have no real effect on the operation of our site?

And, if we are able to add the fields with no negative effect, are we able to include it in the information assembled for the order without having it display on the invoice? From there we should easily be able to export and import, as we already have a custom written exporter that exports our end of day for importing into our accounting package, and can easily route the information correctly.

Re: Adding our own fields to a table, sales receipt

Posted: Tue Oct 19, 2010 4:40 am
by mazhar
You can't add custom fields in tables them selves because in this case API code will not be aware of such fields so system will not load/save values in those fields for you. If you want to have a custom field in Address table then instead of creating new column use existing NickName column which is unused for now. If you need more then one fields then you can try user settings features.

Re: Adding our own fields to a table, sales receipt

Posted: Tue Oct 19, 2010 6:43 am
by jmestep
You can add fields, but you would need to create code to handle them and they might break an upgrade later on. When we have run into a case like that, we have added entries to the ac_UserSettings table then migrated the content over to the ac_CustomFields table with a tablename of ac_Orders from code on the ReceiptPage. There is code on the forum to show you how to pull the data out of the ac_CustomFields table.
We do it on the receipt page because the one page checkout is very complicated and custom things get lost in postbacks unless they are after the shipping address shows and sometimes customers want the input to show before that. We have fooled for hours and hours with the one page checkout it's a lot easier to circumvent it instead of try to coordinate with it.
You also need to add code on the one page checkout to migrate the user settings when the user is migrated because in older versions, Able didn't do that. I haven't checked 705 to see if they do it yet.

Re: Adding our own fields to a table, sales receipt

Posted: Tue Oct 19, 2010 7:18 am
by Brewhaus
I think that I understand what you are saying- we need to use ac_UserSettings and ac_CustomFields to 'match' a field from ac_Orders (for example, the company name). If the company name matches, then a field in ac_CustomFields is included in the receipt. Is that correct? If so that is great... I just don't know how to go about this.

Just to confirm- we do not need the 'custom' information to show on the receipt. We just need it to be part of the stored information for the order so that when we export the order information (with our custom exporter that you helped write) this custom information is included.