Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How Can We Have Imei Validation Regex Rate Topic   - - - - -

 
  • farsgsm
  • Newbie
  • Members
  • Join Date: 07-Jan 20
  • 6 posts

Posted 06 February 2020 - 11:27 PM #1

Hi

 

I need to add imei validation regex.

here is it's algorithm

 

A search suggests that there isn't a built-in function that will validate an IMEI number, but there is a validation method using the Luhn algorithm.

General process:

  1. Input IMEI: 490154203237518
  2. Take off the last digit, and remember it: 49015420323751 & 8. This last digit 8 is the validation digit.
  3. Double each second digit in the IMEI: 4 18 0 2 5 8 2 0 3 4 3 14 5 2 (excluding the validation digit)
  4. Separate this number into single digits: 4 1 8 0 2 5 8 2 0 3 4 3 1 4 5 2 (notice that 18 and 14 have been split).
  5. Add up all the numbers: 4+1+8+0+2+5+8+2+0+3+4+3+1+4+5+2 = 52
  6. Take your resulting number, remember it, and round it up to the nearest multiple of ten: 60.
  7. Subtract your original number from the rounded-up number: 60 - 52 = 8.
  8. Compare the result to your original validation digit. If the two numbers match, your IMEI is valid.

The IMEI given in step 1 above is valid, because the number found in step #7 is 8, which matches the validation digit.

 

Is it possible to have it on CS-Cart as a regex for options?



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11454 posts

Posted 07 February 2020 - 01:01 AM #2

Not as a regex, but you could certainly implement it in Javascript and/or on the backend when the data is processed.  What field are you wanting this for?


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20055 posts

Posted 07 February 2020 - 06:24 AM #3

You can also create your own validators using the cm-custom class

 

https://docs.cs-cart...croformats.html


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • farsgsm
  • Newbie
  • Members
  • Join Date: 07-Jan 20
  • 6 posts

Posted 07 February 2020 - 05:09 PM #4

@tbirnseth

 

thanks for your reply.

i need it as a feature for making service orders with unique IMEI of a mobile phone.

 

@eComLabs

Ill check what i can do

thanks.