• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Integration of K2-item and RSForm

Integration of K2-item and RSForm 10 years 1 month ago #30874

I've created an K2-item, including an form using the standard plugin method {rsform x}

But now I would like to have :

⦁ the title of the k2-item to be copied into a text form field
⦁ an extrafield of the K2-item to be copied into a (similar type) form field.

If tried several of the suggestions
The administrator has disabled public write access.

Integration of K2-item and RSForm 10 years 1 month ago #30886

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Easiest solution would be to create a query to grab that information and populate an input with it. You can use the following article as guidance on how to display PHP variables when form is shown:

http://www.rsjoomla.com/support/documentation/view-article/77-display-php-variables-by-default-when-form-is-shown.html
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.
The following user(s) said Thank You: hans.doeve

Next: K2 extrafields 10 years 1 month ago #30900

OK, this works fine:

//<code>
$articleid=JRequest::getInt('id'); //gets the items ID from the URL
$db = JFactory::getDBO(); //opens a new database connection
$db->setQuery("SELECT `title` FROM #__k2_items WHERE `id`='$articleid'"); //gets the items title based on its ID
return $db->loadResult();
//</code>

But can you help me with parsing the K2 extrafields. The extrafields are 'coded' JSON style: [{"id":"1","value":"De naam van mijn restaurant"},{"id":"2","value":" This e-mail address is being protected from spambots. You need JavaScript enabled to view it "}]

I tried using json_decode but I can't get it right. E.g.:

//<code>
$articleid=JRequest::getInt('id'); //gets the items ID from the URL
$db = JFactory::getDBO(); //opens a new database connection
$db->setQuery("SELECT `extra_fields` FROM #__k2_items WHERE `id`='$articleid'"); //gets the items extrafields based on its ID
$stuff = $db->loadResult();
$stuffer = json_decode($stuff);
$restmail = $stuffer[2];
return $restmail;
//</code>

Any clue on what I'm doing wrong here?
The administrator has disabled public write access.

Next: K2 extrafields 10 years 1 month ago #30915

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
what exactly are you trying to use? have you tried using

$stuffer->id or $stuffer->value ?

Keep me posted!
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!