当前位置: 首页>>代码示例>>PHP>>正文


PHP Manager::isEnabled方法代码示例

本文整理汇总了PHP中Magento\Framework\Module\Manager::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::isEnabled方法的具体用法?PHP Manager::isEnabled怎么用?PHP Manager::isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Module\Manager的用法示例。


在下文中一共展示了Manager::isEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepareLayout

 /**
  * @return $this|void
  */
 protected function _prepareLayout()
 {
     if (!$this->_moduleManager->isEnabled('Magento_Reports')) {
         return $this;
     }
     $isFilter = $this->getRequest()->getParam('store') || $this->getRequest()->getParam('website') || $this->getRequest()->getParam('group');
     $collection = $this->_collectionFactory->create()->calculateSales($isFilter);
     if ($this->getRequest()->getParam('store')) {
         $collection->addFieldToFilter('store_id', $this->getRequest()->getParam('store'));
     } else {
         if ($this->getRequest()->getParam('website')) {
             $storeIds = $this->_storeManager->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
             $collection->addFieldToFilter('store_id', array('in' => $storeIds));
         } else {
             if ($this->getRequest()->getParam('group')) {
                 $storeIds = $this->_storeManager->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
                 $collection->addFieldToFilter('store_id', array('in' => $storeIds));
             }
         }
     }
     $collection->load();
     $sales = $collection->getFirstItem();
     $this->addTotal(__('Lifetime Sales'), $sales->getLifetime());
     $this->addTotal(__('Average Orders'), $sales->getAverage());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:28,代码来源:Sales.php

示例2: _prepareLayout

 /**
  * @return $this|void
  */
 protected function _prepareLayout()
 {
     if (!$this->_moduleManager->isEnabled('Magento_Reports')) {
         return $this;
     }
     $isFilter = $this->getRequest()->getParam('store') || $this->getRequest()->getParam('website') || $this->getRequest()->getParam('group');
     $period = $this->getRequest()->getParam('period', '24h');
     /* @var $collection \Magento\Reports\Model\Resource\Order\Collection */
     $collection = $this->_collectionFactory->create()->addCreateAtPeriodFilter($period)->calculateTotals($isFilter);
     if ($this->getRequest()->getParam('store')) {
         $collection->addFieldToFilter('store_id', $this->getRequest()->getParam('store'));
     } else {
         if ($this->getRequest()->getParam('website')) {
             $storeIds = $this->_storeManager->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
             $collection->addFieldToFilter('store_id', ['in' => $storeIds]);
         } else {
             if ($this->getRequest()->getParam('group')) {
                 $storeIds = $this->_storeManager->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
                 $collection->addFieldToFilter('store_id', ['in' => $storeIds]);
             } elseif (!$collection->isLive()) {
                 $collection->addFieldToFilter('store_id', ['eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]);
             }
         }
     }
     $collection->load();
     $totals = $collection->getFirstItem();
     $this->addTotal(__('Revenue'), $totals->getRevenue());
     $this->addTotal(__('Tax'), $totals->getTax());
     $this->addTotal(__('Shipping'), $totals->getShipping());
     $this->addTotal(__('Quantity'), $totals->getQuantity() * 1, true);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:34,代码来源:Totals.php

示例3: execute

 /**
  * @param Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function execute(Observer $observer)
 {
     if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && $this->taxHelper->isCatalogPriceDisplayAffectedByTax()) {
         /** @var \Magento\Customer\Model\Data\Customer $customer */
         $customer = $observer->getData('customer');
         $customerGroupId = $customer->getGroupId();
         $customerGroup = $this->groupRepository->getById($customerGroupId);
         $customerTaxClassId = $customerGroup->getTaxClassId();
         $this->customerSession->setCustomerTaxClassId($customerTaxClassId);
         /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */
         $addresses = $customer->getAddresses();
         if (isset($addresses)) {
             $defaultShippingFound = false;
             $defaultBillingFound = false;
             foreach ($addresses as $address) {
                 if ($address->isDefaultBilling()) {
                     $defaultBillingFound = true;
                     $this->customerSession->setDefaultTaxBillingAddress(['country_id' => $address->getCountryId(), 'region_id' => $address->getRegion() ? $address->getRegion()->getRegionId() : null, 'postcode' => $address->getPostcode()]);
                 }
                 if ($address->isDefaultShipping()) {
                     $defaultShippingFound = true;
                     $this->customerSession->setDefaultTaxShippingAddress(['country_id' => $address->getCountryId(), 'region_id' => $address->getRegion() ? $address->getRegion()->getRegionId() : null, 'postcode' => $address->getPostcode()]);
                 }
                 if ($defaultShippingFound && $defaultBillingFound) {
                     break;
                 }
             }
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:35,代码来源:CustomerLoggedInObserver.php

示例4: getStockOption

 /**
  * Retrieve stock option array
  *
  * @return array
  */
 public function getStockOption()
 {
     if ($this->moduleManager->isEnabled('Magento_CatalogInventory')) {
         return $this->stock->toOptionArray();
     }
     return [];
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Inventory.php

示例5: _prepareCollection

 /**
  * @return $this
  */
 protected function _prepareCollection()
 {
     if (!$this->_moduleManager->isEnabled('Magento_Reports')) {
         return $this;
     }
     $collection = $this->_collectionFactory->create()->addItemCountExpr()->joinCustomerName('customer')->orderByCreatedAt();
     if ($this->getParam('store') || $this->getParam('website') || $this->getParam('group')) {
         if ($this->getParam('store')) {
             $collection->addAttributeToFilter('store_id', $this->getParam('store'));
         } else {
             if ($this->getParam('website')) {
                 $storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds();
                 $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
             } else {
                 if ($this->getParam('group')) {
                     $storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds();
                     $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
                 }
             }
         }
         $collection->addRevenueToSelect();
     } else {
         $collection->addRevenueToSelect(true);
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:30,代码来源:Grid.php

示例6: afterGenerateXml

 /**
  * After generate Xml
  *
  * @param \Magento\Framework\View\LayoutInterface $subject
  * @param \Magento\Framework\View\LayoutInterface $result
  * @return \Magento\Framework\View\LayoutInterface
  */
 public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
 {
     if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) {
         $this->checkoutSession->clearStorage();
     }
     return $result;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:DepersonalizePlugin.php

示例7: getMagefanModules

 /**
  * Get Magefan Modules Info
  *
  * @return $this
  */
 protected function getMagefanModules()
 {
     $modules = array();
     foreach ($this->_moduleList->getAll() as $moduleName => $module) {
         if (strpos($moduleName, 'Magefan_') !== false && $this->_moduleManager->isEnabled($moduleName)) {
             $modules[$moduleName] = $module;
         }
     }
     return $modules;
 }
开发者ID:magefan,项目名称:module-login-as-customer,代码行数:15,代码来源:AdminNotificationFeed.php

示例8: canShowBlock

 /**
  * Check if we can show this block.
  * According to @see \Magento\LayeredNavigationStaging\Block\Navigation::canShowBlock
  * We should not show the block if staging is enabled and if we are currently previewing the results.
  *
  * @return bool
  */
 public function canShowBlock()
 {
     if ($this->moduleManager->isEnabled('Magento_Staging')) {
         try {
             $versionManager = $this->objectManager->get('\\Magento\\Staging\\Model\\VersionManager');
             return parent::canShowBlock() && !$versionManager->isPreviewVersion();
         } catch (\Exception $exception) {
             return parent::canShowBlock();
         }
     }
     return parent::canShowBlock();
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:19,代码来源:Navigation.php

示例9: toOptionArray

 /**
  * Return array of customer groups
  *
  * @return array
  */
 public function toOptionArray()
 {
     if (!$this->moduleManager->isEnabled('Magento_Customer')) {
         return [];
     }
     $customerGroups = [['label' => __('ALL GROUPS'), 'value' => GroupInterface::CUST_GROUP_ALL]];
     /** @var GroupInterface[] $groups */
     $groups = $this->groupRepository->getList($this->searchCriteriaBuilder->create());
     foreach ($groups->getItems() as $group) {
         $customerGroups[] = ['label' => $group->getCode(), 'value' => $group->getId()];
     }
     return $customerGroups;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:18,代码来源:Group.php

示例10: _prepareCollection

 /**
  * @return Grid
  */
 protected function _prepareCollection()
 {
     $productId = $this->getRequest()->getParam('id');
     $websiteId = 0;
     if ($store = $this->getRequest()->getParam('store')) {
         $websiteId = $this->_storeManager->getStore($store)->getWebsiteId();
     }
     if ($this->moduleManager->isEnabled('Magento_ProductAlert')) {
         $collection = $this->_priceFactory->create()->getCustomerCollection()->join($productId, $websiteId);
         $this->setCollection($collection);
     }
     return parent::_prepareCollection();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Price.php

示例11: aroundDispatch

 /**
  * @param \Magento\Framework\App\ActionInterface $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return mixed
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\ActionInterface $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->customerSession->isLoggedIn() || !$this->moduleManager->isEnabled('Magento_PageCache') || !$this->cacheConfig->isEnabled() || !$this->taxHelper->isCatalogPriceDisplayAffectedByTax()) {
         return $proceed($request);
     }
     $defaultBillingAddress = $this->customerSession->getDefaultTaxBillingAddress();
     $defaultShippingAddress = $this->customerSession->getDefaultTaxShippingAddress();
     $customerTaxClassId = $this->customerSession->getCustomerTaxClassId();
     if (!empty($defaultBillingAddress) || !empty($defaultShippingAddress)) {
         $taxRates = $this->taxCalculation->getTaxRates($defaultBillingAddress, $defaultShippingAddress, $customerTaxClassId);
         $this->httpContext->setValue('tax_rates', $taxRates, 0);
     }
     return $proceed($request);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:ContextPlugin.php

示例12: execute

 /**
  * @param Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function execute(Observer $observer)
 {
     if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && $this->taxHelper->isCatalogPriceDisplayAffectedByTax()) {
         /** @var $customerAddress Address */
         $address = $observer->getCustomerAddress();
         // Check if the address is either the default billing, shipping, or both
         if ($this->isDefaultBilling($address)) {
             $this->customerSession->setDefaultTaxBillingAddress(['country_id' => $address->getCountryId(), 'region_id' => $address->getRegion() ? $address->getRegionId() : null, 'postcode' => $address->getPostcode()]);
         }
         if ($this->isDefaultShipping($address)) {
             $this->customerSession->setDefaultTaxShippingAddress(['country_id' => $address->getCountryId(), 'region_id' => $address->getRegion() ? $address->getRegionId() : null, 'postcode' => $address->getPostcode()]);
         }
     }
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:19,代码来源:AfterAddressSaveObserver.php

示例13: getAvailableIndexes

 /**
  * List of available search indexes
  *
  * @return DataObject[]
  */
 public function getAvailableIndexes()
 {
     $indexes = [];
     if ($this->moduleManager->isEnabled('Mirasvit_Search')) {
         $indexCollectionFactory = $this->objectManager->create('\\Mirasvit\\Search\\Model\\ResourceModel\\Index\\CollectionFactory');
         $collection = $indexCollectionFactory->create()->addFieldToFilter('is_active', true);
         foreach ($collection as $index) {
             $indexes[] = $index;
         }
     } else {
         $indexes[] = new DataObject(['title' => __('Products')->__toString(), 'code' => 'catalogsearch_fulltext']);
     }
     $indexes[] = new DataObject(['title' => __('Popular suggestions')->__toString(), 'code' => 'magento_search_query']);
     return $indexes;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:20,代码来源:Data.php

示例14: _prepareData

 /**
  * @return $this
  */
 protected function _prepareData()
 {
     $product = $this->_coreRegistry->registry('product');
     /* @var $product \Magento\Catalog\Model\Product */
     $this->_itemCollection = $product->getRelatedProductCollection()->addAttributeToSelect('required_options')->setPositionOrder()->addStoreFilter();
     if ($this->moduleManager->isEnabled('Magento_Checkout')) {
         $this->_addProductAttributesAndPrices($this->_itemCollection);
     }
     $this->_itemCollection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
     $this->_itemCollection->load();
     foreach ($this->_itemCollection as $product) {
         $product->setDoNotUseCategoryId(true);
     }
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:Related.php

示例15: _prepareCollection

 /**
  * Premare block data
  * @return $this
  */
 protected function _prepareCollection()
 {
     $post = $this->_coreRegistry->registry('current_blog_post');
     $this->_itemCollection = $this->_productCollectionFactory->create()->addAttributeToSelect('required_options')->addStoreFilter()->addAttributeToFilter('entity_id', array('in' => $post->getRelatedProductIds() ?: array(0)));
     if ($this->_moduleManager->isEnabled('Magento_Checkout')) {
         $this->_addProductAttributesAndPrices($this->_itemCollection);
     }
     $this->_itemCollection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
     $this->_itemCollection->setPageSize((int) $this->_scopeConfig->getValue('mfblog/post_view/related_products/number_of_products', \Magento\Store\Model\ScopeInterface::SCOPE_STORE));
     $this->_itemCollection->load();
     foreach ($this->_itemCollection as $product) {
         $product->setDoNotUseCategoryId(true);
     }
     return $this;
 }
开发者ID:samitrimal,项目名称:Blog-Extension-for-Magento-2,代码行数:19,代码来源:RelatedProducts.php


注:本文中的Magento\Framework\Module\Manager::isEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。