How to import record with carriage returns

  • Posts: 16
  • Thank you received: 4
2 years 3 weeks ago #339917

-- HikaShop version -- : 4.4.5
-- Joomla version -- : 4.1.0
-- PHP version -- : 8.0.15
-- Browser(s) name and version -- : Edge 98.0.1108.56

I'm using mass action to import a .csv for a custom field that has carriage returns (CR). During import the CR is interpreted as end of line delimitator and interprets the new line as the next product_code. It of course errors. I tried using quotes around the text with CR, and slash \n as escape character with no luck. Is this a mysql configuration or hikashop issue?

Any suggestion for being able to successfully import a value into a custom field with CR would be appreciated.

Thanks,

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

  • Posts: 81363
  • Thank you received: 13037
  • MODERATOR
2 years 3 weeks ago #339922

Hi,

I don't see a problem with doing that on my end as long as the cell is properly double quoted and double quotes in that field are escaped.
I'm not sure what you mean by "slash \n". \n is already CR by itself. There is no point in adding a slash before. It might be why your \n is not properly understood. To prevent the CSV import from interperting the \n as a new line of the CSV, you just need the cell to be surrounded by double quotes.

If you have difficulties, please provide a copy of the CSV you're using so that we can check what you're using and try it on our end.

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

  • Posts: 16
  • Thank you received: 4
2 years 3 weeks ago #339938

Here are the 2 separate attempts I've tried to mass import CSV. I tried just double-quotes, and then escaped double quotes.

product_code,product_altcode
8928,"code1 #89281
code2 513330
code3 8928
code4 25512000991"

product_code,product_altcode
8928,""code1 #89281
code2 513330
code3 8928
code4 25512000991""

The Error is:
The line 'code2 513330' could not be imported Product not found
The line 'code3 8928' could not be imported Product not found

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

  • Posts: 81363
  • Thank you received: 13037
  • MODERATOR
2 years 3 weeks ago #339941

Hi,

Thank you for the extra information. I had missed the first part of your first message and thought you were talking about the CSV import interface in Products>Import. That's my bad.
I was indeed able to reproduce the problem with the mass actions import filter.
I've made a patch to fix that.
Download this zip file and replace the file administrator/components/com_hikashop/classes/massaction.php with the file in the zip and it will add the patch to support that.
Please confirm that it also works fine for you so that we can include the patch in the next version of HikaShop.

Attachments:
Last edit: 2 years 3 weeks ago by nicolas.
The following user(s) said Thank You: oxido, cwpstech

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

  • Posts: 16
  • Thank you received: 4
2 years 2 weeks ago #339969

Thank you, the patch worked.

The following user(s) said Thank You: nicolas, oxido

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

Time to create page: 0.066 seconds
Powered by Kunena Forum