User Tools

Site Tools


pci

Picalike Customer Interface

General

The picalike customer interface is the backend API for both frontend services Visualytics and OSA. Because of that, changes in the frontend often needs changes in pci and vice versa.

Functions

There are different functions called via the API based on which PHP function is making the call.

Important to note here that most Functions exists in 2 flavours.

  • function1
  • function1_alternative

Usually if you make changes to function1 the changes need also be applied to function1_alternative, but in the same manner.

Special Solutions for Customers

Currently 3 Special Solutions are implemented. These solutions implement a filter behavior for the results returned by the PCI API.

HirmerGG Atelier Goldener Schitt
big_tall extra_image_filter
ist_reduziert

The Solutions are implemented very much the same:

Changes to get_products_metadata

1. Add your new Filter here

allowed_extra_fields = ["big_tall", "ist_reduziert", "extra_image_filter"]

2. Add your new Filter here

  extra_fields = postvars.get("extra_fields", []) # Should Contain extra_filter if send to API
  for item in allowed_extra_fields:
      if item in extra_fields:
          LOG.debug("%s field in extra_fields", item)
          fields_dict["metaData.{}".format(item)] = 1 # Add field to include it in MongoDB response
          if "extra_image_filter" in extra_fields:
              fields_dict["metaData.extraImgUrl"] = 1
              # AGS finder to exclude products without an extra_image
              finder["metaData.extra_image_filter"] = "extra_image_exists" # Exclude from non matching items from results

3. Check if your filter was applied in the results

      big_tall = "big_tall" in extra_fields
      extra_image_filter = "extra_image_filter" in extra_fields
      ist_reduziert = "ist_reduziert" in extra_fields

4. Display results with additional filter fields

      if big_tall:
          extra_field = extract_big_tall(item["metaData"].get("big_tall", "no big_tall"))
          result["big_tall"] = extra_field
      if ist_reduziert:
          extra_field = item["metaData"].get("ist_reduziert", "no ist_reduziert")
          result["ist_reduziert"] = extra_field
      if extra_image_filter:
          extra_field = item["metaData"].get("extraImgUrl", None)
          result["url"] = extra_field

Changes to products

<HTML><ol></HTML>

  • Same as step 1 above
  • Same as step 4 above<HTML></ol></HTML>
pci.txt · Last modified: 2024/04/11 14:23 by 127.0.0.1