How to stop product tags from being imported to database in alphabetical order


Hello all,

I have product tags imported to db by a script which fetches the tags from metadata of images. However the tags appear in alphabetical order and therefore it also appears in alphabetical order on site, on the product page. I want them in the order they were originally inputted in the metadata of the image.

I assumed the issue was something in the code which imports the metadata, but I have been working with someone who thinks it is because the tags are imported to a table in db with no Primary key, therefore they go in alphabetical order.

Does anyone understand the issue I am facing. It is not really a problem unless you don't want the tags in alphabetical order like I do.

Hope someone can help.
Thank you :slight_smile:


I'm pretty clueless but I imagine that the information about what order it was added must be stored in the database? And if it is, you can then order it by that information. If it's not, then you would have to add that information, otherwise that information simply isn't available


In case this is beneficial to someone we solved this by adding a timestamp column to product_tags in database.