# OpenCart

OpenCart does not provide API access to sync product and inventory data. Therefore, you'll need to add the 'API connector' file to the web server that OpenCart is installed on.

In most cases, this can be done via the "cpanel" dashboard that is available from your hosting provider. If someone built and set up your store for you, it should only take a few minutes for them to set this up on your behalf.

1. Copy the API connector code below, and save it as 'dstnc.php'. Copy the file into "/public\_html/catalog/controller/api/jetti.php"<br>
2. To check the file worked, you should then be able to access the following URL: `https://<your domain here>/index.php?route=api/dstnc/products`

```php
<?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));
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dstnc.com/integrations/opencart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
