Change language of products_name in orders table

Open to all! Ask other shopowners for help.
Post Reply
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Change language of products_name in orders table

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Change language of products_name in orders table

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply