Jump to content

Change Categopry iD to letters


Recommended Posts

Hi i was wondering is there a way to change the Category ID from Numbers but to letters for example

instead of

1
2
3
4
5 etc but this instead

A
B
C
D
E
F
G
H
I
J etc please.

As i have a client that has a spreadsheet which is 67,000 records. and i dont want to go through all the Category ID's and change to numbers because will take for ever.

Is there a way i can do this?

Regards,

Aaron

Link to comment
Share on other sites

No, MySQL doesn't support autoincrement with letters instead numbers. Even if it did, this is not a good idea, since you will most likely break something in PrestaShop if you do it. You should try to use your spreadsheet software to convert the letters to numbers for you. A formula that adds together the ASCII code of each character, then subtracts 65 for each character should work.

Link to comment
Share on other sites

This is another thing you should be able to do with a formula. Create a separate column, then add a formula that adds that URL in front of whatever is in the previous column, then convert the column to text, then delete the previous column.

Link to comment
Share on other sites

I've attached an excel file with formulas. The formula I'm using to add the URL in front of the image filename is:

=CONCATENATE("http://www.example.com/",$C1)



I tried to write a formula to convert the letter ID to a number ID. The best I could come up with was:

=CODE($A1)-64



This will convert A to 1 and Z to 26, but it only converts the first letter, so AB would be 1 too. It might be possible to write a formula split the string into characters and add together the ASCII codes, but I can't figure out how at the moment.

excel.xls

Link to comment
Share on other sites

×
×
  • Create New...