The length of the default value of the custom field

  • Posts: 185
  • Thank you received: 15
  • Hikashop Business
1 year 6 months ago #345189

Is it possible to change the default value of the custom field from 255 e.g. to 500 characters?
Best Regards
Tomek

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
1 year 6 months ago #345198

Hi,

The default value of a custom field can be changed by editing the custom field in the menu Display>Custom fields. There, you have a setting "default" where you can enter/select the default value of the custom field.

There is no limit setting for the length of the text you can enter in a custom field.
However, it is limited by the type of the column corresponding to the custom field in the database.
By default the type of the column is LONGTEXT which gives a maximum length of 4,294,967,295 characters.
So if that's what you're talking about, I would recommend checking the column type for that custom field in the database. If it's set to "VARCHAR" then the maximum number of characters will be 255 characters.

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

  • Posts: 185
  • Thank you received: 15
  • Hikashop Business
1 year 6 months ago #345199

Nicolas,
it is about the length of the default value, where, for example, we have a text field and the default value for a new product will be "product contains allergens". The default value field is of the varchar type, i.e. max 255 - won't anything break when you change the database to Longtext?

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
1 year 6 months ago #345208

Hi,

Ok, I see what you mean. Then, open the hikashop_field table in your PHPMyAdmin and change the type of the "field_default" column from "VARCHAR" to "LONGTEXT".
Nothing will break. And you won't have issues with updates either, don't worry.

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

  • Posts: 185
  • Thank you received: 15
  • Hikashop Business
1 year 5 months ago #345213

Thanks,
it works :)

Tomek

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

Time to create page: 0.069 seconds
Powered by Kunena Forum