Hi,
I would like to know if it is possible to add in some custom fields for the categories. Much like the User object has UserSettings that can be set, I would like to have CategorySettings. I'm not sure if it is already possible or if I have to add a database table and extend classes.
If I do have to add a database table and extend the Categories class, what is the best way to access the database to make the updates?
Thank you for your assistance.
Custom Category Fields
Re: Custom Category Fields
There could be two ways to accomplish this, either through a custom table or making use of custom fields table. Read following thread about custom fields and how to use them
viewtopic.php?f=42&t=8684
Secondly If you want to make use of custom table then data access wouldn't a big problem. Read following thread for auto generating data access code for you.
viewtopic.php?f=47&t=9530
Also read AbleCommerce WIKI for information about custom queries and API
http://wiki.ablecommerce.com/index.php/ ... uilder_API
viewtopic.php?f=42&t=8684
Secondly If you want to make use of custom table then data access wouldn't a big problem. Read following thread for auto generating data access code for you.
viewtopic.php?f=47&t=9530
Also read AbleCommerce WIKI for information about custom queries and API
http://wiki.ablecommerce.com/index.php/ ... uilder_API
Re: Custom Category Fields
I set it up using the custom fields table as you mentioned and it seems to work, the only issue is that when I click "Save" t wont update a FieldName to FK-TableName relationship, it inserts it again. This results in a record for every save and can lead to problems in the future. Am I doing something wrong? or is this a bug that can be fixed?
Re: Custom Category Fields
Most probably you are missing some step in your update script. Update or save process should be as below
1)- Try to load custom field by providing category id and field name to pin point the expected custom field
2)- in case of success you will get a custom field just update its information and then call save method on this loaded object
3)- if load bring nothing then create a new custom field object populate its data and then save it.
1)- Try to load custom field by providing category id and field name to pin point the expected custom field
2)- in case of success you will get a custom field just update its information and then call save method on this loaded object
3)- if load bring nothing then create a new custom field object populate its data and then save it.
Re: Custom Category Fields
ah, it seems i was setting the custom field in the if (!Page.IsPostBack) ... section so I was always getting null. thanks for the help!