/** * Retrieve generic object with all the misc store information values * * @param Store $store * @return DataObject */ public function getStoreInformationObject(Store $store) { $info = new DataObject(['name' => $store->getConfig(self::XML_PATH_STORE_INFO_NAME), 'phone' => $store->getConfig(self::XML_PATH_STORE_INFO_PHONE), 'hours' => $store->getConfig(self::XML_PATH_STORE_INFO_HOURS), 'street_line1' => $store->getConfig(self::XML_PATH_STORE_INFO_STREET_LINE1), 'street_line2' => $store->getConfig(self::XML_PATH_STORE_INFO_STREET_LINE2), 'city' => $store->getConfig(self::XML_PATH_STORE_INFO_CITY), 'postcode' => $store->getConfig(self::XML_PATH_STORE_INFO_POSTCODE), 'region_id' => $store->getConfig(self::XML_PATH_STORE_INFO_REGION_CODE), 'country_id' => $store->getConfig(self::XML_PATH_STORE_INFO_COUNTRY_CODE), 'vat_number' => $store->getConfig(self::XML_PATH_STORE_INFO_VAT_NUMBER)]); if ($info->getRegionId()) { $info->setRegion($this->regionFactory->create()->load($info->getRegionId())->getName()); } if ($info->getCountryId()) { $info->setCountry($this->countryFactory->create()->loadByCode($info->getCountryId())->getName()); } return $info; }
/** * {@inheritdoc} */ public function getConfig($path) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getConfig'); if (!$pluginInfo) { return parent::getConfig($path); } else { return $this->___callPlugins('getConfig', func_get_args(), $pluginInfo); } }
public function getConfig($path) { if ($this->isDeveloper) { switch ($path) { case Store::XML_PATH_SECURE_IN_FRONTEND: case Store::XML_PATH_SECURE_IN_ADMINHTML: return null; } } return parent::getConfig($path); }
/** * @param Store $store * @return \NostoBilling */ public function build(Store $store) { $metaData = new \NostoBilling(); try { $country = $store->getConfig('general/country/default'); if (!empty($country)) { $metaData->setCountry(new \NostoCountryCode($country)); } } catch (\NostoException $e) { $this->_logger->error($e, ['exception' => $e]); } return $metaData; }
/** * @param Store $store * @return \NostoAccount */ public function build(Store $store) { $metaData = new \NostoAccount(); try { $metaData->setTitle(implode(' - ', [$store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName()])); $metaData->setName(substr(sha1(rand()), 0, 8)); $metaData->setFrontPageUrl(\NostoHttpRequest::replaceQueryParamInUrl('___store', $store->getCode(), $store->getBaseUrl(UrlInterface::URL_TYPE_WEB))); $metaData->setCurrency(new \NostoCurrencyCode($store->getBaseCurrencyCode())); $lang = substr($store->getConfig('general/locale/code'), 0, 2); $metaData->setLanguage(new \NostoLanguageCode($lang)); $lang = substr($this->_localeResolver->getLocale(), 0, 2); $metaData->setOwnerLanguage(new \NostoLanguageCode($lang)); $owner = $this->_accountOwnerMetaBuilder->build(); $metaData->setOwner($owner); $billing = $this->_accountBillingMetaBuilder->build($store); $metaData->setBilling($billing); } catch (\NostoException $e) { $this->_logger->error($e, ['exception' => $e]); } return $metaData; }
/** * @param Store $store * @return \NostoIframe */ public function build(Store $store) { $metaData = new \NostoIframe(); try { $metaData->setUniqueId($this->_dataHelper->getInstallationId()); $lang = substr($this->_localeResolver->getLocale(), 0, 2); $metaData->setLanguage(new \NostoLanguageCode($lang)); $lang = substr($store->getConfig('general/locale/code'), 0, 2); $metaData->setShopLanguage(new \NostoLanguageCode($lang)); $metaData->setShopName($store->getName()); $metaData->setUniqueId($this->_dataHelper->getInstallationId()); $metaData->setVersionPlatform($this->_dataHelper->getPlatformVersion()); $metaData->setVersionModule($this->_dataHelper->getModuleVersion()); $metaData->setPreviewUrlProduct($this->_urlHelper->getPreviewUrlProduct($store)); $metaData->setPreviewUrlCategory($this->_urlHelper->getPreviewUrlCategory($store)); $metaData->setPreviewUrlSearch($this->_urlHelper->getPreviewUrlSearch($store)); $metaData->setPreviewUrlCart($this->_urlHelper->getPreviewUrlCart($store)); $metaData->setPreviewUrlFront($this->_urlHelper->getPreviewUrlFront($store)); } catch (\NostoException $e) { $this->_logger->error($e, ['exception' => $e]); } return $metaData; }
/** * Returns the account with associated api tokens for the store. * * @param Store $store the store. * * @return \NostoAccount|null the account or null if not found. */ public function findAccount(Store $store) { $accountName = $store->getConfig(self::XML_PATH_ACCOUNT); if (!empty($accountName)) { $account = new \NostoAccount($accountName); $tokens = json_decode($store->getConfig(self::XML_PATH_TOKENS), true); if (is_array($tokens) && !empty($tokens)) { foreach ($tokens as $name => $value) { try { $account->addApiToken(new \NostoApiToken($name, $value)); } catch (\NostoInvalidArgumentException $e) { } } } return $account; } return null; }