Data Export to CSV - wrong formats for price

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
2 weeks 6 days ago #372858

-- HikaShop version -- : 652
-- Joomla version -- : 547
-- PHP version -- : 8.3
-- Browser(s) name and version -- : firefox

Hi there,

when exporting products into CV-file in the column AT (=product_sort_price) some prices are shown in the right format (Excel. "Standard").
Others are given in a date-format, e.g. "Sep99"; although in the backend the correct price "9.99" (EUR) was entered.

Please see CSV-file in attachment, column AT.

Thanks.

Rolf

P.S.: Additional question - what format must CSV-file be stord CSV /S-DOS, or CSV-separators?

This message has an attachment file.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

  • Posts: 86048
  • Thank you received: 14177
  • MODERATOR
2 weeks 6 days ago #372860

Hello,

This is not a HikaShop problem, the data in the CSV file is correct. It's Excel that changes it when you open the file. When you double click a CSV, Excel auto-detects each cell and turns anything that looks like a date into a date. In a locale where the point is not the decimal separator, "9.99" is read as month 9 / year 99, so Excel shows "Sep99" (September 1999). That's why only some values are affected: only the ones Excel can read as a date get converted, the others stay as numbers.

You can check it: open the exported file with a plain text editor (Notepad), and you'll see the correct value 9.99. The export is fine, it's only the display in Excel that is wrong.

To keep the prices intact, you have a few options:

1. Export in XLSX instead of CSV. Create a mass action on the products (System > Mass actions) and choose the XLSX export format. XLSX stores real number cells, so Excel never turns them into dates. This is the cleanest solution.

2. Set the "CSV decimal separator" to a comma in the HikaShop configuration (main tab). The prices are then exported as "9,99", which a European Excel reads directly as numbers instead of dates.

3. Or open the CSV without letting Excel convert it: in Excel, go to Data > From Text/CSV, select the file, and set the price column type to "Text" (or the matching locale) before loading. The values then stay exactly as exported.

About your second question, on how to save it: the encoding (CSV UTF-8 vs CSV MS-DOS) only affects accented characters, it doesn't cause the date issue, so keep CSV UTF-8 to preserve special characters. The field separator HikaShop uses is set in that same configuration page ("CSV separator", semicolon by default).

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
2 weeks 6 days ago #372862

Hello,

thanks for quick reply.

1. When I export by MASS-ACTION to .xlsx - can I import also from .xlsx? Or shall I save as .csv after working on file?
3. How shall i change price column type before loading?? When I click "Export" the .csv file appears immediately, no point where I can change anything before opening the file

Thanks for info, have anice weekend.

Rolf

Please Log in or Create an account to join the conversation.

  • Posts: 86048
  • Thank you received: 14177
  • MODERATOR
2 weeks 6 days ago #372864

Hello,

1. No, the import only reads CSV files, there is no XLSX import. So if you export in XLSX to work on the file safely, you then need to save it back as CSV ( File > Save As > CSV UTF-8 ) before importing it.

That is not a problem for the prices: the import accepts both the point and the comma as decimal separator, and it auto detects the field separator from the first line of the file. So a CSV saved by a German Excel (semicolon as separator, 9,99 as price) is imported correctly, you don't have to convert anything back.

2. That step is done in Excel, not in HikaShop. The export simply gives you the file, and the conversion happens later, when Excel opens it. So don't double click the downloaded file. Instead:

- Save the exported file somewhere on your disk without opening it.
- Open Excel with an empty workbook.
- Go to the Data tab, then "From Text/CSV", and select the file.
- In the preview window that appears, you have options to configure how Excel will process the CSV and you can adapt them so that the problem doesn't appear.

Last edit: 2 weeks 6 days ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
2 weeks 1 day ago #372896

Hello Nicolas,

problem with fomat is solved so far - all prices are properly exported with COMMA as decimal-devider.

But when I re-import the file, the prices are "modified" = 9,99 EUR is now 999,- EUR, 12,99 EUr is now 1.299 EUR.
Saved the file in both .CSV variants and also changed price-format in file to "number" - all does not work to get the
prices correctly again.

Thanks for advice.

Rolf

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
2 weeks 1 day ago #372897

Additional question:

I found that I can select the product-fields (columns) .
So, e.g., when I only would export one field (e.g. Product_id) and make changes there - remain all other fields like they were and one this one (Product_id) is replaced?

Thanks for info.

Rolf

Please Log in or Create an account to join the conversation.

  • Posts: 86048
  • Thank you received: 14177
  • MODERATOR
2 weeks 1 day ago #372904

Hello,

We found a problem on our side and it is fixed. The price column of the CSV export ignored the "CSV decimal separator" setting of the configuration and always used a point, while the other columns of the file did use the comma you selected. Your file mixed the two, and the price column was precisely the one your spreadsheet handled differently from the rest. Please download the install package again from your subscription page ( My account / My subscriptions ), install it on your website. Note that this is only for the product export button.

One thing to keep in mind when you open that file : do not let Excel convert the price column. In the wizard of "Data > From Text/CSV", set the price columns to "Text". Excel then keeps the values exactly as they are in the file, and the import reads both 9,99 and 9.99 without any problem. If the column is converted to a number with a decimal separator different from the one in the file, 9,99 becomes 999 and 12,99 becomes 1299, which is what happened to you.

For your other question, yes. You can export only the columns you want to change and reimport that file. Keep the product_code column, or the product_id column, so that HikaShop can tell which product each line corresponds to, and leave the option "Update products information if the product_code already exists" activated on the import screen. The columns which are not in your file keep their current value, and the prices, the images and the categories of your products are not touched as long as their columns are not in the file.

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
2 weeks 1 day ago #372907

Hello Nicolas,

thanks for your help.

You wrote: "One thing to keep in mind when you open that file : do not let Excel convert the price column." --> When I export the data
it is opened in Excel immediately, no point where I can change the Excel settings.
DO you mean: Export product data --> file opens immediately in Excel --> Save file --> Import again to Excel having changed convert settings before ?

Thanks for info again

Rolf

Please Log in or Create an account to join the conversation.

  • Posts: 86048
  • Thank you received: 14177
  • MODERATOR
2 weeks 1 day ago #372909

Hi,

This means that your browser is configured to auto open files upon download. For example, for Chrome:
support.google.com/chrome/thread/3304469...after-download?hl=en

The file will be saved in your downloads folder. So, open Excel manually on your computer, and find the menu to import data from a CSV. It will ask you to provide the CSV file, and then settings to choose how to process it when loading it.

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
2 weeks 17 minutes ago #372926

Hi NIcolas,

I downloaded and updated HIKASHOP to: HikaShop Essential 6.5.2 [2607302308]

Now, the price in the excel-csv is "9,99" , after import it shows "999,00€" .
Decimal-divider was set to "Comma" in configuration before.

What is wrong ???

Thanks

Rolf

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
2 weeks 4 minutes ago #372928

STOP!

Sorry, I just saw that the prices in "product_sort_prize" are correct.
What appears wrong to me is the column "price_value"......this is already wrong in the excel file.
I will use a .CSV file from earlier version and see how it works.....no action from your side recquired at this moment.

But, by the way, can you explain the different kind prices?

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
1 week 6 days ago #372935

Hi there,

everything works fine now, thanks for help.

Rolf

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

  • Posts: 32
  • Thank you received: 3
  • Hikashop Essential
1 week 3 days ago #372972

Hello Nicolas,

I found that also CATEGORIES can be exported to .csv or .xls files.

When I worked on it, e.g. to fill in category_description, --> How can I re-import ?

Thanks for help.

Rolf

Please Log in or Create an account to join the conversation.

  • Posts: 86048
  • Thank you received: 14177
  • MODERATOR
1 week 3 days ago #372979

Hi,

There is no category import for now in HikaShop. You would have to do it via PHPMyAdmin's import feature on the hikashop_category table. It's possible but not that easy. AI could help you there.
However, that's something we're working on for the next version of HikaShop in order to provide a proper import for categories.

Last edit: 1 week 3 days ago by nicolas.

Please Log in or Create an account to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum