home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Services / Ebay / Call / GetItemShipping.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.9 KB  |  63 lines

  1. <?PHP
  2. /**
  3.  * Get shipping costs for an item
  4.  *
  5.  * $Id: GetItemShipping.php,v 1.2 2004/12/14 19:08:25 schst Exp $
  6.  *
  7.  * @package Services_Ebay
  8.  * @author  Stephan Schmidt <schst@php.net>
  9.  * @link    http://developer.ebay.com/DevZone/docs/API_Doc/Functions/GetItemShipping/GetItemShippingLogic.htm
  10.  */
  11. class Services_Ebay_Call_GetItemShipping extends Services_Ebay_Call 
  12. {
  13.    /**
  14.     * verb of the API call
  15.     *
  16.     * @var  string
  17.     */
  18.     protected $verb = 'GetItemShipping';
  19.  
  20.    /**
  21.     * arguments of the call
  22.     *
  23.     * @var  array
  24.     */
  25.     protected $args = array(
  26.                             'QuantitySold' => 1
  27.                         );
  28.  
  29.    /**
  30.     * parameter map that is used, when scalar parameters are passed
  31.     *
  32.     * @var  array
  33.     */
  34.     protected $paramMap = array(
  35.                                  'ItemId',
  36.                                  'ShipToZipCode',
  37.                                  'QuantitySold'
  38.                                 );
  39.     
  40.    /**
  41.     * make the API call
  42.     *
  43.     * @param    object Services_Ebay_Session
  44.     * @return   string
  45.     */
  46.     public function call(Services_Ebay_Session $session)
  47.     {
  48.         $return = parent::call($session);
  49.         
  50.         if (isset($return['ShippingRate']['ShippingServiceOptions']['ShippingServiceOption'][0])) {
  51.             $return['ShippingRate']['ShippingServiceOptions'] = $return['ShippingRate']['ShippingServiceOptions']['ShippingServiceOption'];
  52.             unset($return['ShippingRate']['ShippingServiceOptions']['ShippingServiceOption']);
  53.         } else {
  54.             $return['ShippingRate']['ShippingServiceOptions'] = array( $return['ShippingRate']['ShippingServiceOptions']['ShippingServiceOption'] );
  55.             unset($return['ShippingRate']['ShippingServiceOptions']['ShippingServiceOption']);
  56.         }
  57.         
  58.         
  59.         
  60.         return $return['ShippingRate'];
  61.     }
  62. }
  63. ?>