Jump to content
thirty bees forum

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


Recommended Posts

Posted

I use openoffice calc and save new spreadsheets with the .ods file extension until I'm ready to convert it to a .csv file.

Every time I go to import in admin I have to keep changing the field separator and multivalue separator depending on whether I'm importing categories, products or combinations.

Screenshot shows field delimiter and text delimiter when exporting from .ods to .csv

0_1497540995930_what field delimiters do I save when converting ods to csv.jpg

@spidawebs can you help me out please?

Posted

The defaults are semicolon for the fields, and comma for multiple values. They should actually stay the same across entities

admin: themes\default\template\controllers\import\helpers\form\form.tpl

Holds the defaults when there is none set yet in the cookie

  • 5 months later...
Posted

@Nemo I have been using new field separators for a long while now with great success. Can you please tell me how to edit the code so that these are the default separators?

Field separator: ^ (caret above #6 on keyboard)

Multiple value separator: comma

Thank you, Stephanie

Posted

Stephanie, Could you clarify? You mean setting them as default in the configuration?

admin folder \themes\default\template\controllers\import\helpers\form\form.tpl

They are hardcoded in there, just search the labels, they are if statements

Posted

@Nemo Yes, I want to set the defaults but I don’t understand how to edit / update what the below is from the last time we did this:

The image in the first post is where I want to change the settings again. I can see the quote mark but somehow can’t see where to put the other setting. I’ll try again tomorrow with a fresh view.

Thanks,

Stephanie

Posted

This part:

value="{if isset($separatorselected)}{$separatorselected|escape:‘html’:‘UTF-8’}{else};{/if}"

Reads like this:

"If the user selected a separator, use that selected separator, otherwise use semicolon (;)."

So, you only have to change this part that sets the semicolon as the default separator:

{else};{/if}

Posted

@Nemo I saw the code much easier in Sublime than in my text editor, so that was great.

@moy2010 Thank you for translating it so I would understand it. :)

Between the two of you, I believe I now know what I am doing. Unfortunately, it is still not working.


In the form.tpl file, I changed the field separator as follows: {else}^{/if} (caret)

The multiple value separator was how I wanted it: {else},{/if} (comma)


I updated the Field and Multiple Value Separators in the form.tpl but the admin csv separators will not update.

They stay at: field separator is a comma and the multiple value separator is a semicolon.

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
            </div>

This screenshot is from my file manager on my host because I wanted to confirm the file was actually updated. (I used Filezilla to download the file, edited it with Sublime and uploaded it with Filezilla.)

0_1512567757634_SG-file-manager-form-template-updated-2017-12-06 at 8.13.23 AM.jpg

This screenshot shows the settings have not changed in the admin - CSV import section:

0_1512567904835_admin-shows-old-csv-import-settings-2017-12-06 at 8.14.58 AM.jpg


This screenshot is the updated form.tpl file:

0_1512568002526_form-template-updated-code-2017-12-06.jpg

I use CSV uploads very regularly.

Anyone with suggestions as to why the form.tpl does not change the csv upload default parameters?

Thanks,

Stephanie

  • 2 weeks later...
Posted

Can someone please see what may be wrong with the code? Even the multiple value separator doesn’t work and I didn’t have to change it.

Is there anywhere else the defaults can be changed for these csv import separators in admin?

Posted

@alwayspaws

Why do you want to change the code in the script? My best experiences with the CSV files are field separators as a semicolon and the separator for multi-valued fields as a comma.

Before the import, I only have to turn each time in the two input fields so that it works. But it works great with me.

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

Posted

@zimmer-media Remember this? https://forum.thirtybees.com/topic/931/solved-how-to-use-csv-import-for-many-colors-sizes-for-a-single-product/115 - I’m not going through that again.

My csv’s work perfectly. I just want to change the separators in the admin csv import section. Someone here has to know why the updated form.tpl doesn’t work.

@Traumflug Any ideas, please?

Thanks.

  • 2 weeks later...
Posted

I'm still trying to change the default field separator and multiple value separator in the back office for CSV imports. I want the field separator to be a caret which is this symbol: ^ and the multiple value separator to be a comma.

It's been two weeks since I updated ONE CHARACTER in the code and uploaded the edited form.tpl so, supposedly, any cache that was stuck should be cleared by now if it is cache I cannot clear myself in admin or my three browsers.

The only change to the existing code was to change the comma to a caret for the field separator.

The multiple value separator was already a comma, so it did not need changing, however, it still has the multiple value separator as a semicolon in the CSV import section in the back office.

That, in itself, means something else needs to be updated.

What can it be, please?

Here is the field separator code:

**

and here is the multiple value separator code:

**

and here is the screenshot of the updated form.tpl:

0_1514656778131_multiple value and field separators form template code edited uploaded Screen Shot 2017-12-30 at 12.19.05 PM.jpg

Here it shows the latest updated file exists on my host:

0_1514656832579_form-template-updated-shows-in-file-manager-on-host.jpg

@SLiCK_303 Maybe you can help me figure this out. You're great at finding solutions.

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...