VirtoCommerce/vc-module-catalog

Expose the list of characters that are illegal in SKUs

j-mok opened this issue · 5 comments

j-mok commented

Illegal characters that ProductValidator looks for in a catalog product's SKU are currently hidden away in a private field (_illegalCodeChars). I think these should be public and available for consumption from other modules. This is important i.e. when importing products from external sources where SKUs may need to be escaped before using them in Virto. In such a case I currently need to copy the illegal characters into the encoder instead of referencing them.

Hi @j-mok !
We apologize for the long response time.
At the moment we do not plan to overlap _illegalCodeChars because it is built on compatibility with search engines.
You can override with your validator as in the example

j-mok commented

Can you elaborate a bit on the search engine compatibility part? If we are to override validation and allow broader set of characters, we want to know what we're losing/risking.

For compatibility with search engines, we use generally accepted best practices for SKU generation:

  • Create a coding system
  • Establish a standard format
  • Avoid using similar letters and numbers
  • Make SKUs easy to understand and identify
  • Don’t start SKUs with the number 0
  • Ensure each SKU is unique
  • Don’t use spaces
j-mok commented

OK, thanks, I guess that settles it.