Can not (re)create custom field with same column name as deleted field

  • Posts: 29
  • Thank you received: 2
2 years 6 months ago #341131

-- HikaShop version -- : 4.4.5
-- Joomla version -- : 4.1
-- PHP version -- : 7.4

Not sure where to put this issue, so I'll do it here.

When deleting a custom field, it seems not possible to create a new custom field with the same Column_name for the same Table. The reasons being that the field does get removed from the #__hikashop_field table but the actual table column is not removed from the table it was designated to.

Is this a bug or a feature?

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
2 years 6 months ago #341134

Hi,

It's made on purpose so that you don't delete inadvertedly the data of your custom fields if you don't know what you're doing.
So either:
- you use another column name and you're ok like that
- you use another column name, and once the custom field is created, you can go in your PHPMyAdmin to change the column name of the custom field in the hikashop_field table so that the new custom field will see the data you had previously entered
- you delete the column manually in the target table via your PHPMyadmin and then you can create a custom field with the old column name

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

  • Posts: 29
  • Thank you received: 2
2 years 5 months ago #341341

Thanx for the explanation. I anticipated an answer like this :) It's a rather cumbersome way of maintaining an already complex application though. Don't you think a simple "Are you sure you want to delete the field and all associated data?" confirmation is more user friendly? Especially so for less technical savvy users?

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
2 years 5 months ago #341342

Hi,

Well, there is already a confirmation when you delete a custom field. But even so, people were deleting their data by inadvertance.
Forcing them to do so via the database avoid this from happening. But I agree it's cumbersome.
I think the best would be to allow users to create custom fields for columns that already exist provided it's not a default column of the table and that it isn't already used by another custom field. That would make for a smoother experience while avoiding cumbersome manipulations in PHPMyAdmin.

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

  • Posts: 29
  • Thank you received: 2
2 years 5 months ago #341343

Hi Nicolas,

Smoother yes. But if a column already exists and contains data, that data is not necessarily compatible with that of the newly created field. And even if it is, it is quite uncertain if it should be retained. So in the end you may have to delete the existing data anyway. Or is my reasoning somewhat flawed here?

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
2 years 5 months ago #341347

Hi,

In that case, you could always just use another column name.
But yes, that could be useful, yes. We'll look at how we can improve things there.
Thanks for your feedback.

The following user(s) said Thank You: pjdevries

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

Time to create page: 0.071 seconds
Powered by Kunena Forum