Keyword

Modify extra fields on click

More
7 years 1 month ago #164567 by Aram
Modify extra fields on click was created by Aram
Hi,
I'm trying to modify the value of one of my extra fields by clicking on a button.
The part of executing by clicking on a button is already done.
If I'm not mistaken the values are stored in __k2_items > extra_fields as JSON. And that's the tricky part. How can I modify these values and update the database?
[
	{"id":"1","value":"2017-09-04"},
	{"id":"2","value":"some vlaue"},
	{"id":"3","value":"some name"},
	{"id":"4","value":"0123456789"},
	{"id":"5","value":"some text"},
	{"id":"6","value":"some email"},
	{"id":"9","value":"2"}
]
I would like to change the value of id '9' from 2 to 3.
Any help would be great. Thanks in advance.
Aram

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

More
7 years 1 month ago #164570 by william white
Replied by william white on topic Modify extra fields on click
Not sure where you are working from but i am assuming its the front end item or category view, but i tested and update command that worked in phpmyadmin
If you have added a button to the view in the override and someone clicks it you can
Grab the item id you are on
Get the string value of the extra_fields column of the table
Manipulate it to change the value that you want to change and send the entire result back to the talble after
Getting a database handle and
issuing an Update Command like
update {prefix}_k2_items set extra_fields = {new list of values} where id = {current record}
(It possible this would have to be a mixture of the php in the override and script of the click event, not sure)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 1 month ago #164587 by Krikor Boghossian
Replied by Krikor Boghossian on topic Modify extra fields on click
You would have to manually query the database and update the proper cell.
This has to be a manual operation.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum