Products

The Essence of Products in Venddor IO

When one thinks of an online store or marketplace, the first thing that usually comes to mind is the products. These are the heart of any e-commerce platform. Within the Venddor IO system, administrators have the power to curate an array of products, updating or removing them as needed. However, it's essential to understand that these product manipulations are behind the scenes, away from the customer's eye. Customers experience these products via the storefront, where they can view and make purchases, but they don't interact with them through the API directly.

In the digital shopping ecosystem of Venddor IO, a product isn't just confined to being an item on a shelf. It plays a dynamic role, especially when it transitions into carts or becomes part of orders, establishing the entire shopping journey.

Now, let's delve into the concept of Product Variations. Consider products that are essentially the same but have minor distinctions, like color or size, which are tied to specific product features. Venddor IO innovatively groups these under "Product Variation Groups." This grouping is more than just an organizational tool. It elevates the shopping experience, enabling customers to seamlessly toggle between variations on the storefront. Rather than navigating to a new page for each variation, they can smoothly transition to their desired product feature on the same page, ensuring a more streamlined and user-friendly shopping experience.

Exploring Products in Venddor IO

When diving into the digital realm of online commerce, products act as the backbone. To effectively interact with this core element within Venddor IO, certain API endpoints and parameters are available.

Fetching Products

Getting a Glimpse of All Products:

Shoot a simple GET request to /api/products/. The number of products that grace your screen will depend on the items_per_page parameter. This parameter is flexible; you can alter its value either directly through the API or indirectly via the Admin panel under Settings → Appearance.

Specificity Matters - Targeting Category-Specific Products

If your aim is zoned in on products within a specific category, then direct your GET request towards /api/categories/:id/products/. Here, :id stands for the desired category's unique identifier.

Tailoring Your Product View - Pagination, Sorting & Filtering

Venddor IO ensures that you're never overwhelmed with data. With an array of parameters, you can choose exactly which products you want to see and in what order:

Examples for Practical Insights

  1. For Store Builders: To retrieve products from a specific store, use:
GET /api/stores/<company_id>/products/
  1. For stores using Venddor Seller Center: To obtain products from a certain vendor, the request should be:
GET api/vendors/<vendor_id>/products
  1. Filtered Search: If, for instance, you're seeking products from the first store priced over $10, having 'foo' in their description, and you want them alphabetically sorted, then your go-to would be:
GET /api/stores/1/products?price_from=10&sort_by=product&sort_order=asc&pname=foo

Understanding Product Responses in Venddor IO

Navigating through online marketplaces and stores, products serve as the linchpin. When interacting with these essential components within Venddor IO, it's helpful to understand the structure and significance of the API responses you'll encounter.

Sample Request and Its Interpretation

Consider this basic request to fetch a limited list of products:

GET /api/products?items_per_page=2

Upon firing this request, the system responds with a neatly formatted JSON, which we'll dissect below:

Breakdown

  1. Products Array:

This section provides a detailed array of products fetched from the system. Each product comes equipped with essential attributes. For instance:

  1. Response Parameters (params):

The tail-end of the response offers a glimpse into the parameters applied during the request. Here's a rundown:

Accessing Specific Products in Venddor IO

Fetching Individual Products

To retrieve detailed data on a single product, initiate a GET request as follows:

GET /api/products/<product_id>/

For instance:

GET /api/products/12

To hone in on a specific product housed under a distinct category, utilize the following structure:

GET /api/categories/:id/products/:id

Example:

GET /api/categories/229/products/12

Understanding Product Attributes

In Venddor IO, products encompass a wide range of properties that are encapsulated as fields. The platform always communicates using strings and array/objects for a consistent and reliable experience. Here's a glimpse of what to expect:

Sample Response

Initiating a sample request:

GET request to /api/products/12

Yields a comprehensive JSON response. For example:

{
  "product_id": "12",
  "product": "100g Pants",
  ...
  "seo_name": "100g-pants",
  "seo_path": "223/224",
  ...
  "main_pair":
  {
    "pair_id": "823",
    ...
    "detailed":
    {
      ...
      "image_path": "https://example.com/images/detailed/0/173283_0113298267324f438bac97eaf.jpg",
      ...
    }
  },
  ...
}

Product Management in Venddor IO

Creating a Product

Venddor IO streamlines product addition via simple POST requests:

Use the endpoint:

POST /api/stores/<company_id>/products/

The endpoint is:

POST /api/products/

A basic product requires just three attributes: a name, its main category ID, and a price. The structure would resemble:

{
  "product": "Product Name",
  "category_ids": "166",
  "price": "1000"
}

Creating a Vendor-Specific Product

Each vendor in stores using Venddor Seller Center is treated as an independent entity. If you're aiming to list a product under a specific vendor, you need to include their unique vendor_id. An example for a vendor with ID 1:

POST /api/vendors/1/products/
{
  "product": "Vendor's Product Name",
  "category_ids": "166",
  "price": "1000"
}

Product Imagery

Venddor IO allows products to be associated with multiple images. The primary image is specified under the main_pair object, whereas additional images fall under image_pairs. Images can be sourced from URLs or uploaded directly to your server. Here's an illustrative breakdown:

{
  "product": "Product Name",
  ...
  "image_pairs": {...},
  "main_pair": {...}
}

Response for Product Creation

If the product creation process succeeds, the server returns:

HTTP/1.1 201 Created

With a JSON payload confirming the product's ID, for example: { "product_id": 391 }.

However, if there are issues, the system will respond with a HTTP/1.1 400 Bad Request.

Updating Existing Products

Venddor IO makes product modification straightforward with PUT requests. For instance, to modify a product with ID 12:

PUT /api/product/12

You can adjust numerous attributes, ranging from basic details such as the product name, price, and quantity to more intricate elements like imagery and features.

Removing Products

Product deletion in Venddor IO is achieved through DELETE requests. If you wish to remove a product with ID 12, for example:

DELETE /api/products/12/

Successful product deletion yields:

HTTP/1.1 204 No Content

Whereas a failed deletion or attempt to delete a non-existent product results in error messages like HTTP/1.1 400 Bad Request or HTTP/1.1 404 Not Found respectively.