コード例 #1
0
 /**
  * @return ProductVariation[]
  */
 public function getProductVariations()
 {
     $result = array();
     $options = array();
     if (!empty($this->item->Variations->Variation)) {
         foreach ($this->item->Variations->Variation as $item) {
             $variants = array();
             $price = XmlHelper::getAsDouble($item, 'StartPrice');
             $quantity = XmlHelper::getAsDouble($item, 'Quantity');
             foreach ($item->VariationSpecifics->NameValueList as $option_item) {
                 $option_name = XmlHelper::getAsString($option_item, 'Name');
                 $variant_name = XmlHelper::getAsString($option_item, 'Value');
                 if (!isset($options[$option_name])) {
                     $option = new ProductOption($option_name);
                     $options[$option_name] = $option;
                 } else {
                     $option = $options[$option_name];
                 }
                 $variant = new ProductOptionVariant($option, $variant_name);
                 $option->setVariant($variant);
                 $variants[] = $variant;
             }
             $result[] = new ProductVariation($price, $quantity, $variants);
         }
     }
     return $result;
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function __construct(\SimpleXMLElement $response)
 {
     parent::__construct($response);
     $this->response = $response;
     $this->count = XmlHelper::getAsInt($response, 'CategoryCount');
     $this->min_reserve_price = XmlHelper::getAsDouble($response, 'MinimumReservePrice');
     $this->reduce_reserve_allowed = XmlHelper::getAsBoolean($response, 'ReduceReserveAllowed');
     $this->reserve_price_allowed = XmlHelper::getAsBoolean($response, 'ReservePriceAllowed');
     $this->update_time = XmlHelper::getAsString($response, 'UpdateTime');
 }