Plugin Author
Trey
(@ix3)
Hey @mariakos,
You can use the XPath inside the FOREACH loop for this:
{crosssales/crosssale}
Since the index is removed (the [1] in the XPath), WP All Import will loop through all instances of “crosssale” and output a comma-delimited list of them.
Also, for future reference, you can test the output of FOREACH loops and XPaths by placing them in the Content section of the import and clicking the “Preview” button.
Hello @ix3 thank you for your answer
The preview tip, was very helpful! Thanks a lot for that, I did not pass from my mind
Although, I tried this one:
[FOREACH({crosssales/crosssale})]{.}[ENDFOREACH]
but I am getting all the crossale in a line.. Thus I have this: 1199654020
How to add comma seperated delimiter? and if I tried this one:
[FOREACH({crosssales/crosssale})]{.}[SEPARATOR,][ENDFOREACH] like I mentioned above, in the preview description content, I got this error:
“Error parsing content: Unexpected token COMMA, statement was expected.”
any help on that, on how to add comma delimiter please!;
Hello again @ix3
I end up with this solution:
[FOREACH({crosssales/crosssale})]{.},[ENDFOREACH]
added a comma after {.} .. Although, there is a trail comma. I have run the import and for one record and check the cross sales products are fine. Meaning there no errors I guess (orphans products, corrupted import or whatever0, correct? Is this solution correct?
thanks in advance
Plugin Author
Trey
(@ix3)
Hi @mariakos,
Your solution should work fine. It would also work to put this in the field with no FOREACH loop:
{crosssales/crosssale}