Jump to content
thirty bees forum

<Solved> How to edit field separators used for back office CSV imports


alwayspaws

Recommended Posts

@zimmer-media said in How to edit field separators used for back office CSV imports:

0_1513378835045_3c0a880f-4d82-4f25-9446-8303a75a0a76-grafik.png

Can you please give me your code? At least you have the comma for the multiple value separator, which should be in mine in the back office CSV import section, but it is not. It is a semicolon even though the code I posted clearly shows it is a comma.

My updated field separator code and updated multiple value separator code is as follows:

{l s='e.g. '} 1, Blouse, 129.90, 5

{l s='e.g. '} red.jpg; blue.jpg; green.jpg

Thank you.

Link to comment
Share on other sites

@alwayspaws Sorry Stephanie. I did not change the code at my core. My CSV files are set since Prestashop so that the field separator is a semicolon and a comma for multiple values.

Therefore, I only exchange the two fields when importing. The default is a comma as a field separator and a semicolon as a multiple value.

No matter if I work with Excel or eg OpenOffice. I only exchange the two details before importing (as in the picture).

Anything else would just be extra work for me.

Link to comment
Share on other sites

@zimmer-media I am not asking if you changed it. I'm asking if you have this file: admin folder \themes\default\template\controllers\import\helpers\form\form.tpl

Can you copy and paste here the code you have for this? In other words if you have the file, the code should be there.

{l s='e.g. '} red.jpg; blue.jpg; green.jpg
Link to comment
Share on other sites

@alwayspaws Have you ever tried the import with your own separator without changing this file? I do not know if it works. Since TB it is possible to import csv as well as .xls, .xlsx, .xlst, .ods, .ots. Since I myself do not need any changes, I did not concern myself with it. For the import with special separator I think (guess) that a change of this one file is not enough. I guess that is responsible for another file. In my view, it is a small but important form for import. I assume that at least one more file for import is at the core.

Link to comment
Share on other sites

@zimmer-media said in How to edit field separators used for back office CSV imports:

For the import with special separator I think (guess) that a change of this one file is not enough. I guess that is responsible for another file. In my view, it is a small but important form for import. I assume that at least one more file for import is at the core.

Exactly what I am trying to get at. I want to know what other file(s) I need to edit to change the field separator and multiple value separator.

I just uploaded your form.tpl and the result is still wrong. It still shows the multiple value separator as a semicolon but your screenshot shows it as a comma.

Thank you for the help. I'm going to try to "recruit" other tb users to help me with this.

@lesley @Traumflug @mdekker @Nemo Please look at this for me.

What files are needed to change the default field separators used for back office CSV imports? form.tpl and what else?

Thanks, Stephanie

Link to comment
Share on other sites

Why this is important to me: I spend the bulk of my time importing products with combinations.

With so many coders here, I don’t understand why this topic hasn’t been answered.

I especially want to know why everyone has the multiple value separator as a comma in the csv import page and I have a semicolon even though I’m using the original form.tpl for thirty bees that @zimmer-media very kindly gave me.

Looking forward to the solution so this can finally be solved. In the meantime I’ll keep looking for the answer.

Link to comment
Share on other sites

@alwayspaws if you want to change default separator, you don't really have to modify form.tpl. Try change line #570 in /controllers/admin/AdminImportController.php

0_1515155915102_mvs.png you want to change the character at the end of the line, ie: $this->multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator : '^';

Link to comment
Share on other sites

@datakick Where have YOU been all my thirty bees life? :)

This was absolutely perfect. I really appreciate it. Sending a hug (because I can. I can do anything I want. lol)

For others: I changed the field separator and multiple value separator for the back office CSV imports by following @datakick's example:

Edited this file:

/controllers/admin/AdminImportController.php

Line 568 Changed the comma to a caret (^)

Line 570 Changed the semicolon to a comma as follows:

$this->separator = ($separator = Tools::substr(strval(trim(Tools::getValue('separator'))), 0, 1)) ? $separator : '^'; $this->convert = false; $this->multiplevalueseparator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiplevalueseparator'))), 0, 1)) ? $separator : ','; }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...