Hello,
I have a form for ordering the latest issue of a magazine and I wonder if it is possible to put a field into the form that auto fetches the title of the latest article in a specific category in Joomla? For example if the latest article has the title "[The Magazine Name] # 1 -2019 [Theme Name]" could be auto displayed in the form both for the buyer and in the form message delivered to the publisher?
Hope you understand my purpose.
Best regards
Yes, easily. Just get the #__content first matching order by created data descending, where catid = the category ID you want.
Thanks!
May I ask you to describe a little more how this is done, this is a bit beyond my knowledge so far. What kind of field do I need to configurate and what would be the code?
Best regards
Ps. I downloaded your shortcodes. Interesting, it opens a window to things I have not done with Chronoforms yet, but I am not experienced enough to be able to work it out without further clues.
Read data. Read the table #_content.
In the where conditions put catid = xxx replacing xxx with the ID of the specific category you want
In Order Fields put "created" set to descending
Set the action to Return First Matching
Then use {var:read_data#.model.title} where you want the title displayed, replacing # with the number in the black label of your read data action.
is created in your fields to retrieve as well?
I think the problem may occur in the "Fields to retrieve". In the example above I wrote "title" and I got the error message. The page loads OK if I remove this and leave the field empty.
My inability to solve this depends on my lack of knowledge in how to communicate with the database.
- What must I write in "Fields to retrieve" to get the title from the article?
- What kind of field do I need in the form design to present this information? And what is the syntax in this field?
Best regards
If you only put title in the fields to retrieve then it can't order by created because you haven't retrieved it. If you leave it blank it gets all fields
That's actually not where it would show up in the debugger, it would be a lot lower. Make sure the read data is before the debugger.
well you can't literally just write "model" unless that's the name of your read data model
Brilliant! I knew it had to be some simple thing I have missunderstood.
It works like a charm! Thank you, Healyhatman, for your patience!
This will save me so much time in the future when new magazines are issued.
Best regards