public function detail($productId)
 {
     $product = null;
     if (empty($productId)) {
         echo json_encode(['error' => 'Missing product ID !', 'error-code' => 400]);
         return;
     }
     try {
         $product = Atlas::getProduct($productId);
     } catch (\Exception $ex) {
         echo json_encode(['error' => $ex->getMessage(), 'error-code' => $ex->getCode()]);
         return;
     }
     // Load the view to display accommodation detail
     echo self::loadView('Accommodation/detail', ['product' => $product->product_distribution->product_record, 'multimedia' => $product->product_distribution->product_multimedia, 'address' => $product->product_distribution->product_address]);
 }
Esempio n. 2
0
<?php

use Src\Helpers\Config;
use Src\Model\Atlas;
require_once __DIR__ . '/../../vendor/autoload.php';
// Check if the configuration value can be loaded
echo Config::getInstance()->get('atlas.api', 'key') . "\n\n";
// Check if category ID can be fetched from the Atlas API
echo Atlas::getCategoryId('Accommodation') . "\n\n";
// Check if products with params can be fetched from the Atlas API
$products = Atlas::getProducts(['cats' => 'ACCOMM', 'rg' => 'Blue Mountains']);
$product = Atlas::getProduct('9053120$53072421-f579-4ebe-822f-086c91455403');
print_r($product);