1. j2UH8875Wvq4kbFS
  2. RO CSVI
  3. Thursday, 03 August 2017
  4.  Subscribe via email
Hi
I am really confused by this and I was wondering if you could help.
I have a custom component. In each item there is a subform for "Property Features" which contains 10 text inputs for 10 property features. Upon save these are combined into 1 database cell in the following format:
{"com_propertyfeature1":"Feature 1","com_propertyfeature2":"Feature 2","com_propertyfeature3":"Feature 3","com_propertyfeature4":"Feature 4","com_propertyfeature5":"Feature 5","com_propertyfeature6":"Feature 6","com_propertyfeature7":"Feature 7","com_propertyfeature8":"Feature 8","com_propertyfeature9":"Feature 9","com_propertyfeature10":"Feature 10"}

My xml import file looks like this:

<property>
...
<propertyFeature1>Feature 1</propertyFeature1>
<propertyFeature2>Feature 2</propertyFeature2>
<propertyFeature3>Feature 3</propertyFeature3>
...
...</property>


My question is; how can I take the xml node elements and combine them into one database cell in the same format as the above?
Accepted Answer Pending Moderation
Hello,
You can combine your XML nodes using CSVI combine rule and by having 10 CSVI combine template fields but the problem is with the format you need to save it in your database. That is JSON encoded format and you may not be able to get it using CSVI rules. You need to create a Override file for your import and write your own custom code to read the XML nodes in the form of an array like array('com_propertyfeature1'=>'Feature 1', 'com_propertyfeature2'=>'Feature 2,'com_propertyfeature3'=>'Feature 3',........) and then json_encode the array to get the format you are looking for.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hello,
Glad to know you figured it out. Now you have all the field nodes value in a single field, you need to convert it into an array and insert it into database field as a JSON format.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello,
The answer is posted in another post here.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!