Page 1 of 1

Change language of products_name in orders table

Posted: Wed Aug 31, 2022 10:20 am
by loop
Hi All
is there a easy fix / change / Hook where i can change that the used language is used for the products_name to be saved in the table orders_products?
So my goal would be that independent of the used language, always the german translation of the productsname is saved to the mysql. (because it's difficult for us to work with different products_names in the invoices / orders...

thank you all for the great effort and help

Re: Change language of products_name in orders table

Posted: Wed Aug 31, 2022 10:40 am
by ecartz
The product name inserted into the orders_products table comes from the order object, which gets it from the shopping cart objects, which gets it from product_by_id. See https://github.com/CE-PhoenixCart/Phoen ... id.php#L31

It would probably be easier to change it in admin, which gets it from the order object created by database_order_builder.php.

So in admin, use one of the order hooks, like constructOrder or databaseOrderBuild. Iterate over the order products and change the name from whatever to German. Note that this would be the current name, not the name at the time of the order. You already have the products_id in the orders_products table, so you can just use that to fetch the name that you want to display.