Jump to content



Member Since 28 Jan 2017
Offline Last Active May 15 2017 09:47 PM

Posts I've Made

In Topic: Settings/db Not Changing When Existing Addon Is Updated (Addon.xml Has New Se...

21 April 2017 - 11:11 PM

tbirnseth, I have a similar issue to the original poster. I'm relatively new to CS-Cart custom development and I'm currently building a custom add-on for my company's store. I expect that this add-on will significantly evolve over the next few months, with changes to the database schema at each iteration. Our current database isn't very big, so data migrations so far have been manageable whenever I need to reinstall the add-on. I'm worried about this becoming a real headache in the future because the add-on works intimately with the product tables, so there are a tonne of table dependencies.


What do you recommend for a deployment workflow when I need to change the database schema? Right now I backup the relevant DB tables, uninstall the addon, install the new addon code via the admin panel, and then restore the DB tables. This works fine if I'm adding a new DB column to the schema that I can default, but this process will break when I have more complex schema changes.


Any recommendations for how I can improve this deployment process?

In Topic: How To Update Select Box Values For Custom Fields Use Rest Api

28 January 2017 - 09:46 PM

OK, I think I've figured this out. When creating a new Profile field that uses a Select Box you need to enter the selections via the "Variants" tab. Each variant is assigned a sequential ID. In my example, here is how the IDs were assigned:


Custom Fields (id: value)

consumer_type = {

"1": "Consumer",

"2": "Charity",

"3": "Non Profit",

"4": "Social Enterprise",

"5": "Liquidator"


supplier_type = {

"6": "Farmer",

"7": "Processor",

"8": "Retailer",

"9": "Wholesaler",

"10": "Distributor"



Now that I know how the IDs are assigned it's easy to reference them, however my integration will break if the CS-Cart admin changes anything in the profile forms. For example, if an admin accidentally deletes a variant value and then adds it back with exactly the same value it'll still be assigned a new ID, thereby breaking my integration.


Is there a way to use the API to query for the field values and IDs so that I can make my code robust to changes by the CS-Cart admin?