Skip to content

Instantly share code, notes, and snippets.

@epicbagel epicbagel/jetti.php Secret
Last active Aug 16, 2017

Embed
What would you like to do?
<?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/jetti.php
To check it is working, you can then load the following URL. You should see your list of products:
https://<your domain here>/index.php?route=api/jetti/products
*/
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));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.