Not removing a custom field column from table

  • Posts: 18
  • Thank you received: 0
  • Hikamarket Frontedition Hikaserial Standard Hikashop Business
2 weeks 20 hours ago #343535

-- HikaShop version -- : 4.6.1
-- Joomla version -- : 3.10.10
-- PHP version -- : 7.4.26
-- Browser(s) name and version -- : Firefox

When I create a custom field in address and then realized it should be in order.

I remove the field in address and create a new field with the same name in order.
In the order listing (administrator) the field does not show up with the correct value.

The query the file view.html.php in administrator / components/ com_hikashop/ views/ order line 198 etc. actual gives a set of rows with 2 columns having the same column name.

Looking at the table hikashop_address still showed the column with the removed field.
Removing this column from the table resulted in correct showing of the order listing.

Please Log in or Create an account to join the conversation.

  • Posts: 76113
  • Thank you received: 11910
  • MODERATOR
2 weeks 15 hours ago #343536

Hi,

When you delete a custom field, you have a link you can click on to also remove it from the database in the successful message.
If you don't click on it, then it stays in the database.
So that's normal.
Regarding the fact that the address field overwrite the order field, that's because we use * in the MySQL to load all the data of all the tables involved and if you have several columns with the same name, the last column loaded takes priority.
So indeed, you should either remove the column from table with the link in the successful message when you delete a custom field if you want to create a new one with the same column name in another table, or just use another column name.
On our end, as you can see, the columns of the tables are usually prefixed with the table name (so the name of the product in the product table is product_name while the name of a product in an order in the hikashop_order_product table is order_product_name. That way, even if there is a MySQL query using both tables loading everything, the data of either table is not overwritten).

The following user(s) said Thank You: Luchen6

Please Log in or Create an account to join the conversation.

  • Posts: 18
  • Thank you received: 0
  • Hikamarket Frontedition Hikaserial Standard Hikashop Business
2 weeks 14 hours ago #343540

Nicolas,
I did not see the message where the field can be removed from the table.

But indeed that message shows up.
Thanks for letting me know.

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum