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


PHP Data::isModuleEnabled方法代码示例

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


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

示例1: _prepareFinalPriceData

 /**
  * Prepare products default final price in temporary index table
  *
  * @param int|array $entityIds the entity ids limitation
  * @return $this
  */
 protected function _prepareFinalPriceData($entityIds = null)
 {
     $this->_prepareDefaultFinalPriceTable();
     $write = $this->_getWriteAdapter();
     $select = $write->select()->from(array('e' => $this->getTable('catalog_product_entity')), array('entity_id'))->join(array('cg' => $this->getTable('customer_group')), '', array('customer_group_id'))->join(array('cw' => $this->getTable('store_website')), '', array('website_id'))->join(array('cwd' => $this->_getWebsiteDateTable()), 'cw.website_id = cwd.website_id', array())->join(array('csg' => $this->getTable('store_group')), 'csg.website_id = cw.website_id AND cw.default_group_id = csg.group_id', array())->join(array('cs' => $this->getTable('store')), 'csg.default_store_id = cs.store_id AND cs.store_id != 0', array())->join(array('pw' => $this->getTable('catalog_product_website')), 'pw.product_id = e.entity_id AND pw.website_id = cw.website_id', array())->joinLeft(array('tp' => $this->_getTierPriceIndexTable()), 'tp.entity_id = e.entity_id AND tp.website_id = cw.website_id' . ' AND tp.customer_group_id = cg.customer_group_id', array())->joinLeft(array('gp' => $this->_getGroupPriceIndexTable()), 'gp.entity_id = e.entity_id AND gp.website_id = cw.website_id' . ' AND gp.customer_group_id = cg.customer_group_id', array())->where('e.type_id = ?', $this->getTypeId());
     // add enable products limitation
     $statusCond = $write->quoteInto('=?', \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
     $this->_addAttributeToSelect($select, 'status', 'e.entity_id', 'cs.store_id', $statusCond, true);
     if ($this->_coreData->isModuleEnabled('Magento_Tax')) {
         $taxClassId = $this->_addAttributeToSelect($select, 'tax_class_id', 'e.entity_id', 'cs.store_id');
     } else {
         $taxClassId = new \Zend_Db_Expr('0');
     }
     $select->columns(array('tax_class_id' => $taxClassId));
     $price = $this->_addAttributeToSelect($select, 'price', 'e.entity_id', 'cs.store_id');
     $specialPrice = $this->_addAttributeToSelect($select, 'special_price', 'e.entity_id', 'cs.store_id');
     $specialFrom = $this->_addAttributeToSelect($select, 'special_from_date', 'e.entity_id', 'cs.store_id');
     $specialTo = $this->_addAttributeToSelect($select, 'special_to_date', 'e.entity_id', 'cs.store_id');
     $currentDate = $write->getDatePartSql('cwd.website_date');
     $groupPrice = $write->getCheckSql('gp.price IS NULL', "{$price}", 'gp.price');
     $specialFromDate = $write->getDatePartSql($specialFrom);
     $specialToDate = $write->getDatePartSql($specialTo);
     $specialFromUse = $write->getCheckSql("{$specialFromDate} <= {$currentDate}", '1', '0');
     $specialToUse = $write->getCheckSql("{$specialToDate} >= {$currentDate}", '1', '0');
     $specialFromHas = $write->getCheckSql("{$specialFrom} IS NULL", '1', "{$specialFromUse}");
     $specialToHas = $write->getCheckSql("{$specialTo} IS NULL", '1', "{$specialToUse}");
     $finalPrice = $write->getCheckSql("{$specialFromHas} > 0 AND {$specialToHas} > 0" . " AND {$specialPrice} < {$price}", $specialPrice, $price);
     $finalPrice = $write->getCheckSql("{$groupPrice} < {$finalPrice}", $groupPrice, $finalPrice);
     $select->columns(array('orig_price' => $price, 'price' => $finalPrice, 'min_price' => $finalPrice, 'max_price' => $finalPrice, 'tier_price' => new \Zend_Db_Expr('tp.min_price'), 'base_tier' => new \Zend_Db_Expr('tp.min_price'), 'group_price' => new \Zend_Db_Expr('gp.price'), 'base_group_price' => new \Zend_Db_Expr('gp.price')));
     if (!is_null($entityIds)) {
         $select->where('e.entity_id IN(?)', $entityIds);
     }
     /**
      * Add additional external limitation
      */
     $this->_eventManager->dispatch('prepare_catalog_product_index_select', array('select' => $select, 'entity_field' => new \Zend_Db_Expr('e.entity_id'), 'website_field' => new \Zend_Db_Expr('cw.website_id'), 'store_field' => new \Zend_Db_Expr('cs.store_id')));
     $query = $select->insertFromSelect($this->_getDefaultFinalPriceTable(), array(), false);
     $write->query($query);
     /**
      * Add possibility modify prices from external events
      */
     $select = $write->select()->join(array('wd' => $this->_getWebsiteDateTable()), 'i.website_id = wd.website_id', array());
     $this->_eventManager->dispatch('prepare_catalog_product_price_index_table', array('index_table' => array('i' => $this->_getDefaultFinalPriceTable()), 'select' => $select, 'entity_id' => 'i.entity_id', 'customer_group_id' => 'i.customer_group_id', 'website_id' => 'i.website_id', 'website_date' => 'wd.website_date', 'update_fields' => array('price', 'min_price', 'max_price')));
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:51,代码来源:DefaultPrice.php


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