Jump to content

Import attribute value with comma


Recommended Posts

Hello,

i've a cron script that every 30 min import and update the products from a xml file, that's work fine.

My problem is the attribute value, that seems not import the right size with comma.

For example i've in my xml file:

 

<size1>10</size1>

<size2>10,5</size2>

 

In product admin page, combinations section, i've:

 

Size 10 | Reference: 10

Size 10 | Reference: 10,5

 

So in the attribute value the 10,5 become 10, i think it's a comma problem, and when a customer add the product with size 10, i don't know if he meant 10,5 or 10.

 

Hope i've explained my problem, please help to figuered out

 

Thanks

Link to comment
Share on other sites

Maybe PrestaShop always expects a dot . character as a delimiter for decimal digits in a number, regardless of your country and locale settings? I know for certain that this is also the case when doing CSV import.

 

So, I would do a little test with dots instead of commas and see what happens.

Link to comment
Share on other sites

unfortunately, you can't that's the mysql standard.

In addition to this, if you will change it to dot, you will need to change whole core of ps which support dots.

Why you want to use commas? Maybe there is an easy way to achieve what you expect with different and possible solution

Link to comment
Share on other sites

  • 11 months later...

Hi!

 

I have similar problem, but with text values.

I'm trying to import like:

 

attribute1: blue, red, white

attribute2: red, green, yellow

 

but after import I get just:

 

attribute1: blue

attribute2: red

 

It looks like CSV import tool cuts of the value after first comma. I'm using version 1.6.0.9,   ; as field delimiter, " as value delimiter.

Link to comment
Share on other sites

If dots followed by spaces work, but commas followed by spaces don't, it sounds like a bug in PrestaShop's CSV parser or at the very least a serious inconsistency.

 

Have you tried with commas and no spaces yet? I'm also favoring the use of spaces after commas for readability purposes but only when writing code, not in cases like this.

Edited by parsifal (see edit history)
Link to comment
Share on other sites

  • 1 year later...

I know it's a rather old question but...

I am struggling to import into PS products that have attributes with commas in their names (e.g. "fish, red"), which works fine if entered in the backend, but causes troubles when importing.

I think the issue here is that the import treats certain columns (e.g. Categories and Attribute / Value) as multi-value, where each value is separated with a comma from the other. E.g.:

123;red,blue;Pants

describes the product Pants, with ID 123 and that belongs to the categories red AND blue.

 

Edit:

 

And of course the solution (duh) in PS 1.6.1.6 is to choose a different multi-value delimiter, possibly a character that is not in the attribute names (e.g. |)...

Edited by savedario (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...