How / where to write into the database in an override php file's source code (which is a classified ad sender form)

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
adams1
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Fri May 12, 2017 7:34 am

How / where to write into the database in an override php file's source code (which is a classified ad sender form)

Post by adams1 » Tue Jan 30, 2018 3:50 pm

Hi!
I can't find where and how to write into the database from an extension's php override file source code (which creates the content/ad sender form of classified ads extension AdsManager.) I can't even find anything that contains the string "sql" in this file (so the file is: templates\protostar\html\com_adsmanager\edit\default.php). Maybe it passes the data to an other PHP file/object.
(The database table is created by the extension at install.)
If it's necessary I can insert the code of the php file (or other codes as well).
I'm using Joomla 3.8.x with AdsManager extension.

adams1
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Fri May 12, 2017 7:34 am

Re: How / where to write into the database in an override php file's source code (which is a classified ad sender form)

Post by adams1 » Fri Feb 02, 2018 6:21 pm

Someone? I think it's not a huge problem, though I don't know MySQL and am not even a PHP pro.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 24745
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: How / where to write into the database in an override php file's source code (which is a classified ad sender form)

Post by Per Yngve Berg » Sat Feb 03, 2018 10:37 am

The override will replace the Output (Layout) of the component. It does not contain the logic for writing to the database, as that is in the model of the component.

You have not told what you want to change in the component, but changes to the database can be done by writing a Plugin for the component.

https://docs.joomla.org/Plugin

adams1
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Fri May 12, 2017 7:34 am

Re: How / where to write into the database in an override php file's source code (which is a classified ad sender form)

Post by adams1 » Sat Feb 03, 2018 8:24 pm

Per Yngve Berg wrote:The override will replace the Output (Layout) of the component. It does not contain the logic for writing to the database, as that is in the model of the component.

You have not told what you want to change in the component, but changes to the database can be done by writing a Plugin for the component.

https://docs.joomla.org/Plugin
The override php file creates a form where there are custom fields (can be managed / set from the backend).
I would like to achieve that if I set two fields in AdsManager to this form, those two values would be written in two specific fields of the AdsManager's ads database table (actually: creation date or publication date, expiration date).
Also when I post the form I would like to disable the automatic write of these two fields (when the user posts an ad by default publication date and expiration date is automatically set - I want to avoid this and would like to set these by the two custom fields, given by the users.)
It does not contain the direct writing to database but sends data from the fields, where?
Also where can I disable the automatic write of the two mentioned fields to database, on form submit?


Post Reply

Return to “Joomla! 3.x Coding”