Skip to main content

Overview

The Products API allows you to retrieve product information including details, pricing, images, options, and availability. Products are accessed through the catalog model rather than dedicated API controllers.

Get Product

Retrieve detailed information about a specific product by its ID.

Method

$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product_id);

Parameters

product_id
integer
required
The unique identifier of the product

Response

product_id
integer
Unique product identifier
name
string
Product name
description
string
Full product description
model
string
Product model/SKU
price
float
Product price (includes discount if applicable)
special
float
Special price if active, null otherwise
discount
float
Quantity discount price if applicable
tax_class_id
integer
Tax class identifier
quantity
integer
Available stock quantity
minimum
integer
Minimum order quantity
image
string
Main product image path
manufacturer_id
integer
Manufacturer identifier
manufacturer
string
Manufacturer name
shipping
boolean
Whether product requires shipping
weight
float
Product weight
weight_class_id
integer
Weight class identifier
length
float
Product length dimension
width
float
Product width dimension
height
float
Product height dimension
length_class_id
integer
Length class identifier
rating
integer
Average product rating (0-5)
reviews
integer
Number of product reviews
reward
integer
Reward points for purchase
status
boolean
Product enabled status
date_available
string
Date product becomes available
variant
array
Product variant options (for variant products)
override
array
Override values for master product
master_id
integer
Master product ID (for variant products)

Example Response

{
  "product_id": 42,
  "name": "Premium Wireless Headphones",
  "description": "High-quality wireless headphones with active noise cancellation...",
  "model": "WH-1000XM4",
  "sku": "HEADPHONES-001",
  "upc": "",
  "ean": "",
  "jan": "",
  "isbn": "",
  "mpn": "",
  "location": "Warehouse A",
  "price": 299.99,
  "special": 249.99,
  "discount": null,
  "tax_class_id": 9,
  "quantity": 50,
  "minimum": 1,
  "subtract": true,
  "stock_status_id": 7,
  "stock_status": "In Stock",
  "image": "catalog/products/headphones-main.jpg",
  "manufacturer_id": 8,
  "manufacturer": "Sony",
  "shipping": true,
  "weight": 0.25,
  "weight_class_id": 1,
  "length": 7.3,
  "width": 2.4,
  "height": 9.9,
  "length_class_id": 2,
  "rating": 5,
  "reviews": 127,
  "reward": 300,
  "points": 0,
  "status": true,
  "date_available": "2024-01-01",
  "date_modified": "2024-03-01 10:30:00",
  "date_added": "2024-01-01 08:00:00",
  "variant": [],
  "override": [],
  "master_id": 0
}

Get Products

Retrieve a list of products with optional filtering and sorting.

Method

$this->load->model('catalog/product');
$products = $this->model_catalog_product->getProducts($data);

Parameters

filter_category_id
integer
Filter by category ID
filter_sub_category
boolean
Include products from subcategories
filter_filter
string
Comma-separated filter IDs
Search term for product name
filter_tag
string
Search term for product tags
filter_description
boolean
Include description in search
filter_manufacturer_id
integer
Filter by manufacturer ID
sort
string
Sort field: p.sort_order, pd.name, p.model, p.quantity, p.price, rating, p.date_added
order
string
Sort order: ASC or DESC
start
integer
Offset for pagination (default: 0)
limit
integer
Number of products to return (default: 20)

Example Request

$data = [
    'filter_category_id' => 20,
    'filter_sub_category' => true,
    'filter_search' => 'wireless',
    'sort' => 'p.price',
    'order' => 'ASC',
    'start' => 0,
    'limit' => 20
];

$products = $this->model_catalog_product->getProducts($data);

Response

Returns an array of product objects with the same structure as Get Product.

Get Product Options

Retrieve all options for a product.

Method

$this->load->model('catalog/product');
$options = $this->model_catalog_product->getOptions($product_id);

Response Fields

product_option_id
integer
Product option identifier
option_id
integer
Base option identifier
name
string
Option name (e.g., “Size”, “Color”)
type
string
Option type: select, radio, checkbox, text, textarea, file, date, time, datetime
value
array
Available option values
required
boolean
Whether option is required

Example Response

[
  {
    "product_option_id": 218,
    "option_id": 5,
    "name": "Size",
    "type": "select",
    "required": true,
    "value": [
      {
        "product_option_value_id": 1,
        "option_value_id": 21,
        "name": "Small",
        "image": "",
        "quantity": 100,
        "subtract": true,
        "price": 0.00,
        "price_prefix": "+",
        "weight": 0.00,
        "weight_prefix": "+"
      },
      {
        "product_option_value_id": 2,
        "option_value_id": 22,
        "name": "Medium",
        "image": "",
        "quantity": 75,
        "subtract": true,
        "price": 0.00,
        "price_prefix": "+",
        "weight": 0.00,
        "weight_prefix": "+"
      }
    ]
  }
]

Get Product Images

Retrieve all images for a product.

Method

$this->load->model('catalog/product');
$images = $this->model_catalog_product->getImages($product_id);

Response

[
  {
    "product_image_id": 1,
    "image": "catalog/products/headphones-1.jpg",
    "sort_order": 0
  },
  {
    "product_image_id": 2,
    "image": "catalog/products/headphones-2.jpg",
    "sort_order": 1
  }
]

Get Product Subscriptions

Retrieve subscription plans available for a product.

Method

$this->load->model('catalog/product');
$subscriptions = $this->model_catalog_product->getSubscriptions($product_id);

Response Fields

subscription_plan_id
integer
Subscription plan identifier
name
string
Subscription plan name
price
float
Subscription price
frequency
string
Payment frequency: day, week, month, year
cycle
integer
Number of frequency units per cycle
duration
integer
Number of cycles (0 = unlimited)
trial_status
boolean
Whether trial period is available
trial_price
float
Trial period price
trial_frequency
string
Trial frequency period
trial_cycle
integer
Trial cycle count
trial_duration
integer
Trial duration in cycles

Product Validation

When adding products to cart, the following validations are performed:
  • Product Exists - Product ID must be valid and active
  • Stock Availability - Sufficient quantity must be available
  • Minimum Quantity - Order must meet minimum quantity requirement
  • Required Options - All required options must be provided
  • Option Values - Option values must be valid for the product
  • Subscription Plans - Valid subscription plan required if product has subscriptions

Code Examples

Get Product with Options

$this->load->model('catalog/product');

$product_id = 42;
$product_info = $this->model_catalog_product->getProduct($product_id);

if ($product_info) {
    // Get product options
    $options = $this->model_catalog_product->getOptions($product_id);
    
    // Get product images
    $images = $this->model_catalog_product->getImages($product_id);
    
    // Get subscriptions
    $subscriptions = $this->model_catalog_product->getSubscriptions($product_id);
    
    // Prepare response
    $response = [
        'product' => $product_info,
        'options' => $options,
        'images' => $images,
        'subscriptions' => $subscriptions
    ];
}

Search Products by Category

$this->load->model('catalog/product');

$data = [
    'filter_category_id' => 20,
    'filter_sub_category' => true,
    'sort' => 'p.price',
    'order' => 'ASC',
    'start' => 0,
    'limit' => 20
];

$products = $this->model_catalog_product->getProducts($data);
$total = $this->model_catalog_product->getTotalProducts($data);

foreach ($products as $product) {
    // Process each product
    echo $product['name'] . ' - ' . $product['price'];
}
Product pricing automatically includes applicable discounts and special prices. The price field returns the effective price the customer will pay.

Next Steps

Categories API

Browse product categories

Cart API

Add products to cart

Manufacturers API

Filter by manufacturer

Orders API

Create orders with products