示例#1
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;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function getBaseCurrencyCode()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getBaseCurrencyCode');
     if (!$pluginInfo) {
         return parent::getBaseCurrencyCode();
     } else {
         return $this->___callPlugins('getBaseCurrencyCode', func_get_args(), $pluginInfo);
     }
 }
示例#3
0
 /**
  * @param Item[] $items
  * @param Store $store
  * @return \NostoCartItemInterface[]
  */
 protected function buildItems(array $items, Store $store)
 {
     $cartItems = array();
     foreach ($items as $item) {
         try {
             $cartItem = $this->_cartItemFactory->create();
             $cartItem->setItemId($this->buildItemId($item));
             $cartItem->setQuantity((int) $item->getQty());
             $cartItem->setName($this->buildItemName($item));
             $cartItem->setUnitPrice(new \NostoPrice($item->getBasePriceInclTax()));
             $cartItem->setCurrency(new \NostoCurrencyCode($store->getBaseCurrencyCode()));
             $cartItems[] = $cartItem;
         } catch (\NostoException $e) {
         }
     }
     return $cartItems;
 }