/** * @param int $shopId * @param null|int $currencyId * @param null|int $customerGroupKey * @return Struct\ShopContext */ public function createShopContext($shopId, $currencyId = null, $customerGroupKey = null) { $shop = $this->shopGateway->get($shopId); $fallback = self::FALLBACK_CUSTOMER_GROUP; if ($customerGroupKey == null) { $customerGroupKey = $fallback; } $groups = $this->customerGroupGateway->getList([$customerGroupKey, $fallback]); $currency = null; if ($currencyId != null) { $currency = $this->currencyGateway->getList([$currencyId]); $currency = array_shift($currency); } if (!$currency) { $currency = $shop->getCurrency(); } return new Struct\ShopContext($this->buildBaseUrl(), $shop, $currency, $groups[$customerGroupKey], $groups[$fallback]); }
/** * @return Shop[] */ public function getShops() { return $this->shopGateway->getList($this->getShopIds()); }