List products - celdotro/marketplace GitHub Wiki

About

  • Returns data for products whose name fit a pattern. The list is limited by a start and limit pair of values, but also contains a field for the total number of products that fit the filter's pattern.
  • No matter what limit is chosen, the maximum number of products that are returned for a call is 50.

Class

celmarket\Products\ProductsList

Method

listProducts

API

  • method: products
  • action: readProducts

Parameters

  • start = start position
  • limit = maximum number of products
  • search = name / model based search
    • the string will be split into words and the products that contain the words in the specified order in their names will be returned
  • forceCount = return the total number of rows no matter what conditions are used
  • filters = array containing product filters -> json_encode(array)
    • keyword = search product by name or model - only used for compatibility, if the parameter "search" has a valid value, it will replace this parameter
    • manufacturer = name of a manufacturer
    • status = array containing statuses -> array
      • (array element) = status (the only possible values are 0 and 1)
    • categories_id = array containing the IDs of categories -> array
      • (array element) = categoriy's ID
    • products_last_modified_min = product's minimum modification date
    • products_last_modified_max = product's maximum modification date
    • products_date_added_min = product's minimum added date
    • products_date_added_max = product's maximum added date
    • products_model = array with products' models - maximum 50 -> array
      • (array element) = product's model
    • includeTransport = whether or not it includes the transport tax
    • orderByMostViewed = if true, then products will be sorted by the number of views

Response

An object with the following attributes

  • limit = total number of returned products
  • start = start position of the returned list
  • moreavailable = there are more products
  • data = products -> array
    • pretf = supplier's price
    • products_model = product's model
    • bonus = bonus values -> array
      • (array element) = bonus
    • stoc = stock value
    • cand = add date
    • pret_vechi = former price
    • id_campanie = the id of the product's campaign
    • pret_promo = promotional price computed using the Lei price and discount
    • start = start
    • adaos = added value
    • pretlei = Lei (RON | ROL) price including VAT
    • moneda = currency's name
      • USD = USA Dollar
      • EUR = Euro
      • RON = Romanian Leu
      • lei = Romanian Leu
    • end = end
    • procesare_in = processing
    • status = status
    • products_status = status on website
    • products_name = product's name
    • products_url = product's url
    • garantie = duration of warranty in months for persons
    • garantie_pj = duration of warranty in months for companies
    • url = url value
    • pret_promo = product's promotional price
    • products_description = products' description
      • the description is encoded in base64
    • link = product's link
      • begins with test.cel.ro if a test user is being used
      • begins with www.cel.ro if it's in production environment
    • charact = product's characteristics -> array
      • (array element) = characteristic
        • (key) = characteristic's name
        • (value) = characteristic's values -> array
          • (array element) = a specific value of a characteristic
    • weight = product's weight
    • main_image = product's main image
    • manufacturer = manufacturer's ID
    • categs = categories from which the product belongs
      • (array element) = category
        • (key) = category's ID
        • (value) = category's name
    • secondary_images = secondary images -> array
      • (array element) = secondary image information -> array
        • url = secondary image's URL
        • id = secondary image's ID
    • principal = whether the affiliate is principal for the product (1) or not (0)
    • VAT = product's VAT
    • products_last_modified = date of product's last change
    • products_date_added = product's adding date
    • total_views = total number of views for the last 5 days
    • date_views = number of views for each date from the last 5 days
      • products_views = number of views for each date
      • data = date
    • promotion = product's promotion
      • 0 = normal
      • 2 = promotion
      • 3 = stock clearing
    • extprice = external price (optional)
  • count = total number of products whose names fit the filter'so pattern (optional)

Example - PHP

https://github.com/celdotro/marketplace_examples/blob/master/Products/2.listProducts.php

Example - JSON

{
  "request": {
    "start": 0,
    "limit": 0,
    "search": "X",
    "forceCount": true,
    "filters": {
      "keyword": "X",
      "manufacturer": [1],
      "status": "X",
      "categories_id": [1],
      "products_last_modified_min": "01-01-2018",
      "products_last_modified_min": "01-01-2018",
      "products_date_added_min": "01-01-2018",
      "products_date_added_max": "01-01-2018",
      "products_model": ["X"]
    }
  },
  
  "response": {
    "limit": 0,
    "start": 0,
    "moreavailable": 0,
    "data": [
      {
        "pretf": 1,
        "products_model": "X",
        "bonus": [],
        "stoc": 1,
        "cand": "2018-01-01 00:00:00",
        "pret_vechi": 1,
        "id_campanie": 1,
        "pret_promo": 1,
        "start": 1,
        "adaos": 1,
        "pretlei": 1,
        "moneda": "X",
        "end": 0,
        "procesare_in": 0,
        "status": 0,
        "products_status": 0,
        "products_name": "X",
        "products_url": "X",
        "garantie": 1,
        "garantie_pj": 1,
        "url": "X",
        "family_id": 1,
        "principal": 1,
        "categories_id": 1,
        "products_last_modified": "2018-01-01 00:00:00",
        "products_date_added": "2018-01-01 00:00:00",
        "vendor_ext_id": 0,
        "products_description": "X",
        "family_name": "X",
        "family_characts": [
          {
            "charact": "X",
            "mode": 1
          }
        ],
        "link": "X",
        "formattedCategory": {
          "1": {
            "parents_name": "X",
            "current_id": 1
          }
        },
        "tva": 1,
        "charact": [],
        "weight": 0,
        "main_image": "X",
        "manufacturer": "X",
        "categs": {
          "1": "X"
        },
        "formattedCategories": {
          "1": {
            "parents_name": "X",
            "current_id": 1
          }
        },
        "secondary_images": []
      }
    ]
  }
}
⚠️ **GitHub.com Fallback** ⚠️