OK. Got multiple values to work on a Select Box. Has anyone been able to get this to work with a Select Box Link or a Reference Link field?

Around line 220 in the class.xmlimporter.php (inside the lib folder), I found this code…

else if ($type == 'select' || $type == 'selectbox_link' || $type == 'author') {
                            if ($field->get('allow_multiple_selection') == 'no') {
                                $value = array(implode('', $value));

I tried importing with a regular select box or $type == ‘select’, with the xpath of ‘groups/group/text(). That worked!

But I tried importing into a selectbox link, with the xpath of groups/group/@id (where my group item entries are already populated in another section with those corresponding IDs), but that doesn’t populate.

I tried adding Craig Zheng’s referencelink as a field type…

else if ($type == 'select' || $type == 'selectbox_link' || $type == 'referencelink' || $type == 'author') {
                            if ($field->get('allow_multiple_selection') == 'no') {
                                $value = array(implode('', $value));

But when I tried importing into a referencelink field, with the xpath of groups/group/@id (where my entries are already populated in another section with those corresponding IDs), but that doesn’t populate either.

I would like to import into the Reference Link or Select Box Link fields. Would anyone else no how to approach this?

Is there any reason why it might not recognize the Reference Link or Select Box Link fields???

Since the regular Select Box imports multiple values without hesitation, and the other two extension fields (SelectBox Link and Reference Link) fail, I’m thinking that something must not been called in the extension file, class.xmlimporter.php… OR some file was included to recognize those extensions

These are the files that are included at the top of XML Importer extension…

require_once(TOOLKIT . '/class.gateway.php');

require_once(TOOLKIT . '/class.fieldmanager.php');

require_once(TOOLKIT . '/class.entrymanager.php');

require_once(TOOLKIT . '/class.sectionmanager.php');

require_once(EXTENSIONS . '/xmlimporter/lib/class.xmlimporterhelpers.php');

Should something else be called to recognize the Reference Link field and/or the Select Box Link field?

It won’t be that. I’ve just managed to successfully do multiple values here.

This is what I did.

Two Sections:

Name - Textbox field

Name - Textbox field
Campaign - SBL field w/ multiple values linked to Campaigns/Name

This XML:

This XML Importer:

Included Elements: `/data/entry/`
Name `name/text()`
Campaign `groups/group/@id`

It imported. Here’s a thought, if the @id doesn’t match an ID in the corresponding section (ie. No Campaign in the Campaign section with an ID of 3333’, they aren’t going to import.


Symphony 2.0.8RC3
XML Importer from [this commit][2]
SelectBox Link 1.18

@brendo - Thank you so much, for testing this out, and showing me that it does work.

@everyone - OK, I owe everyone a HUGE apology.

All of this time, I’ve been keying off an existing ID field that I had in my groups section (and not keying off of the Symphony generated ID, which is needed to import via Reference Link or SelectBox Link Field). I knew that I had to bring those in via the Symphony generated ID, but my pea-size brain kept focusing on the other ID that was being imported from the other system.

AGAIN, I’m so sorry for wasting folks time! Hopefully, no one else will take three weeks on focusing on the wrong data part like I did. How embarrassing.

Well, you can learn from my faults.

Thanks for everyone’s patience and willingness to help!

With all that said of course, when I changed to import on the SYMPHONY ID, everything imported in smoothly via the SelectBox Link Field and the Reference Link Field (when selecting the Select Box option). The only hiccup I faced was when I chose Autocomplete Field option from Reference Link field, it only brought in one value, didn’t bring in the others.

Heh, glad to see it works :)

Relating to: this thread

Can this extension be updated to allow textual values to be passed to a Select Box Link field, rather than the id? The XML I’m trying to import doesn’t contain a Symphony ID to import into the fields table, and therefore the field is always blank after import. It’s quite a show-stopper this, as I’m importing hundreds of entries, and there’s no way of knowing the Symphony IDs for my entries.

It supports handles, not text values.

@brendo, how can I handelize my text? I understand that I could use the PHP Function field in the importer, I don’t know where the handelize function is referenced from (using Object::handelize())

How wouold I go about this?

Thanks for all your help too, very much appreciated…

Try Lang::createHandle, in theory it should work because it’s static.

You do have your Select Box Link setup correctly yeah? This will only work if the field in the other Section has this value.


Section A and Section B. Section A is has Title (Textbox). Section B has Description (Textbox) and Related (SBL). The SBL in Section B references Section A’s Title field.

If you are importing in Section B, the values This is a description and one-cat, Section A must have an entry where Title = One Cat.

If your doing it with ID’s: Section A has a an entry with Title = Three Dogs, the id for this entry is 33. If you import into Section B, This is a description and 33, it will also work.

You cannot create entries in the other section using the Select Box Link field.

After spending an entire day importing, deleting and re-importing over and over again to get my xsl right, I have finally cracked.

This extension needs a test action, that will return a page like the errors page with a list of successful entries.

I am sure my xsl was right every time, but for the little nuances. I will surely explode and create a big mess if I have to delete entries again.

@designermonkey - would you mind posting a screenshot of your XML Importer screen? Also, would you mind posting your XML that you are importing?

Brian, there’s no problem anymore, just took me all day to get it right after loads of sloppy errors. I’m still getting used to xsl and xpath, so takes a few mistakes to get it right.

I just thought that a test action would be really useful for people like me…

How would test differ from the run functionality?

Perhaps acting as a “simulate” method, so it doesn’t actually save entries, but tells you what the output would be.

Yeah, that’s it exactly Nick, just output rather then entries.

Try Lang::createHandle, in theory it should work because it’s static.

Turns out this doesn’t work. The function runs fine, but when applied to a Select Box Link, it provides no value. Shame.

John, it makes perfectly sense that it does not work in case you apply Lang::createHandle() to the Select Box Link values: this field stores IDs. Where exactly are you calling that function?

Nils, I was under the impression after reading throught the Select Box Link’s functions that if a handle was passed in to it, it would return the id in question… As brendo explained

I may have misunderstood.

It will, but if your already passing it a handle, why are you creating another? The output would be the identical…

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details