示例#1
0
 /**
  * {@inheritdoc}
  */
 public function getCode()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getCode');
     if (!$pluginInfo) {
         return parent::getCode();
     } else {
         return $this->___callPlugins('getCode', func_get_args(), $pluginInfo);
     }
 }
 /**
  * @param \Magento\Store\Model\Store $store
  * @return \Magento\Store\Api\Data\StoreConfigInterface
  */
 protected function getStoreConfig($store)
 {
     /** @var \Magento\Store\Model\Data\StoreConfig $storeConfig */
     $storeConfig = $this->storeConfigFactory->create();
     $storeConfig->setId($store->getId())->setCode($store->getCode())->setWebsiteId($store->getWebsiteId());
     foreach ($this->configPaths as $methodName => $configPath) {
         $configValue = $this->scopeConfig->getValue($configPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode());
         $storeConfig->{$methodName}($configValue);
     }
     $storeConfig->setBaseUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, false));
     $storeConfig->setSecureBaseUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, true));
     $storeConfig->setBaseLinkUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, false));
     $storeConfig->setSecureBaseLinkUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, true));
     $storeConfig->setBaseStaticUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_STATIC, false));
     $storeConfig->setSecureBaseStaticUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_STATIC, true));
     $storeConfig->setBaseMediaUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, false));
     $storeConfig->setSecureBaseMediaUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, true));
     return $storeConfig;
 }
示例#3
0
 /**
  * @param Store $store
  * @param \NostoAccount $account
  * @return \NostoOauth
  */
 public function build(Store $store, \NostoAccount $account = null)
 {
     $metaData = new \NostoOauth();
     try {
         $metaData->setScopes(\NostoApiToken::getApiTokenNames());
         $redirectUrl = $this->_urlBuilder->getUrl('nosto/oauth', ['_nosid' => true, '_scope_to_url' => true, '_scope' => $store->getCode()]);
         $metaData->setRedirectUrl($redirectUrl);
         $lang = substr($this->_localeResolver->getLocale(), 0, 2);
         $metaData->setLanguage(new \NostoLanguageCode($lang));
         if (!is_null($account)) {
             $metaData->setAccount($account);
         }
     } catch (\NostoException $e) {
         $this->_logger->error($e, ['exception' => $e]);
     }
     return $metaData;
 }
示例#4
0
 /**
  * @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;
 }
示例#5
0
 /**
  * Returns target store post data
  *
  * @param \Magento\Store\Model\Store $store
  * @return string
  */
 public function getTargetStorePostData(\Magento\Store\Model\Store $store)
 {
     return $this->_postDataHelper->getPostData($this->getHomeUrl(), ['___store' => $store->getCode(), '___from_store' => $this->getStoreCode()]);
 }
示例#6
0
 /**
  * Gets the absolute preview URL to the given store's front page.
  * The preview url includes "nostodebug=true" parameter.
  *
  * @param Store $store the store to get the url for.
  *
  * @return string the url.
  */
 public function getPreviewUrlFront(Store $store)
 {
     $url = $this->_urlBuilder->getUrl('', array('_nosid' => true, '_scope_to_url' => true, '_scope' => $store->getCode()));
     return $this->addNostoDebugParamToUrl($url);
 }
示例#7
0
 /**
  * Returns target store post data
  *
  * @param \Magento\Store\Model\Store $store
  * @param array $data
  * @return string
  */
 public function getTargetStorePostData(\Magento\Store\Model\Store $store, $data = [])
 {
     $data[\Magento\Store\Api\StoreResolverInterface::PARAM_NAME] = $store->getCode();
     return $this->_postDataHelper->getPostData($this->getUrl('stores/store/switch'), $data);
 }
示例#8
0
 /**
  * @param Product $product
  * @param Store $store
  * @return string
  */
 protected function buildUrl(Product $product, Store $store)
 {
     return $product->getUrlInStore(['_ignore_category' => true, '_nosid' => true, '_scope_to_url' => true, '_scope' => $store->getCode()]);
 }