public function __construct($merchandiseId, $store) { if ($store->isAuthenticated()) { $url = sprintf('%sproduct.create.cp?v=%s&appKey=%s&merchandiseId=%s&fieldTypes=writable', Cafepress_Request::API_URL, Cafepress_Request::API_VERSION, $store->getAppKey(), $merchandiseId); parent::__construct($url, new Cafepress_ProductResponse()); $this->get(); } }
public function __construct($imagePath, $store, $folder = '', $goto = '') { if ($store->isAuthenticated()) { $folder = !empty($folder) ? $folder : $this->folder; $postFields = array('userToken' => $store->getUser()->getUserToken(), 'appKey' => $store->getAppKey(), 'folder' => $folder, 'cpFile1' => '@' . $imagePath); if (!empty($goto)) { $postFields['goto'] = $goto; } parent::__construct(self::UPLOAD_URL . 'image.upload.cp', new Cafepress_DesignResponse()); $this->post($postFields); } }
public function __construct($designs, $product, $store) { if ($store->isAuthenticated()) { $productResponse = $product->getResponse(); foreach ($designs as $position => $design) { $nodeList = $productResponse->queryPosition($position); $nodeList->item(0)->setAttribute('designId', $design->getImageId()); } $nodeList = $productResponse->queryStoreId(); //add the store name $nodeList->item(0)->value = $store->name; $url = sprintf('%sproduct.save.cp?v=%s', Cafepress_Request::API_URL, Cafepress_Request::API_VERSION); $postFields = array('userToken' => $store->getUser()->getUserToken(), 'appKey' => $store->getAppKey(), 'value' => $productResponse->getXML()); parent::__construct($url, new Cafepress_DesignerResponse()); $this->post($postFields); } }
public function __construct($email, $password, $store) { $url = sprintf('%sauthentication.getUserToken.cp?v=%s&appKey=%s&email=%s&password=%s', Cafepress_Request::API_URL, Cafepress_Request::API_VERSION, $store->getAppKey(), $email, $password); parent::__construct($url, new Cafepress_UserResponse()); $this->get(); }