File indexing completed on 2024-12-29 05:28:01
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http:framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Service 0017 * @subpackage Ebay 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http:framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id: Item.php 22824 2010-08-09 18:59:54Z renanbr $ 0021 */ 0022 0023 /** 0024 * @see Zend_Service_Ebay_Finding_Abstract 0025 */ 0026 // require_once 'Zend/Service/Ebay/Finding/Abstract.php'; 0027 0028 /** 0029 * @category Zend 0030 * @package Zend_Service 0031 * @subpackage Ebay 0032 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0033 * @license http:framework.zend.com/license/new-bsd New BSD License 0034 * @uses Zend_Service_Ebay_Finding_Abstract 0035 */ 0036 class Zend_Service_Ebay_Finding_Search_Item extends Zend_Service_Ebay_Finding_Abstract 0037 { 0038 /** 0039 * If true, the seller requires immediate payment for the item. If false (or 0040 * not specified), immediate payment is not requested. Buyers must have a 0041 * PayPal account to purchase items that require immediate payment. 0042 * 0043 * A seller can choose to require immediate payment for Fixed Price and Buy 0044 * It Now listings, including eBay Stores Inventory listings. If a Buy It 0045 * Now item ends as an auction (that is, if the Buy It Now option is removed 0046 * due to bids being placed on the listing), the immediate payment 0047 * requirement does not apply. 0048 * 0049 * @var boolean 0050 */ 0051 public $autoPay; 0052 0053 /** 0054 * A unique identification number assigned by eBay to registered nonprofit 0055 * charity organizations. 0056 * 0057 * @var integer 0058 */ 0059 public $charityId; 0060 0061 /** 0062 * Two-letter ISO 3166 country code to indicate the country where the item 0063 * is located. 0064 * 0065 * @link http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm 0066 * @var string 0067 */ 0068 public $country; 0069 0070 /** 0071 * The distance that the item is from the buyer, calculated usin 0072 * buyerPostalCode. 0073 * 0074 * The unit for distance varies by site, and is either miles or kilometers. 0075 * If the country whose site you are searching uses kilometers to measure 0076 * distance (for example, India/EBAY-IN), the unit is kilometers. If the 0077 * site is either the US or UK, the distance unit is miles. 0078 * 0079 * This value is only returned for distance-based searches. You must 0080 * specify a buyerPostalCode and either sort by Distance, or use a 0081 * combination of the MaxDistance LocalSearch itemFilters. 0082 * 0083 * @var float 0084 */ 0085 public $distance; 0086 0087 /** 0088 * URL for the Gallery Plus image. 0089 * 0090 * The size of Gallery Plus images (up to 400 x 400 pixels) is bigger than 0091 * the size of standard gallery images. In site search results, you can view 0092 * the Gallery Plus image by hovering over or clicking the Enlarge link or 0093 * magifying glass icon. The image uses one of the following graphics 0094 * formats: JPEG, BMP, TIFF, or GIF. This field is only returned when the 0095 * seller has opted for the Gallery Plus option for the given item. 0096 * 0097 * @var string[] 0098 */ 0099 public $galleryPlusPictureURL; 0100 0101 /** 0102 * URL for the Gallery thumbnail image. 0103 * 0104 * The image must be provided in one of the following graphics formats: 0105 * JPEG, BMP, TIF, or GIF. Returned only if the seller chose to show a 0106 * gallery image. 0107 * 0108 * @var string 0109 */ 0110 public $galleryURL; 0111 0112 /** 0113 * The identifier for the site on which the item is listed. 0114 * 0115 * Returns a Global ID, which is a unique identifier that specifies the 0116 * combination of the site, language, and territory. In other eBay APIs 0117 * (such as the Shopping API), this value is know as the site ID. 0118 * 0119 * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/GlobalIdList.html 0120 * @var string 0121 */ 0122 public $globalId; 0123 0124 /** 0125 * The ID that uniquely identifies the item listing. 0126 * 0127 * eBay generates this ID when an item is listed. ID values are unique 0128 * across all eBay sites. 0129 * 0130 * @var string 0131 */ 0132 public $itemId; 0133 0134 /** 0135 * The format type of the listing, such as online auction, fixed price, or 0136 * advertisement. 0137 * 0138 * @var Zend_Service_Ebay_Finding_ListingInfo 0139 */ 0140 public $listingInfo; 0141 0142 /** 0143 * Physical location of the item, as specified by the seller. 0144 * 0145 * This gives a general indication from where the item will be shipped (or 0146 * delivered). 0147 * 0148 * @var string 0149 */ 0150 public $location; 0151 0152 /** 0153 * Identifies the payment method (or methods) the seller will accept for the 0154 * item (such as PayPal). 0155 * 0156 * Payment methods are not applicable to eBay Real Estate advertisement 0157 * listings or other Classified Ad listing formats. 0158 * 0159 * @link http://developer.ebay.com/DevZone/shopping/docs/CallRef/types/BuyerPaymentMethodCodeType.html 0160 * @var string[] 0161 */ 0162 public $paymentMethod; 0163 0164 /** 0165 * The postal code where the listed item is located. 0166 * 0167 * This field is returned only if a postal code has been specified by the 0168 * seller. eBay proximity and local search behavior can use the combination 0169 * of buyerPostalCode and postalCode values. 0170 * 0171 * @var string 0172 */ 0173 public $postalCode; 0174 0175 /** 0176 * Details about the first (or only) category in which the item is listed. 0177 * 0178 * Note that items can be listed in more than a single category. 0179 * 0180 * @var Zend_Service_Ebay_Finding_Category 0181 */ 0182 public $primaryCategory; 0183 0184 /** 0185 * Unique identifier for the eBay catalog product with which the item was 0186 * listed. 0187 * 0188 * An eBay catalog product consists of pre-filled Item Specifics, additional 0189 * descriptive information, plus a stock photo (if available). These product 0190 * details are used to pre-fill item information, which is used to describe 0191 * the item and can also help surface the item in searches. 0192 * 0193 * eBay supports the following types of product ID types: ISBN, UPC, EAN, 0194 * and ReferenceID (ePID, also known as an eBay Product Reference ID). 0195 * ReferenceID values are returned when available. A UPC, ISBN, or EAN 0196 * product identifier will be returned only when a ReferenceID is not 0197 * available. 0198 * 0199 * This productId value can be used as input with findItemsByProduct to 0200 * retrieve items that were listed with the specified eBay catalog product. 0201 * 0202 * This field is only returned when a product was used to list the item. 0203 * 0204 * @var string 0205 */ 0206 public $productId; 0207 0208 /** 0209 * Details about the second category in which the item is listed. 0210 * 0211 * This element is not returned if the seller did not specify a secondary 0212 * category. 0213 * 0214 * @var Zend_Service_Ebay_Finding_Category 0215 */ 0216 public $secondaryCategory; 0217 0218 /** 0219 * Information about the item's seller. 0220 * 0221 * Only returned if SellerInfo is specified in the outputSelector field in 0222 * the request. 0223 * 0224 * @var Zend_Service_Ebay_Finding_SellerInfo 0225 */ 0226 public $sellerInfo; 0227 0228 /** 0229 * Specifies the item's selling status with regards to eBay's processing 0230 * workflow. 0231 * 0232 * @var Zend_Service_Ebay_Finding_SellingStatus 0233 */ 0234 public $sellingStatus; 0235 0236 /** 0237 * Container for data about a listing's shipping details. 0238 * 0239 * @var Zend_Service_Ebay_Finding_ShippingInfo 0240 */ 0241 public $shippingInfo; 0242 0243 /** 0244 * Information about the eBay store in which the item is listed. 0245 * 0246 * Only returned if the item is listed in a store and StoreInfo is specified 0247 * in the outputSelector field in the request. 0248 * 0249 * @var Zend_Service_Ebay_Finding_Storefront 0250 */ 0251 public $storeInfo; 0252 0253 /** 0254 * Subtitle of the item. 0255 * 0256 * Only returned if the seller included a subtitle for the listing. 0257 * 0258 * @var string 0259 */ 0260 public $subtitle; 0261 0262 /** 0263 * Name of the item as it appears in the listing title, or in search and 0264 * browse results. 0265 * 0266 * @var string 0267 */ 0268 public $title; 0269 0270 /** 0271 * The URL to view this specific listing on eBay. 0272 * 0273 * The returned URL is optimized to support natural search. That is, the URL 0274 * is designed to make items on eBay easier to find via popular internet 0275 * search engines. The URL includes the item title along with other 0276 * optimizations. To note, "?" (question mark) optimizes to "_W0QQ", "&" 0277 * (ampersand) optimizes to "QQ", and "=" (equals sign) optimizes to "Z". 0278 * 0279 * Do not modify the returned URLs in your application queries (for example, 0280 * eBay won't recognize the URL if you change QQ to &). In the Sandbox 0281 * environment (and on the Hong Kong site), the data returned in this field 0282 * is a standard ViewItem URL rather than the ViewItemURL for natural 0283 * search. 0284 * 0285 * @var string 0286 */ 0287 public $viewItemURL; 0288 0289 /** 0290 * @return void 0291 */ 0292 protected function _init() 0293 { 0294 parent::_init(); 0295 $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING; 0296 0297 $this->autoPay = $this->_query(".//$ns:autoPay[1]", 'boolean'); 0298 $this->charityId = $this->_query(".//$ns:charityId[1]", 'integer'); 0299 $this->country = $this->_query(".//$ns:country[1]", 'string'); 0300 $this->distance = $this->_query(".//$ns:distance[1]", 'float'); 0301 $this->galleryPlusPictureURL = $this->_query(".//$ns:galleryPlusPictureURL", 'string', true); 0302 $this->galleryURL = $this->_query(".//$ns:galleryURL[1]", 'string'); 0303 $this->globalId = $this->_query(".//$ns:globalId[1]", 'string'); 0304 $this->itemId = $this->_query(".//$ns:itemId[1]", 'string'); 0305 $this->location = $this->_query(".//$ns:location[1]", 'string'); 0306 $this->paymentMethod = $this->_query(".//$ns:paymentMethod", 'string', true); 0307 $this->postalCode = $this->_query(".//$ns:postalCode[1]", 'string'); 0308 $this->productId = $this->_query(".//$ns:productId[1]", 'string'); 0309 $this->subtitle = $this->_query(".//$ns:subtitle[1]", 'string'); 0310 $this->title = $this->_query(".//$ns:title[1]", 'string'); 0311 $this->viewItemURL = $this->_query(".//$ns:viewItemURL[1]", 'string'); 0312 0313 $this->_attributes['distance'] = array( 0314 'unit' => $this->_query(".//$ns:distance[1]/@unit[1]", 'string') 0315 ); 0316 $this->_attributes['productId'] = array( 0317 'type' => $this->_query(".//$ns:productId[1]/@type[1]", 'string') 0318 ); 0319 0320 $node = $this->_xPath->query(".//$ns:listingInfo[1]", $this->_dom)->item(0); 0321 if ($node) { 0322 /** 0323 * @see Zend_Service_Ebay_Finding_ListingInfo 0324 */ 0325 // require_once 'Zend/Service/Ebay/Finding/ListingInfo.php'; 0326 $this->listingInfo = new Zend_Service_Ebay_Finding_ListingInfo($node); 0327 } 0328 0329 $node = $this->_xPath->query(".//$ns:primaryCategory[1]", $this->_dom)->item(0); 0330 if ($node) { 0331 /** 0332 * @see Zend_Service_Ebay_Finding_Category 0333 */ 0334 // require_once 'Zend/Service/Ebay/Finding/Category.php'; 0335 $this->primaryCategory = new Zend_Service_Ebay_Finding_Category($node); 0336 } 0337 0338 $node = $this->_xPath->query(".//$ns:secondaryCategory[1]", $this->_dom)->item(0); 0339 if ($node) { 0340 /** 0341 * @see Zend_Service_Ebay_Finding_Category 0342 */ 0343 // require_once 'Zend/Service/Ebay/Finding/Category.php'; 0344 $this->secondaryCategory = new Zend_Service_Ebay_Finding_Category($node); 0345 } 0346 0347 $node = $this->_xPath->query(".//$ns:sellerInfo[1]", $this->_dom)->item(0); 0348 if ($node) { 0349 /** 0350 * @see Zend_Service_Ebay_Finding_SellerInfo 0351 */ 0352 // require_once 'Zend/Service/Ebay/Finding/SellerInfo.php'; 0353 $this->sellerInfo = new Zend_Service_Ebay_Finding_SellerInfo($node); 0354 } 0355 0356 $node = $this->_xPath->query(".//$ns:sellingStatus[1]", $this->_dom)->item(0); 0357 if ($node) { 0358 /** 0359 * @see Zend_Service_Ebay_Finding_SellingStatus 0360 */ 0361 // require_once 'Zend/Service/Ebay/Finding/SellingStatus.php'; 0362 $this->sellingStatus = new Zend_Service_Ebay_Finding_SellingStatus($node); 0363 } 0364 0365 $node = $this->_xPath->query("./$ns:shippingInfo", $this->_dom)->item(0); 0366 if ($node) { 0367 /** 0368 * @see Zend_Service_Ebay_Finding_ShippingInfo 0369 */ 0370 // require_once 'Zend/Service/Ebay/Finding/ShippingInfo.php'; 0371 $this->shippingInfo = new Zend_Service_Ebay_Finding_ShippingInfo($node); 0372 } 0373 0374 $node = $this->_xPath->query(".//$ns:storeInfo[1]", $this->_dom)->item(0); 0375 if ($node) { 0376 /** 0377 * @see Zend_Service_Ebay_Finding_Storefront 0378 */ 0379 // require_once 'Zend/Service/Ebay/Finding/Storefront.php'; 0380 $this->storeInfo = new Zend_Service_Ebay_Finding_Storefront($node); 0381 } 0382 } 0383 0384 /** 0385 * @param Zend_Service_Ebay_Finding $proxy 0386 * @param Zend_Config|array $options 0387 * @return Zend_Service_Ebay_Finding_Response_Items 0388 */ 0389 public function findItemsByProduct(Zend_Service_Ebay_Finding $proxy, $options = null) 0390 { 0391 $type = $this->attributes('productId', 'type'); 0392 return $proxy->findItemsByProduct($this->productId, $type, $options); 0393 } 0394 }