예제 #1
0
파일: Print.php 프로젝트: rcclaudrey/dev
 public function requestAssemblyInfo()
 {
     $params = $this->getParams();
     $params['action'] = 'state';
     $arioemConfig = array();
     require MAGENTO_ROOT . '/arioem/creds.php';
     $oem = new Vikont_ARIOEMAPI($arioemConfig);
     try {
         $this->_info = $oem->dispatch($params);
     } catch (Exception $e) {
         Mage::logException($e);
     }
     return $this;
 }
예제 #2
0
 public function dispatch($params)
 {
     self::$_params = $params;
     $action = isset($params['action']) ? strtolower($params['action']) : 'none';
     unset($params['action']);
     // we don't need this to be sent to the API
     unset($params['_']);
     // the jQuery parameter preventing caching
     unset($params['debug']);
     // we don't need this to be sent to the API
     $result = array();
     switch ($action) {
         case 'vehicle':
         case 'year':
         case 'model':
         case 'assembly':
             $result = $this->processAssembly($params, $action);
             break;
         case 'part':
             $result = $this->processPart($params);
             break;
         case 'image':
             // site.url/arioem/index.php?action=image&brandCode=YAM&parentId=232390&assemblyId=204079&width=175&resizeBy=small
             $url = $this->processImage($params);
             if (@self::$_params['debug']) {
                 vd($url);
             }
             if ($url) {
                 header('Location: ' . $url);
                 die;
             } else {
                 header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
                 die;
             }
             break;
         case 'hash':
             $result = $this->processHash($params);
             break;
         case 'state':
             $result = $this->processState($params);
             break;
         case 'search':
             $result = $this->processSearch($params);
             $result['_request'] = self::$_params;
             break;
         case 'part-model-assemblies':
             $result = $this->processPartModelAssemblies($params);
             break;
         case 'part-models':
             $result = $this->processPartModels($params);
             break;
         case 'autocomplete':
             $result = $this->processAutocomplete($params);
             break;
             //			case 'test':
             //				$this->initSession();
             //				vd($_SESSION);
         //			case 'test':
         //				$this->initSession();
         //				vd($_SESSION);
         default:
             return false;
     }
     if (count($this->_warnings)) {
         $result['warnings'] = $this->_warnings;
     }
     if (@self::$_params['debug'] || @self::$_params['result']) {
         vd($result);
     }
     return $result;
 }
예제 #3
0
파일: index.php 프로젝트: rcclaudrey/dev
<?php

include_once '../Vic.php';
require_once 'ARIOEMAPI_Config.php';
require_once 'ARIOEMAPI_Translate.php';
require_once '../lib/Vikont/ARIOEMAPI.php';
$arioemConfig = new ARIOEMAPI_Config();
$arioemConfigData = $arioemConfig->config();
$arioemTranslation = new ARIOEMAPI_Translate();
$arioemConfigData['translate'] = $arioemTranslation->config();
$oem = new Vikont_ARIOEMAPI($arioemConfigData);
try {
    $response = $oem->dispatch($_GET);
} catch (Exception $e) {
    $response = array('error' => true, 'errorMessage' => $e->getMessage());
}
header('Content-Type: text/json');
echo json_encode($response);