Custom field to store EAN Code

  • Posts: 634
  • Thank you received: 16
8 years 11 months ago #222621

-- HikaShop version -- : 2.6
-- Joomla version -- : 3.45

I need to store an EAN code and I don't see a default field for this so I will go to creat a custom field.

Would be ideal that only numbers could be stored and avoid a "by accident" introduction of letters.

Can I achieve this with custom field?

If so, could you help me with the regular expression?

Thank you.


UPDATE

Another question related to the same topic. When I create a customtext custom field there is no way the column name assumes the name I give and it gives a random name with this pattern

customtext_334_12_30_26

I tried several names without success

ean_code
ean_number
ean_code_number


Then when I make an import form a CSV I get this message for this field:

The column 'customtext_334_12_29_26' is not in the list of possible columns : (although it is clearly present in the custom field list)

Last edit: 8 years 11 months ago by PeterChain.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 11 months ago #222652

Hi,

1/

^[0-9]+$
More about regular expressions : developer.mozilla.org/en-US/docs/Web/Jav...lobal_Objects/RegExp

2/ Custom text does not create any column.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 634
  • Thank you received: 16
8 years 11 months ago #222765

Thank you.

Maybe my explanation about point #2 was not very good. I will do different.

You say that custom text does not create any column, well, indeed it does as it is a custom field. Let me show white I write and what I get after saving the custom field.

Read the data in the third form field named Column name.

When creating the custom field with Field type customtext




After saving it


Then when importing data form hikashop the system is not identifying none of the names, not mine not the one after saving.

Regards,

UPDATE:

And this what I see in custom field list view

Attachments:
Last edit: 8 years 11 months ago by PeterChain. Reason: added custom field list view

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 11 months ago #222774

Hi,

I guess that you did not understand me but my answer was good.

Custom text does not create any column.


The "custom text" is not a custom field ; it is a field to display a fixed custom text.
It does not create any single column in the database to allow you to store anything.

So, that is not the type of custom field you want to use.

I hope that type, my explanation is clear enough.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 634
  • Thank you received: 16
8 years 11 months ago #222902

Wow! :ohmy:

It took me a while to figure your explanation. Finally I understand that is serves the purpose of showing an informative text when some view displays the custom fields autmoatically one after the other, so the purpose of custom text is its label to be displayed before or after a set of custom fields.

Is this the concept? I was not good to find in the documentation but I found several posts getting the same confusion as me.

What is harder for me to understand is what are the regex for. I was convinced that was a way to build an input mask so that is why I was so interested in this field type.

Regards

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 11 months ago #222928

Hi,

Yes, it's to just display informative text before/after the fields.

Regarding the regex, you're right. It's to build an input mask so that you can force the customer to only enter text in a specific format. The regex option field should actually on appear for the custom text type custom fields since you can't enter anything in them.

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

Time to create page: 0.083 seconds
Powered by Kunena Forum