本文整理汇总了PHP中Magento\Catalog\Helper\Data::isModuleEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::isModuleEnabled方法的具体用法?PHP Data::isModuleEnabled怎么用?PHP Data::isModuleEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Helper\Data
的用法示例。
在下文中一共展示了Data::isModuleEnabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* Load Wysiwyg on demand and prepare layout
*
* @return void
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
if ($this->_catalogData->isModuleEnabled('Magento_Cms') && $this->_wysiwygConfig->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
}
示例2: _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->_catalogData->isModuleEnabled('Magento_ProductAlert')) {
$collection = $this->_priceFactory->create()->getCustomerCollection()->join($productId, $websiteId);
$this->setCollection($collection);
}
return parent::_prepareCollection();
}
示例3: _prepareColumns
/**
* @return $this
*/
protected function _prepareColumns()
{
$this->addColumn('entity_id', array('header' => __('ID'), 'type' => 'number', 'index' => 'entity_id', 'header_css_class' => 'col-id', 'column_css_class' => 'col-id'));
$this->addColumn('name', array('header' => __('Name'), 'index' => 'name', 'class' => 'xxx'));
$store = $this->_getStore();
if ($store->getId()) {
$this->addColumn('custom_name', array('header' => __('Name in %1', $store->getName()), 'index' => 'custom_name', 'header_css_class' => 'col-name', 'column_css_class' => 'col-name'));
}
$this->addColumn('type', array('header' => __('Type'), 'index' => 'type_id', 'type' => 'options', 'options' => $this->_type->getOptionArray()));
$sets = $this->_setsFactory->create()->setEntityTypeFilter($this->_productFactory->create()->getResource()->getTypeId())->load()->toOptionHash();
$this->addColumn('set_name', array('header' => __('Attribute Set'), 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets, 'header_css_class' => 'col-attr-name', 'column_css_class' => 'col-attr-name'));
$this->addColumn('sku', array('header' => __('SKU'), 'index' => 'sku'));
$store = $this->_getStore();
$this->addColumn('price', array('header' => __('Price'), 'type' => 'price', 'currency_code' => $store->getBaseCurrency()->getCode(), 'index' => 'price', 'header_css_class' => 'col-price', 'column_css_class' => 'col-price'));
if ($this->_catalogData->isModuleEnabled('Magento_CatalogInventory')) {
$this->addColumn('qty', array('header' => __('Quantity'), 'type' => 'number', 'index' => 'qty'));
}
$this->addColumn('visibility', array('header' => __('Visibility'), 'index' => 'visibility', 'type' => 'options', 'options' => $this->_visibility->getOptionArray(), 'header_css_class' => 'col-visibility', 'column_css_class' => 'col-visibility'));
$this->addColumn('status', array('header' => __('Status'), 'index' => 'status', 'type' => 'options', 'options' => $this->_status->getOptionArray()));
if (!$this->_storeManager->isSingleStoreMode()) {
$this->addColumn('websites', array('header' => __('Websites'), 'sortable' => false, 'index' => 'websites', 'type' => 'options', 'options' => $this->_websiteFactory->create()->getCollection()->toOptionHash(), 'header_css_class' => 'col-websites', 'column_css_class' => 'col-websites'));
}
$this->addColumn('edit', array('header' => __('Edit'), 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => __('Edit'), 'url' => array('base' => '*/*/edit', 'params' => array('store' => $this->getRequest()->getParam('store'))), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'header_css_class' => 'col-action', 'column_css_class' => 'col-action'));
if ($this->_catalogData->isModuleEnabled('Magento_Rss')) {
$this->addRssList('rss/catalog/notifystock', __('Notify Low Stock RSS'));
}
return parent::_prepareColumns();
}
示例4: getStockOption
/**
* Retrieve stock option array
*
* @return array
*/
public function getStockOption()
{
if ($this->catalogData->isModuleEnabled('Magento_CatalogInventory')) {
return $this->stock->toOptionArray();
}
return array();
}
示例5: getCustomerGroups
/**
* Retrieve allowed customer groups
*
* @param int|null $groupId return name by customer group id
* @return array|string
*/
public function getCustomerGroups($groupId = null)
{
if ($this->_customerGroups === null) {
if (!$this->_catalogData->isModuleEnabled('Magento_Customer')) {
return array();
}
$groups = $this->_groupService->getGroups();
$this->_customerGroups = $this->_getInitialCustomerGroups();
foreach ($groups as $group) {
$this->_customerGroups[$group->getId()] = $group->getCode();
}
}
if ($groupId !== null) {
return isset($this->_customerGroups[$groupId]) ? $this->_customerGroups[$groupId] : array();
}
return $this->_customerGroups;
}
示例6: _joinPriceRules
/**
* Join prices from price rules to products collection
*
* @return $this
*/
protected function _joinPriceRules()
{
if ($this->isEnabledFlat()) {
$customerGroup = $this->_customerSession->getCustomerGroupId();
$priceColumn = 'e.display_price_group_' . $customerGroup;
$this->getSelect()->columns(array('_rule_price' => $priceColumn));
return $this;
}
if (!$this->_catalogData->isModuleEnabled('Magento_CatalogRule')) {
return $this;
}
$wId = $this->_storeManager->getWebsite()->getId();
$gId = $this->_customerSession->getCustomerGroupId();
$storeDate = $this->_localeDate->scopeTimeStamp($this->getStoreId());
$conditions = 'price_rule.product_id = e.entity_id AND ';
$conditions .= "price_rule.rule_date = '" . $this->dateTime->formatDate($storeDate, false) . "' AND ";
$conditions .= $this->getConnection()->quoteInto('price_rule.website_id = ? AND', $wId);
$conditions .= $this->getConnection()->quoteInto('price_rule.customer_group_id = ?', $gId);
$this->getSelect()->joinLeft(array('price_rule' => $this->getTable('catalogrule_product_price')), $conditions, array('rule_price' => 'rule_price'));
return $this;
}
示例7: fromArray
/**
* Same as setData(), but also initiates the stock item (if it is there)
*
* @param array $data Array to form the object from
* @return \Magento\Catalog\Model\Product
*/
public function fromArray($data)
{
if (isset($data['stock_item'])) {
if ($this->_catalogData->isModuleEnabled('Magento_CatalogInventory')) {
$stockItem = $this->_stockItemFactory->create()->setData($data['stock_item'])->setProduct($this);
$this->setStockItem($stockItem);
}
unset($data['stock_item']);
}
$this->setData($data);
return $this;
}