Exemplo n.º 1
0
 public function __construct($uri)
 {
     $rest = new RestRequest();
     $this->requestUri = $uri;
     $xml = simplexml_load_string($rest->submit($uri));
     $this->productID = (string) $xml->attributes()->id;
     $this->productTypeLink = (string) $xml->productType->attributes('http://www.w3.org/1999/xlink');
     $this->resourceLink = (string) $xml->resources->resource[1]->attributes('http://www.w3.org/1999/xlink');
     $this->defaultAppearanceID = (string) $xml->appearance['id'];
 }
Exemplo n.º 2
0
 public function __construct($shopId, $articleId)
 {
     $rest = new RestRequest();
     $this->requestUri = 'http://api.spreadshirt.net/api/v1/shops/' . $shopId . '/articles/' . $articleId;
     $xml = simplexml_load_string($rest->submit($this->requestUri));
     //->children('http://api.spreadshirt.net');
     $this->articleID = (string) $xml->attributes()->id;
     $this->price = (string) $xml->price->vatIncluded;
     $this->productLink = (string) $xml->product->attributes('http://www.w3.org/1999/xlink');
     $this->productID = (string) $xml->product['id'];
     $this->resourceLink = (string) $xml->resources->resource->attributes('http://www.w3.org/1999/xlink');
 }
Exemplo n.º 3
0
 public function __construct()
 {
     // assign class variables and load data from sprd API
     // grab the first product/article from shop if the articleID is not set...
     if (!isset($this->articleID)) {
         $rest = new RestRequest();
         $requestUri = 'http://api.spreadshirt.net/api/v1/shops/' . $this->shopID . '/articles';
         $xml = simplexml_load_string($rest->submit($requestUri));
         //$this->articleID = (String) $xml->article->attributes()->id;
         $this->articleID = (string) $xml->article['id'];
     }
     $this->article = new ArticleCDO($this->shopID, $this->articleID);
     $this->product = new ProductCDO($this->article->getProductLink());
     $this->productType = new ProductTypeCDO($this->product->getProductTypeLink());
 }
Exemplo n.º 4
0
 public function __construct($uri)
 {
     $rest = new RestRequest();
     $this->requestUri = $uri;
     $xml = simplexml_load_string($rest->submit($uri));
     $this->productTypeID = (string) $xml->attributes()->id;
     $this->name = (string) $xml->name;
     $this->description = (string) $xml->description;
     // transform sizes to a 2d array
     $tmp = array();
     $array = (array) $xml->sizes;
     if (!empty($array)) {
         foreach ($array['size'] as $key => $values) {
             if (is_a($values, 'SimpleXMLElement')) {
                 $tmp[(string) $values->attributes()->id] = (string) $values->name;
             }
         }
     }
     $this->sizes = $tmp;
 }