Search

Quick Question:

Is there a way to populate Rowan’s Reflection field in an import? I know the field is basically reflecting entries in other fields. Is there a way for that field to be populated when the other fields receive their values on import?

I’ve try to import a value to that field, but it’s always blank. I find that I have to manually resave every entry and then the Reflection field populates. It makes sense that it does that. I was just wondering with my PHP challenged mind, if there is a way that can be done?

Also, I’m running into this problem with 2.0.8RC2,

Symphony Warning

strip_tags() expects parameter 1 to be string, array given
    /home/user/Sites/localsite/symphony/lib/toolkit/class.lang.php line 194

    189         if($apply_transliteration == true) $string = _t($string);
    190
    191         $max_length = intval($max_length);
    192         
    193         // Strip out any tag
    194         $string = strip_tags($string);
    195         
    196         // Remove punctuation
    197         $string = preg_replace('/[\.'"]+/', NULL, $string);   
    198 

Backtrace

[:0] GenericErrorHandler::handler();
[/home/user/Sites/localsite/symphony/lib/toolkit/class.lang.php:194] strip_tags();
[/home/user/Sites/localsite/extensions/selectbox_link_field/fields/field.selectbox_link.php:439] Lang::createHandle();
[/home/user/Sites/localsite/extensions/xmlimporter/lib/class.xmlimporter.php:271] fieldSelectBox_Link->buildDSRetrivalSQL();
[/home/user/Sites/localsite/extensions/xmlimporter/content/content.importers.php:69] XMLImporter->commit();
[/home/user/Sites/localsite/extensions/xmlimporter/content/content.importers.php:40] contentExtensionXmlImporterImporters->__prepareRun();
[/home/user/Sites/localsite/symphony/lib/core/class.administration.php:88] contentExtensionXmlImporterImporters->build();
[/home/user/Sites/localsite/symphony/lib/core/class.administration.php:204] Administration->__buildPage();
[/home/user/Sites/localsite/index.php:25] Administration->display();

This happens when I have a Select Box Link or Reference Link Field that I’m importing into. When I remove those field types (Select Box Link and Reference Link), I do not get this error.

I’ve been able to import into Select Box Link and Reference Link fields in the past, but I’ve never run into this error before.

Any thoughts?

I’ve had issues with the reflection field not being populated with the Mass Uploader myself. I’m therefore thinking that if it’s happening with this extension also, there is either an issue with the way the reflection field does it’s thang, or there isn’t a way of doing it with an extension that auto populates sections…

FYI. I tried post my issue above on the Issue Tracker, but the Issue Tracker isn’t working right now. I’ll post the issue there when the issue tracker posting function is resolved.

Is it possible to import multiple values in a select box link or reference link field?

For instance, I’m trying to import a list of staff members, the groups that they belong to.

I’m importing in the person’s First Name, Last Name, E-mail, and Group

  • First Name (text field)
  • Last Name (text field)
  • Email (text field)
  • Group (Select Box Link pointing to Groups section) allowing multiple options

Since some people belong to more than one staff group, I’d like to import that in as well.

I keep running into the error above (strip_tags() expects parameter 1 to be string, array given), if I select my field to allow multiple options.

If I deselect the multiple options, since many of the entries importing have multiple groups, everything imports except for the groups.

Can anyone give me some pointers? Is there a specific XPath I could use to get this work? Or is there a way that we can amend the php to allow for mulitple selections if it’s a select box link, referencelink, or a select box?

OK. I don’t have an error anymore. I had the unique field checked on the Group field (select box link field). That was my error.

I’m trying to import multiple values in the selectbox link field. Is it possible to use the PHP function field to get this done.

I tried use the implode function like so…

implode(',',array($value));

OR

implode(",",$value);

It didn’t work. Is there a specific name of the array that I need to call instead of just array()? And would that work?

@bzerangue I can’t answer everything, but I’ll have a go where I can. For your issues regarding the Reflection Field I’ve pushed this commit which basically mirrors Symphony’s EntryPre/Post delegates.

The Reflection Field doesn’t work (well my guess) because it listens for the entry saving delegates, which the XML Importer doesn’t provide (EntryPostCreate, EntryPreCreate, EntryPreEdit or EntryPostEdit). I’ve implemented these prefixed with XMLImporter so the Reflection Field (and other fields that listen for similar delegates) can be updated.

I should make a note that there is also a preferred way for fields to provide their import values rather then the XMLImporter extension itself attempting to hardcode the possible cases. The function is prepareImportValue, so if anyone reading is updating their extensions, and the import values are a bit quirky, it might be an idea to create that function too :)

In terms of importing multiple values, no, I don’t think the system has any support for that. Again, I’m not terribly certain on this, but I think the problem is that currently the system is hellbent on turning multiple values into a string. I’ll try and have a look sometime this week and see if I can figure something out :)

@brendo - thanks for the input and your help! Do you think it might be possible to use the PHP function implode() to get the array to a string? I tried inputting implode(",",$value); in the PHP function field on the XML Importer setup page with no success. Again, I don’t know if $value is proper value for the field. Or if I’m using the PHP function field correctly?

I figured since the Select Box Link and reference field looks for the ID’s and at least the output of the parameter output is usually a string with commas. I figured we could use implode(",",$value); to mimic the same functionality during the import.

I think you’ll find that that is what the extension is attempting to do.

Hmm. What happens if you comment out this block and run an import?

Also, my understanding of the PHP Function field is that it takes the name of a function, ie. XMLImporterHelpers::markdownify, not raw PHP. Read the last bit of the readme (Using PHP Functions) for more information about that :)

I think you’ll find that that is what the extension is attempting to do.

Hmm. What happens if you comment out this block and run an import?

OK. I tried that (with nothing listed in my PHP function option), but same result, it does not carry over the values.

Also, my understanding of the PHP Function field is that it takes the name of a function, ie. XMLImporterHelpers::markdownify, not raw PHP. Read the last bit of the readme (Using PHP Functions) for more information about that :)

Ah, ok, I was a little confused about that. I don’t know why, or what was going on with my brain but when I was reading through the README file that just didn’t click. Sorry.

Hmm, ok, I’m not on my dev machine so can’t test much more from here. I’ll have a go at sussing out the problem on a lunch break this week :)

Thanks man! I’ll keep looking and see if I can find anything.

@brendo, @buzzomatic, @nickdunn - have y’all found any way to import in multiple values from a select box link field, reference link field, or select box field?

I had multiple values working on my own local version, but I don’t think it was merged into the official version. It wasn’t very sound anyway. So yes, kind of, but I no longer have the code…

I’ve only ever used the XML Importer a couple of times anyway, so I haven’t had the need to repeat it.

Thanks Nick. If you happen to remember, what you did, would love to know. I’m sort of stuck.

I’m trying to import xml but I’m getting an error saying that there is no data to import. I’ve set my included elements to

//product[not(@usertypeid = 'Accommodation')]

as my product nodes are nested within each other (see attached xml), and I want to find all of them.

What am I doing wrong? I’ve attached the xml, and the importer. Can someone help me?

Edit: the included elements in the document attached doesn’t match the above as I have tried something else too…

Attachments:
xml-importer.destinationshotels.php and hotel-container.xml

I’ve just run the importer again to see what is output in the log file and came across this for just oone import!

Note: I have two importers set up to run very similarly…

2010/05/27 11:11:50 > UNKNOWN: 8192 - Assigning the return value of new by reference is deprecated in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 68
2010/05/27 11:11:50 > NOTICE: Session: Taking out the trash!
2010/05/27 11:11:50 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsHotels' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:50 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsVillas' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:50 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsHotels' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:50 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsVillas' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:54 > UNKNOWN: 8192 - Assigning the return value of new by reference is deprecated in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 68
2010/05/27 11:11:54 > NOTICE: Session: Taking out the trash!
2010/05/27 11:11:54 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsHotels' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:54 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsVillas' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:54 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsHotels' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:54 > WARNING: 2 - call_user_func() expects parameter 1 to be a valid callback, class 'XMLImporterDestinationsVillas' does not have a method 'getRootExpression' in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 91
2010/05/27 11:11:55 > UNKNOWN: 8192 - Assigning the return value of new by reference is deprecated in file C:\projects\ftc-symphony\extensions\xmlimporter\lib\class.xmlimportermanager.php on line 68

I’m sure there shouldn’t be this many errors?

Would help if I posted the XML Importer error message:

Import Failed

   1. No data to import.
   2. DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input
   3. No entries to import.

@designermonkey - would you mind posting a screenshot of your XML Importer page (showing us how your fields are mapped)? What are the fields and field types that your importing to?

@designermonkey -

If one of those fields is a selectbox link or a reference link, you will need to import the ID’s (from the other section).

Now, I have been wildly unsuccessful getting those fields to recognize multiple values on an import. If you are able to do that, would you please share what you did?

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