Пример #1
0
 protected function assignValues($data)
 {
     parent::assignValues($data);
     $this->facets = array();
     foreach ($data->facets as $facet) {
         $this->facets[] = new Facet($facet);
     }
     $this->products = array();
     foreach ($data->products as $product) {
         $this->products[] = new ListProduct($product);
     }
 }
Пример #2
0
 public function assignValues($data)
 {
     parent::assignValues($data);
     $this->contents = array();
     foreach ($data->contents as $item) {
         switch ($item->type) {
             case 'PromotionGroup':
                 $item = new PromotionGroup($item);
                 break;
             case 'CartProduct':
                 $item = new CartProduct($item);
                 break;
             default:
                 throw new \InvalidArgumentException('Unknown cart item type in cart');
         }
         $this->contents[] = $item;
     }
 }
Пример #3
0
 protected function assignValues($data)
 {
     parent::assignValues($data);
     $this->resizedMainImage = new ResizableImage($data->resizedMainImage);
     $this->resizedImages = array();
     foreach ($data->resizedImages as $img) {
         $this->resizedImages[] = new ResizableImage($img);
     }
     $this->sku = new SKU($data->SKU);
     $this->parentSKU = $data->parentSKU ? new SKU($data->parentSKU) : null;
     $this->trackingSKU = new SKU($data->trackingSKU);
     $this->brand = new Brand($data->brand);
     $this->price = new Price($data->price->amount, $data->price->currency);
     $this->localisedPrice = new LocalisedPrice($data->localisedPrice);
     $this->categories = array();
     foreach ($data->categories as $cat) {
         $this->categories = new Category($cat);
     }
 }
Пример #4
0
 public function __construct(Commerce\Configuration $configuration, Commerce\Connection $connection, $page)
 {
     parent::__construct($configuration, $connection);
     $this->page = $page;
 }