예제 #1
0
 public function __construct($rawData)
 {
     $this->rawData = $rawData;
     if (!empty($this->rawData['total'])) {
         $this->total = $this->rawData['total'];
     }
     $preparedResponse = new Shopware_StoreApi_Core_Response_Response($rawData);
     $this->collection = $preparedResponse->getCollection();
 }
예제 #2
0
파일: Client.php 프로젝트: nhp/shopware-4
    public function call($type, $url, $json)
    {
        $version = Shopware()->BackendSession()->storeApiConfigVersion;
        $language = Shopware()->BackendSession()->storeApiConfigLanguage;
        $json['config'] = array(
            'version' => $version,
            'language' => $language
        );

        $json = Zend_Json::encode($json);
        $response = $this->client->call($type, $url, $json)->post();

        if($response->status == self::RESPONSE_FAILED) {
            preg_match('#(.*):(\d*)#', $response->response->message, $error_match);
            return new Shopware_StoreApi_Exception_Response($error_match[1], $error_match[2]);
        } else {
            $preparedResponse = new Shopware_StoreApi_Core_Response_Response($response->response);
            return current($preparedResponse->getCollection());
        }
    }