Custom Fields / ac_CustomFields table

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
laramp
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Tue Jul 25, 2006 1:01 pm

Custom Fields / ac_CustomFields table

Post by laramp » Fri Oct 24, 2008 11:48 am

Hello,
Hopefully someone has some ideas on this...I need to display a message (taxation message) on the receipt page that would be displayed according to the state of the person buying the this product (cigars).
Tobacco has a different taxation scheme than what can be utilized in the default AbleCommerce 7.0.
The taxation varies from state to state. One state charges a percentage of the total cost, other states charge a flat fee per cigar.
That being the case, my client wants to display just a message telling the buyer that an additional charge will be added to the order.
This message has to be custom for each state because I need to display the tax license number for each state and the fee whether it is per
stick or percentage.

I did create a custom table and have linked it to the ac_taxrules table but I thought it might be better to utilize an existing structure...
if at all possible... for the ease of updates...etc.

There is a table called ac_CustomFields, my question is...What is this table used for and can I use it with the ac_TaxRules table?
Is there documentation for the use of this table?
Thanks in Advance!

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Custom Fields / ac_CustomFields table

Post by mazhar » Fri Oct 24, 2008 12:11 pm

Yes you can use the ac_CustomFields to store your own information. This table is reserved and may be used in future version. There are three classes related to this table.

Stores.CustomField
Stores.CustomFieldCollection
Stores.CustomFieldDataSource

Custom field table can be used to store arbitrary data without having to create a table. The general idea is that in CustomField.TableName you will put the name of the table the data is associated with (e.g. ac_Affiliates for custom data about an affiliate). Then the ForeignKeyId value would be the affiliate ID. Then you can set FieldName (e.g. Favorite Color) and the
Field Value (e.g. Blue).

One note is that you cannot have multiple values using the same FieldName because internally it uses a dictionary structure. There can only be one instance of each "key". Here is a post with something similar as your case and also makes use of the ac_CustomFields table. Please have a look at it.
viewtopic.php?f=42&t=8651

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Custom Fields / ac_CustomFields table

Post by AbleMods » Sun Oct 26, 2008 7:56 am

mazhar wrote:Yes you can use the ac_CustomFields to store your own information. This table is reserved and may be used in future version.
That sounds a bit contradictory. Can you be more specific?

Should we not be using the table at all?
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Custom Fields / ac_CustomFields table

Post by sohaib » Mon Oct 27, 2008 11:57 am

I would think that users can safely use this table the way Mazhar has described ... but we will need to confirm from Logan whether it could cause any upgrade issues in future.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Custom Fields / ac_CustomFields table

Post by AbleMods » Mon Oct 27, 2008 12:02 pm

sohaib wrote:I would think that users can safely use this table the way Mazhar has described ... but we will need to confirm from Logan whether it could cause any upgrade issues in future.
Let's all use it for really weird stuff and see how good he is :)

I've been very interested in leveraging the table. But with so little talk about it, I've been hesitant to commit any clients to the use of it. I appreciate you checking into it to see the impact it would have on future updates.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Custom Fields / ac_CustomFields table

Post by Logan Rhodehamel » Mon Oct 27, 2008 12:39 pm

Everything Mazhar said was true. Just take out the part about it being "reserved". The table is there for developers to take advantage of. The primay goal of this table was to provide a place to put custom data that would not interfere with upgrades or require custom code to access.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Custom Fields / ac_CustomFields table

Post by AbleMods » Mon Oct 27, 2008 1:57 pm

Suweet.

Thanks Logan!
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply