Adding a new #__jd_donors column for a new Custom Field

  • Dave
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
2 months 1 week ago #117134 by Dave
Hello. I used backend Custom Field tab to create a new Custom Field: 'district'.

The new 'district' field displays properly on my Donation Form.

The new 'district' field is present in the #__jd_fields table, but not present in the #__jd_donors table.

I manually added the new 'district' field to the #__jd_donors table, so that it would be part of my donor database and also available to call for reports.

Today I will try to confirm that a submitted Donation Form will successfully write user 'District' data to the #__jd_donors table.

1st question:
I notice that my new 'district' field is absent from the sql files contained in
root/administrator/components/com_jdonation/sql/ folder.
Does this mean that future updates will cause my new field and all of its data to vanish due to the update re-writing tables without my custom 'district' field?

2nd question:
If the new 'district' field exists in the Custom Field Tab, and is displayed on the Donation Form page, and is available as a new column in the #__jd_donors table, is anything else required for the JD system to write 'district' data into the jd_donors table at each Donation Form succeed?
I have searched your code to find specific write commands that specify writing fields into database columns, but I cannot find it.

Suggestions?

Thanks!

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #117144 by Mr. Dam
Hi Dave,
You can add any column into table: #__jd_donors, and this column won't be effect when you install newer Joom Donation version.
But you should modify the Donation layout (Both Back-end and Front-end) to show that field. And remember if you modify layout files, they will be overridden when you install newer Joom Donation version.
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Dave
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
2 months 1 week ago #117147 by Dave
Thanks!

Yes, I have modified layout files to show field. I keep a list of core-mods to repeat after update. I try to keep core-mods to a minimum.

2nd question:
Test transactions from localhost are not helpful.
I will have to go live to test complete site function.
Until then, I don't know if Donation-Form-Success will write data for new 'district' field to #__jd_donors table.

Can you help with that question?
If front-end Donation Form has a field for 'District',
and if #__jd_donors table has column for 'district',
will the JD app write the district data to the table after each Donation-Form success, or is some other code-step necessary?

I cannot test this until i go live. That is why I'm asking you.

Thx!

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #117315 by Mr. Dam
Hi,
Why don't you add new Custom field "District", i think that's the simplest way because the field will still be shown in Donation form and the entered value will be stored in database without any modifying.
Thanks
Dam

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamDũng Nguyễn Việt