Class: AboutYou

AboutYou

new AboutYou() → {AboutYou}

Properties:
Name Type Description
appId string
appPassword string
apiEndPoint string 'live' for live environment, 'stage' for staging | default: 'live'
Source:
Returns:
AboutYou instance
Type
AboutYou

Methods

fetchAutocomplete(searchword, limit, types)

Returns the result of an auto completion API request. Auto completion searches for products and categories by a given prefix (searchword).
Parameters:
Name Type Description
searchword string The prefix search word to search for.
limit number Maximum number of results.
types Array.<string> Array of types to search for.
Source:
Returns:
Autocomplete

fetchCategoriesByIds(ids)

Returns the result of a category search API request. By passing one or several category ids it will return a result of the categories data.
Parameters:
Name Type Description
ids number | Array.<number> either a single category ID as integer or an array of IDs
Deprecated:
  • use the CategoryManager instead of
    Source:
    See:
    Returns:
    CategoriesResult

    fetchCategoryTree(cb)

    Parameters:
    Name Type Description
    cb requestCallback The callback that handles the response
    Deprecated:
    • use the CategoryManager instead of
      Source:
      See:
      Returns:
      CategoryTree

      fetchFacets(groupIds) → {Array.<Facet>}

      Fetch the facets of the given groupIds.
      Parameters:
      Name Type Description
      groupIds Array.<string> | Array.<number> The group ids.
      Source:
      Returns:
      With facet id as key.
      Type
      Array.<Facet>

      fetchProductsByEans(array, required)

      Parameters:
      Name Type Description
      array Array.<number> of a product's variant ean
      required Array.<string> product fields
      Source:
      See:
      Returns:
      ProductsEansResult

      fetchProductsByIds(array, required)

      Parameters:
      Name Type Description
      array Array.<number> of product ids
      required Array.<string> product fields
      Source:
      See:
      Returns:
      ProductsResult

      fetchProductSearch(ProductSearchCriteria)

      Parameters:
      Name Type Description
      ProductSearchCriteria criteria
      Source:
      Returns:
      ProductSearchResult

      fetchSuggest(searchword) → {Array.<string>}

      Returns the result of a suggest API request. Suggestions are words that are often searched together with the searchword you pass (e.g. "stretch" for "jeans").
      Parameters:
      Name Type Description
      searchword string The search string to search for.
      Source:
      Returns:
      Type
      Array.<string>

      fetchVariantsByIds(ids)

      Parameters:
      Name Type Description
      ids Array.<integer>
      Source:
      Returns:
      VariantsResult

      getApiEndPoint()

      Source:
      Returns:
      string

      getAppId() → {string}

      Source:
      Returns:
      Type
      string

      getCategoryManager(fetchIfEmpty)

      The Categories will be fetch automatically, if required by any other fetch method
      Parameters:
      Name Type Description
      fetchIfEmpty boolean
      Source:
      Returns:
      DefaultCategoryManager
      Example
      aboutYou.fetchProductsByIds([12345], ['categories']).then(function(products) {
          // will fetch the categories with the same request.
       });
      
      aboutYou.getCategoryManager().getCategoryTree().then(function(categories) {
          // will give you all categories for your Menu without an other request
      });

      getClient()

      Source:
      Returns:
      Client

      getJavaScriptURL() → {string}

      Returns the URL to the ABOUT YOU JavaScript file for helper functions to add product variants into the basket of Mary & Paul or auto-resizing the Iframe. This URL may be changed in future, so please use this method instead of hardcoding the URL into your HTML template.
      Source:
      Returns:
      URL to the JavaScript file
      Type
      string

      getProductFields() → {Object}

      Returns a list of all available product fields
      Source:
      See:
      Returns:
      object keys contain all available product fields
      Type
      Object

      getProductSearchCriteria(sessionId)

      Parameters:
      Name Type Description
      sessionId string | null
      Source:
      Returns:
      ProductSearchCriteria

      getResultFactory() → {DefaultModelFactory}

      Source:
      Returns:
      Type
      DefaultModelFactory

      getSessionId()

      Source:
      Returns:
      string

      initDefaultFactory(cache) → {DefaultModelFactory}

      Parameters:
      Name Type Description
      cache Cache | null
      Source:
      Returns:
      Type
      DefaultModelFactory

      setApiEndpoint(apiEndPoint)

      Parameters:
      Name Type Description
      apiEndPoint string the endpoint can be the string 'stage' or 'live', then the default endpoints will be used or an absolute url
      Source:

      setAppCredentials(appId, appPassword)

      Parameters:
      Name Type Description
      appId string the app id for client authentication
      appPassword string the app password/token for client authentication.
      Source:

      setBaseImageUrl(baseImageUrl)

      Parameters:
      Name Type Description
      baseImageUrl null | false | string null will reset to the default url, false to get relative urls, otherwise the url prefix
      Source:

      setResultFactory(modelFactory)

      Parameters:
      Name Type Description
      modelFactory DefaultModelFactory
      Source: