OpenCart
Our OpenCart integration is designed as an end-to-end model that allows us to pull in product details, inventory levels, and pricing and facilitate order placement.
<?php
/*
Place this file in the following file (you'll need to create this file if it doesn't yet exist).
/public_html/catalog/controller/api/dstnc.php
*/
class ControllerApiJetti extends Controller {
public function products() {
$this->load->language('api/custom');
$json = array();
$this->load->model('catalog/product');
// Get all products
$products = $this->model_catalog_product->getProducts();
foreach ($products as $product) {
// Add the images for this product to the response
$json['success']['images'][$product['product_id']] = $this->model_catalog_product->getProductImages($product['product_id']);
}
$json['success']['products'] = $products;
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
}Last updated