-
-
Save epicbagel/a8c20e81aeeb0c7412c5d75a8e3aa7b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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