Home > widget-integration > FilterUrlHelper > getShortParamKey

FilterUrlHelper.getShortParamKey() method

Gets shortened parameter key if URL shortening is enabled.

Maps long parameter keys (e.g., 'pf_brand') to their shortened versions (e.g., 'b') using the shortParamsMap from store.

Override this method to implement custom URL shortening schemes for specific shops.

Signature:

protected getShortParamKey(key: string): string | null;

Parameters

Parameter

Type

Description

key

string

Original parameter key (long form, e.g., 'pf_brand')

Returns:

string | null

Shortened key (e.g., 'b') or null if no mapping exists

Example

Custom shortening scheme:

protected getShortParamKey(key: string): string | null {
  // Use shop-specific SEO-friendly keys
  const customMap: Record<string, string> = {
    'pf_brand': 'brand',
    'pf_color': 'color',
    'pf_size': 'size',
    'pf_price': 'price'
  };
  return customMap[key] || super.getShortParamKey(key);
}