當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model\StoreManagerInterface類代碼示例

本文整理匯總了PHP中Magento\Store\Model\StoreManagerInterface的典型用法代碼示例。如果您正苦於以下問題:PHP StoreManagerInterface類的具體用法?PHP StoreManagerInterface怎麽用?PHP StoreManagerInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了StoreManagerInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->connection = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMock();
     $this->connection->expects($this->any())->method('quoteInto')->willReturnCallback(function ($query, $expression) {
         return str_replace('?', $expression, $query);
     });
     $this->resource = $this->getMockBuilder('\\Magento\\Framework\\App\\ResourceConnection')->disableOriginalConstructor()->getMock();
     $this->resource->method('getTableName')->willReturnCallback(function ($table) {
         return 'prefix_' . $table;
     });
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->website = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\WebsiteInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->website->expects($this->any())->method('getId')->willReturn(self::WEBSITE_ID);
     $this->store = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\StoreInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->store->expects($this->any())->method('getId')->willReturn(self::STORE_ID);
     $this->storeManager = $this->getMockBuilder('\\Magento\\Store\\Model\\StoreManagerInterface')->disableOriginalConstructor()->getMock();
     $this->storeManager->expects($this->any())->method('getWebsite')->willReturn($this->website);
     $this->storeManager->expects($this->any())->method('getStore')->willReturn($this->store);
     $this->attributeCollection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection')->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory->expects($this->once())->method('create')->willReturn($this->attributeCollection);
     $this->target = $objectManager->getObject('\\Magento\\CatalogSearch\\Model\\Search\\TableMapper', ['resource' => $this->resource, 'storeManager' => $this->storeManager, 'attributeCollectionFactory' => $attributeCollectionFactory]);
     $this->select = $this->getMockBuilder('\\Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\Search\\RequestInterface')->disableOriginalConstructor()->getMock();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:26,代碼來源:TableMapperTest.php

示例2: setUp

 /**
  * Initialize repository
  */
 public function setUp()
 {
     $this->blockResource = $this->getMockBuilder('Magento\\Cms\\Model\\ResourceModel\\Block')->disableOriginalConstructor()->getMock();
     $this->dataObjectProcessor = $this->getMockBuilder('Magento\\Framework\\Reflection\\DataObjectProcessor')->disableOriginalConstructor()->getMock();
     $blockFactory = $this->getMockBuilder('Magento\\Cms\\Model\\BlockFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $blockDataFactory = $this->getMockBuilder('Magento\\Cms\\Api\\Data\\BlockInterfaceFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $blockSearchResultFactory = $this->getMockBuilder('Magento\\Cms\\Api\\Data\\BlockSearchResultsInterfaceFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $collectionFactory = $this->getMockBuilder('Magento\\Cms\\Model\\ResourceModel\\Block\\CollectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->storeManager = $this->getMockBuilder('Magento\\Store\\Model\\StoreManagerInterface')->disableOriginalConstructor()->getMock();
     $store = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\StoreInterface')->disableOriginalConstructor()->getMock();
     $store->expects($this->any())->method('getId')->willReturn(0);
     $this->storeManager->expects($this->any())->method('getStore')->willReturn($store);
     $this->block = $this->getMockBuilder('Magento\\Cms\\Model\\Block')->disableOriginalConstructor()->getMock();
     $this->blockData = $this->getMockBuilder('Magento\\Cms\\Api\\Data\\BlockInterface')->getMock();
     $this->blockSearchResult = $this->getMockBuilder('Magento\\Cms\\Api\\Data\\BlockSearchResultsInterface')->getMock();
     $this->collection = $this->getMockBuilder('Magento\\Cms\\Model\\ResourceModel\\Block\\Collection')->disableOriginalConstructor()->setMethods(['addFieldToFilter', 'getSize', 'setCurPage', 'setPageSize', 'load', 'addOrder'])->getMock();
     $blockFactory->expects($this->any())->method('create')->willReturn($this->block);
     $blockDataFactory->expects($this->any())->method('create')->willReturn($this->blockData);
     $blockSearchResultFactory->expects($this->any())->method('create')->willReturn($this->blockSearchResult);
     $collectionFactory->expects($this->any())->method('create')->willReturn($this->collection);
     /**
      * @var \Magento\Cms\Model\BlockFactory $blockFactory
      * @var \Magento\Cms\Api\Data\BlockInterfaceFactory $blockDataFactory
      * @var \Magento\Cms\Api\Data\BlockSearchResultsInterfaceFactory $blockSearchResultFactory
      * @var \Magento\Cms\Model\ResourceModel\Block\CollectionFactory $collectionFactory
      */
     $this->dataHelper = $this->getMockBuilder('Magento\\Framework\\Api\\DataObjectHelper')->disableOriginalConstructor()->getMock();
     $this->repository = new BlockRepository($this->blockResource, $blockFactory, $blockDataFactory, $collectionFactory, $blockSearchResultFactory, $this->dataHelper, $this->dataObjectProcessor, $this->storeManager);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:32,代碼來源:BlockRepositoryTest.php

示例3: setUp

 protected function setUp()
 {
     $this->entityFactoryMock = $this->getMock('Magento\\Framework\\Data\\Collection\\EntityFactory', [], [], '', false);
     $this->loggerMock = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->fetchStrategyMock = $this->getMock('Magento\\Framework\\Data\\Collection\\Db\\FetchStrategyInterface');
     $this->managerInterfaceMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface');
     $this->configMock = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->entityFactoryMock2 = $this->getMock('Magento\\Eav\\Model\\EntityFactory', [], [], '', false);
     $this->helperMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Helper', [], [], '', false);
     $entity = $this->getMock('Magento\\Eav\\Model\\Entity\\AbstractEntity', [], [], '', false);
     $adapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [], '', false);
     $entity->expects($this->any())->method('getReadConnection')->will($this->returnValue($adapter));
     $entity->expects($this->any())->method('getDefaultAttributes')->will($this->returnValue([]));
     $this->universalFactoryMock = $this->getMock('Magento\\Framework\\Validator\\UniversalFactory', [], [], '', false);
     $this->universalFactoryMock->expects($this->any())->method('create')->will($this->returnValue($entity));
     $this->storeManagerMock = $this->getMockForAbstractClass('Magento\\Store\\Model\\StoreManagerInterface');
     $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnCallback(function ($store) {
         return is_object($store) ? $store : new \Magento\Framework\Object(['id' => 42]);
     }));
     $this->catalogHelperMock = $this->getMock('Magento\\Catalog\\Helper\\Data', [], [], '', false);
     $this->stateMock = $this->getMock('Magento\\Catalog\\Model\\Indexer\\Product\\Flat\\State', [], [], '', false);
     $this->scopeConfigInterfaceMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->optionFactoryMock = $this->getMock('Magento\\Catalog\\Model\\Product\\OptionFactory', [], [], '', false);
     $this->urlMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Url', [], [], '', false);
     $this->timezoneInterfaceMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $this->sessionMock = $this->getMock('Magento\\Customer\\Model\\Session', [], [], '', false);
     $this->dateTimeMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->collection = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Resource\\Product\\Link\\Product\\Collection', ['entityFactory' => $this->entityFactoryMock, 'logger' => $this->loggerMock, 'fetchStrategy' => $this->fetchStrategyMock, 'eventManager' => $this->managerInterfaceMock, 'eavConfig' => $this->configMock, 'resource' => $this->resourceMock, 'eavEntityFactory' => $this->entityFactoryMock2, 'resourceHelper' => $this->helperMock, 'universalFactory' => $this->universalFactoryMock, 'storeManager' => $this->storeManagerMock, 'catalogData' => $this->catalogHelperMock, 'catalogProductFlatState' => $this->stateMock, 'scopeConfig' => $this->scopeConfigInterfaceMock, 'productOptionFactory' => $this->optionFactoryMock, 'catalogUrl' => $this->urlMock, 'localeDate' => $this->timezoneInterfaceMock, 'customerSession' => $this->sessionMock, 'dateTime' => $this->dateTimeMock]);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:31,代碼來源:CollectionTest.php

示例4: execute

 /**
  * Display search result
  *
  * @return void
  */
 public function execute()
 {
     $this->layerResolver->create(Resolver::CATALOG_LAYER_SEARCH);
     /* @var $query \Magento\Search\Model\Query */
     $query = $this->_queryFactory->get();
     $query->setStoreId($this->_storeManager->getStore()->getId());
     if ($query->getQueryText() != '') {
         if ($this->_objectManager->get('Magento\\CatalogSearch\\Helper\\Data')->isMinQueryLength()) {
             $query->setId(0)->setIsActive(1)->setIsProcessed(1);
         } else {
             if ($query->getId()) {
                 $query->setPopularity($query->getPopularity() + 1);
             } else {
                 $query->setPopularity(1);
             }
             if ($query->getRedirect()) {
                 $query->save();
                 $this->getResponse()->setRedirect($query->getRedirect());
                 return;
             } else {
                 $query->prepare();
             }
         }
         $this->_objectManager->get('Magento\\CatalogSearch\\Helper\\Data')->checkNotes();
         $this->_view->loadLayout();
         $this->_view->renderLayout();
         if (!$this->_objectManager->get('Magento\\CatalogSearch\\Helper\\Data')->isMinQueryLength()) {
             $query->save();
         }
     } else {
         $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl());
     }
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:38,代碼來源:Index.php

示例5: getStore

 /**
  * Retrieve store
  *
  * @return \Magento\Store\Model\Store
  */
 public function getStore()
 {
     if ($this->_store === null) {
         $this->_store = $this->_storeManager->getStore();
     }
     return $this->_store;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:12,代碼來源:Config.php

示例6: getCatalogPrice

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function getCatalogPrice(\Magento\Catalog\Model\Product $product, \Magento\Store\Api\Data\StoreInterface $store = null, $inclTax = false)
 {
     // Workaround to avoid loading stock status by admin's website
     if ($store instanceof \Magento\Store\Api\Data\StoreInterface) {
         $currentStore = $this->storeManager->getStore();
         $this->storeManager->setCurrentStore($store->getId());
     }
     $subProducts = $product->getTypeInstance()->getAssociatedProducts($product);
     if ($store instanceof \Magento\Store\Api\Data\StoreInterface) {
         $this->storeManager->setCurrentStore($currentStore->getId());
     }
     if (!$subProducts) {
         return null;
     }
     $minPrice = null;
     foreach ($subProducts as $subProduct) {
         $subProduct->setWebsiteId($product->getWebsiteId())->setCustomerGroupId($product->getCustomerGroupId());
         if ($subProduct->isSalable()) {
             if ($this->commonPriceModel->getCatalogPrice($subProduct) < $minPrice || $minPrice === null) {
                 $minPrice = $this->commonPriceModel->getCatalogPrice($subProduct);
                 $product->setTaxClassId($subProduct->getTaxClassId());
             }
         }
     }
     return $minPrice;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:30,代碼來源:CatalogPrice.php

示例7: getStores

 /**
  * Retrieve stores configured in system.
  *
  * @return \Magento\Framework\Data\Collection\AbstractDb
  */
 public function getStores()
 {
     if (!$this->_stores) {
         $this->_stores = $this->_storeManager->getStore()->getResourceCollection()->load();
     }
     return $this->_stores;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:Data.php

示例8: getStoreId

 /**
  * Return current store id
  *
  * @return int
  */
 public function getStoreId()
 {
     if ($this->_storeId === null) {
         $this->setStoreId($this->_storeManager->getStore()->getId());
     }
     return $this->_storeId;
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:12,代碼來源:AbstractCollection.php

示例9: aroundDispatch

 /**
  * @param \Magento\Framework\App\ActionInterface $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  * @throws \Magento\Framework\Exception\State\InitException
  */
 public function aroundDispatch(\Magento\Framework\App\ActionInterface $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_storeManager->getStore()->isActive()) {
         throw new \Magento\Framework\Exception\State\InitException(__('Current store is not active.'));
     }
     return $proceed($request);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:16,代碼來源:StoreCheck.php

示例10: execute

 /**
  * Execute method.
  *
  * @param \Magento\Framework\Event\Observer $observer
  *
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $order = $observer->getEvent()->getOrder();
     $email = $order->getCustomerEmail();
     $website = $this->storeManager->getWebsite($order->getWebsiteId());
     $storeName = $this->storeManager->getStore($order->getStoreId())->getName();
     //if api is not enabled
     if (!$this->helper->isEnabled($website)) {
         return $this;
     }
     //automation enrolment for order
     if ($order->getCustomerIsGuest()) {
         // guest to automation mapped
         $programType = 'XML_PATH_CONNECTOR_AUTOMATION_STUDIO_GUEST_ORDER';
         $automationType = \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_TYPE_NEW_GUEST_ORDER;
     } else {
         // customer to automation mapped
         $programType = 'XML_PATH_CONNECTOR_AUTOMATION_STUDIO_ORDER';
         $automationType = \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_TYPE_NEW_ORDER;
     }
     $programId = $this->helper->getAutomationIdByType($programType, $order->getWebsiteId());
     //the program is not mapped
     if (!$programId) {
         return $this;
     }
     try {
         $this->automationFactory->create()->setEmail($email)->setAutomationType($automationType)->setEnrolmentStatus(\Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING)->setTypeId($order->getId())->setWebsiteId($website->getId())->setStoreName($storeName)->setProgramId($programId)->save();
     } catch (\Exception $e) {
         $this->helper->debug((string) $e, []);
     }
     return $this;
 }
開發者ID:dotmailer,項目名稱:dotmailer-magento2-extension,代碼行數:39,代碼來源:PlaceCreateAutomationStatus.php

示例11: testDispatch

 /**
  * @param bool $isWebsiteScope
  * @param array $websites
  * @param int $quoteId
  * @dataProvider dispatchDataProvider
  */
 public function testDispatch($isWebsiteScope, $websites, $quoteId)
 {
     $this->configMock->expects($this->once())->method('isWebsiteScope')->will($this->returnValue($isWebsiteScope));
     $customerDataObjectMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock();
     $customerDataObjectMock->expects($this->any())->method('getGroupId')->will($this->returnValue(1));
     $customerDataObjectMock->expects($this->any())->method('getWebsiteId')->will($this->returnValue(2));
     if ($isWebsiteScope) {
         $websites = $websites[0];
         $this->storeManagerMock->expects($this->once())->method('getWebsite')->with(2)->will($this->returnValue($websites));
     } else {
         $this->storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($websites));
     }
     $origCustomerDataObjectMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock();
     $origCustomerDataObjectMock->expects($this->any())->method('getGroupId')->will($this->returnValue(2));
     $this->eventMock->expects($this->any())->method('getCustomerDataObject')->will($this->returnValue($customerDataObjectMock));
     $this->eventMock->expects($this->any())->method('getOrigCustomerDataObject')->will($this->returnValue($origCustomerDataObjectMock));
     /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Quote\Model\Quote $quoteMock */
     $quoteMock = $this->getMockBuilder('Magento\\Quote\\Model\\Quote')->setMethods(['setWebsite', 'setCustomerGroupId', 'collectTotals', '__wakeup'])->disableOriginalConstructor()->getMock();
     $websiteCount = count($websites);
     if ($quoteId) {
         $this->quoteRepositoryMock->expects($this->exactly($websiteCount))->method('getForCustomer')->will($this->returnValue($quoteMock));
         $quoteMock->expects($this->exactly($websiteCount))->method('setWebsite');
         $quoteMock->expects($this->exactly($websiteCount))->method('setCustomerGroupId');
         $quoteMock->expects($this->exactly($websiteCount))->method('collectTotals');
         $this->quoteRepositoryMock->expects($this->exactly($websiteCount))->method('save')->with($quoteMock);
     } else {
         $this->quoteRepositoryMock->expects($this->exactly($websiteCount))->method('getForCustomer')->willThrowException(new \Magento\Framework\Exception\NoSuchEntityException());
         $quoteMock->expects($this->never())->method('setCustomerGroupId');
         $quoteMock->expects($this->never())->method('collectTotals');
         $this->quoteRepositoryMock->expects($this->never())->method('save');
     }
     $this->customerQuote->dispatch($this->observerMock);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:39,代碼來源:CustomerQuoteTest.php

示例12: execute

 /**
  * @return void
  */
 public function execute()
 {
     $currentActiveStore = $this->storeManager->getStore();
     $storeCode = $this->_request->getParam(StoreResolver::PARAM_NAME, $this->storeCookieManager->getStoreCodeFromCookie());
     try {
         $store = $this->storeRepository->getActiveStoreByCode($storeCode);
     } catch (StoreIsInactiveException $e) {
         $error = __('Requested store is inactive');
     } catch (NoSuchEntityException $e) {
         $error = __('Requested store is not found');
     }
     if (isset($error)) {
         $this->messageManager->addError($error);
         $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl());
         return;
     }
     $defaultStoreView = $this->storeManager->getDefaultStoreView();
     if ($defaultStoreView->getId() == $store->getId()) {
         $this->storeCookieManager->deleteStoreCookie($store);
     } else {
         $this->httpContext->setValue(Store::ENTITY, $store->getCode(), $defaultStoreView->getCode());
         $this->storeCookieManager->setStoreCookie($store);
     }
     if ($store->isUseStoreInUrl()) {
         // Change store code in redirect url
         if (strpos($this->_redirect->getRedirectUrl(), $currentActiveStore->getBaseUrl()) !== false) {
             $this->getResponse()->setRedirect(str_replace($currentActiveStore->getBaseUrl(), $store->getBaseUrl(), $this->_redirect->getRedirectUrl()));
         } else {
             $this->getResponse()->setRedirect($store->getBaseUrl());
         }
     } else {
         $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl());
     }
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:37,代碼來源:SwitchAction.php

示例13: set

 /**
  * {@inheritdoc}
  */
 public function set(\Magento\Checkout\Service\V1\Data\Cart\PaymentMethod $method, $cartId)
 {
     $quote = $this->quoteLoader->load($cartId, $this->storeManager->getStore()->getId());
     $payment = $this->paymentMethodBuilder->build($method, $quote);
     if ($quote->isVirtual()) {
         // check if billing address is set
         if (is_null($quote->getBillingAddress()->getCountryId())) {
             throw new InvalidTransitionException('Billing address is not set');
         }
         $quote->getBillingAddress()->setPaymentMethod($payment->getMethod());
     } else {
         // check if shipping address is set
         if (is_null($quote->getShippingAddress()->getCountryId())) {
             throw new InvalidTransitionException('Shipping address is not set');
         }
         $quote->getShippingAddress()->setPaymentMethod($payment->getMethod());
     }
     if (!$quote->isVirtual() && $quote->getShippingAddress()) {
         $quote->getShippingAddress()->setCollectShippingRates(true);
     }
     if (!$this->zeroTotalValidator->isApplicable($payment->getMethodInstance(), $quote)) {
         throw new InvalidTransitionException('The requested Payment Method is not available.');
     }
     $quote->setTotalsCollectedFlag(false)->collectTotals()->save();
     return $quote->getPayment()->getId();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:29,代碼來源:WriteService.php

示例14: getData

 /**
  * Retrieve configuration metadata
  *
  * @return array
  */
 public function getData()
 {
     $scope = $this->request->getParam('scope');
     $scopeId = $this->request->getParam('scope_id');
     $data = [];
     if ($scope) {
         $showFallbackReset = false;
         list($fallbackScope, $fallbackScopeId) = $this->scopeFallbackResolver->getFallbackScope($scope, $scopeId);
         if ($fallbackScope && !$this->storeManager->isSingleStoreMode()) {
             $scope = $fallbackScope;
             $scopeId = $fallbackScopeId;
             $showFallbackReset = true;
         }
         $designConfig = $this->designConfigRepository->getByScope($scope, $scopeId);
         $fieldsData = $designConfig->getExtensionAttributes()->getDesignConfigData();
         foreach ($fieldsData as $fieldData) {
             $element =& $data;
             foreach (explode('/', $fieldData->getFieldConfig()['fieldset']) as $fieldset) {
                 if (!isset($element[$fieldset]['children'])) {
                     $element[$fieldset]['children'] = [];
                 }
                 $element =& $element[$fieldset]['children'];
             }
             $fieldName = $fieldData->getFieldConfig()['field'];
             $element[$fieldName]['arguments']['data']['config']['default'] = $fieldData->getValue();
             $element[$fieldName]['arguments']['data']['config']['showFallbackReset'] = $showFallbackReset;
         }
     }
     return $data;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:35,代碼來源:MetadataLoader.php

示例15: isFreeShipping

 /**
  * {@inheritDoc}
  */
 public function isFreeShipping(\Magento\Quote\Model\Quote $quote, $items)
 {
     /** @var \Magento\Quote\Api\Data\CartItemInterface[] $items */
     if (!count($items)) {
         return false;
     }
     $addressFreeShipping = true;
     $store = $this->storeManager->getStore($quote->getStoreId());
     $this->calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
     /** @var \Magento\Quote\Api\Data\CartItemInterface $item */
     foreach ($items as $item) {
         if ($item->getNoDiscount()) {
             $addressFreeShipping = false;
             $item->setFreeShipping(false);
             continue;
         }
         /** Child item discount we calculate for parent */
         if ($item->getParentItemId()) {
             continue;
         }
         $this->calculator->processFreeShipping($item);
         $itemFreeShipping = (bool) $item->getFreeShipping();
         $addressFreeShipping = $addressFreeShipping && $itemFreeShipping;
         /** Parent free shipping we apply to all children*/
         $this->applyToChildren($item, $itemFreeShipping);
     }
     return $addressFreeShipping;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:31,代碼來源:FreeShipping.php


注:本文中的Magento\Store\Model\StoreManagerInterface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。