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


PHP Mage_Core_Model_App::isSingleStoreMode方法代码示例

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


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

示例1: addStoresToCollection

 /**
  * Add stores to collection
  *
  * @return Mage_Rating_Model_Resource_Rating_Collection
  */
 public function addStoresToCollection()
 {
     if ($this->_app->isSingleStoreMode()) {
         return $this;
     }
     if (!$this->_isCollectionLoaded) {
         return $this;
     }
     $ratingIds = array();
     foreach ($this as $item) {
         $ratingIds[] = $item->getId();
         $item->setStores(array());
     }
     if (!$ratingIds) {
         return $this;
     }
     $adapter = $this->getConnection();
     $inCond = $adapter->prepareSqlCondition('rating_id', array('in' => $ratingIds));
     $this->_select = $adapter->select()->from($this->getTable('rating_store'))->where($inCond);
     $data = $adapter->fetchAll($this->_select);
     if (is_array($data) && count($data) > 0) {
         foreach ($data as $row) {
             $item = $this->getItemById($row['rating_id']);
             $item->setStores(array_merge($item->getStores(), array($row['store_id'])));
         }
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:33,代码来源:Collection.php

示例2: _toHtml

 /**
  * @return string
  */
 protected function _toHtml()
 {
     if (!$this->_application->isSingleStoreMode()) {
         return parent::_toHtml();
     }
     return '';
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:10,代码来源:Switcher.php

示例3: _prepareColumns

 protected function _prepareColumns()
 {
     $this->addColumn('subscriber_id', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('ID'), 'index' => 'subscriber_id'));
     $this->addColumn('email', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Email'), 'index' => 'subscriber_email'));
     $this->addColumn('type', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Type'), 'index' => 'type', 'type' => 'options', 'options' => array(1 => Mage::helper('Mage_Newsletter_Helper_Data')->__('Guest'), 2 => Mage::helper('Mage_Newsletter_Helper_Data')->__('Customer'))));
     $this->addColumn('firstname', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Customer First Name'), 'index' => 'customer_firstname', 'default' => '----'));
     $this->addColumn('lastname', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Customer Last Name'), 'index' => 'customer_lastname', 'default' => '----'));
     $this->addColumn('status', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Status'), 'index' => 'subscriber_status', 'type' => 'options', 'options' => array(Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE => Mage::helper('Mage_Newsletter_Helper_Data')->__('Not Activated'), Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED => Mage::helper('Mage_Newsletter_Helper_Data')->__('Subscribed'), Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED => Mage::helper('Mage_Newsletter_Helper_Data')->__('Unsubscribed'), Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED => Mage::helper('Mage_Newsletter_Helper_Data')->__('Unconfirmed'))));
     if (!$this->_app->isSingleStoreMode()) {
         $this->addColumn('website', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Website'), 'index' => 'website_id', 'type' => 'options', 'options' => $this->_getWebsiteOptions()));
         $this->addColumn('group', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Store'), 'index' => 'group_id', 'type' => 'options', 'options' => $this->_getStoreGroupOptions()));
         $this->addColumn('store', array('header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Store View'), 'index' => 'store_id', 'type' => 'options', 'options' => $this->_getStoreOptions()));
     }
     $this->addExportType('*/*/exportCsv', Mage::helper('Mage_Customer_Helper_Data')->__('CSV'));
     $this->addExportType('*/*/exportXml', Mage::helper('Mage_Customer_Helper_Data')->__('Excel XML'));
     return parent::_prepareColumns();
 }
开发者ID:nemphys,项目名称:magento2,代码行数:17,代码来源:Grid.php

示例4: _renderScopeLabel

 /**
  * Render scope label
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _renderScopeLabel(Varien_Data_Form_Element_Abstract $element)
 {
     $html = '<td class="scope-label">';
     if ($element->getScope() && false == $this->_application->isSingleStoreMode()) {
         $html .= $element->getScopeLabel();
     }
     $html .= '</td>';
     return $html;
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:15,代码来源:Field.php

示例5: _prepareForm

 /**
  * Prepare rating edit form
  *
  * @return Mage_Adminhtml_Block_Rating_Edit_Tab_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('rating_form', array('legend' => Mage::helper('Mage_Rating_Helper_Data')->__('Rating Title')));
     $fieldset->addField('rating_code', 'text', array('name' => 'rating_code', 'label' => Mage::helper('Mage_Rating_Helper_Data')->__('Default Value'), 'class' => 'required-entry', 'required' => true));
     foreach (Mage::getSingleton('Mage_Core_Model_System_Store')->getStoreCollection() as $store) {
         $fieldset->addField('rating_code_' . $store->getId(), 'text', array('label' => $store->getName(), 'name' => 'rating_codes[' . $store->getId() . ']'));
     }
     if (Mage::getSingleton('Mage_Adminhtml_Model_Session')->getRatingData()) {
         $form->setValues(Mage::getSingleton('Mage_Adminhtml_Model_Session')->getRatingData());
         $data = Mage::getSingleton('Mage_Adminhtml_Model_Session')->getRatingData();
         if (isset($data['rating_codes'])) {
             $this->_setRatingCodes($data['rating_codes']);
         }
         Mage::getSingleton('Mage_Adminhtml_Model_Session')->setRatingData(null);
     } elseif (Mage::registry('rating_data')) {
         $form->setValues(Mage::registry('rating_data')->getData());
         if (Mage::registry('rating_data')->getRatingCodes()) {
             $this->_setRatingCodes(Mage::registry('rating_data')->getRatingCodes());
         }
     }
     if (Mage::registry('rating_data')) {
         $collection = Mage::getModel('Mage_Rating_Model_Rating_Option')->getResourceCollection()->addRatingFilter(Mage::registry('rating_data')->getId())->load();
         $i = 1;
         foreach ($collection->getItems() as $item) {
             $fieldset->addField('option_code_' . $item->getId(), 'hidden', array('required' => true, 'name' => 'option_title[' . $item->getId() . ']', 'value' => $item->getCode() ? $item->getCode() : $i));
             $i++;
         }
     } else {
         for ($i = 1; $i <= 5; $i++) {
             $fieldset->addField('option_code_' . $i, 'hidden', array('required' => true, 'name' => 'option_title[add_' . $i . ']', 'value' => $i));
         }
     }
     $fieldset = $form->addFieldset('visibility_form', array('legend' => Mage::helper('Mage_Rating_Helper_Data')->__('Rating Visibility')));
     if (!$this->_app->isSingleStoreMode()) {
         $field = $fieldset->addField('stores', 'multiselect', array('label' => Mage::helper('Mage_Rating_Helper_Data')->__('Visible In'), 'name' => 'stores[]', 'values' => Mage::getSingleton('Mage_Core_Model_System_Store')->getStoreValuesForForm()));
         $renderer = $this->getLayout()->createBlock('Mage_Backend_Block_Store_Switcher_Form_Renderer_Fieldset_Element');
         $field->setRenderer($renderer);
         if (Mage::registry('rating_data')) {
             $form->getElement('stores')->setValue(Mage::registry('rating_data')->getStores());
         }
     }
     $fieldset->addField('is_active', 'checkbox', array('label' => Mage::helper('Mage_Rating_Helper_Data')->__('Is Active'), 'name' => 'is_active', 'value' => 1));
     $fieldset->addField('position', 'text', array('label' => Mage::helper('Mage_Rating_Helper_Data')->__('Sort Order'), 'name' => 'position'));
     if (Mage::registry('rating_data')) {
         $form->getElement('position')->setValue(Mage::registry('rating_data')->getPosition());
         $form->getElement('is_active')->setIsChecked(Mage::registry('rating_data')->getIsActive());
     }
     return parent::_prepareForm();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:56,代码来源:Form.php

示例6: _canShowNode

 /**
  * Checks whether it is possible to show the node
  *
  * @param Varien_Simplexml_Element $node
  * @param string $websiteCode
  * @param string $storeCode
  * @return boolean
  */
 protected function _canShowNode($node, $websiteCode = null, $storeCode = null)
 {
     $showTab = false;
     if ($storeCode) {
         $showTab = (int) $node->show_in_store;
     } elseif ($websiteCode) {
         $showTab = (int) $node->show_in_website;
     } elseif (!empty($node->show_in_default)) {
         $showTab = true;
     }
     $showTab = $showTab || $this->_app->isSingleStoreMode();
     $showTab = $showTab && !($this->_app->isSingleStoreMode() && (int) $node->hide_in_single_store_mode);
     return $showTab;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:22,代码来源:Config.php

示例7: _checkSingleStoreMode

 /**
  * Set correct scope if isSingleStoreMode = true
  *
  * @param Mage_Backend_Model_Config_Structure_Element_Field $fieldConfig
  * @param Mage_Core_Model_Config_Data $dataObject
  */
 protected function _checkSingleStoreMode(Mage_Backend_Model_Config_Structure_Element_Field $fieldConfig, $dataObject)
 {
     $isSingleStoreMode = $this->_application->isSingleStoreMode();
     if (!$isSingleStoreMode) {
         return;
     }
     if (!$fieldConfig->showInDefault()) {
         $websites = $this->_application->getWebsites();
         $singleStoreWebsite = array_shift($websites);
         $dataObject->setScope('websites');
         $dataObject->setWebsiteCode($singleStoreWebsite->getCode());
         $dataObject->setScopeId($singleStoreWebsite->getId());
     }
 }
开发者ID:,项目名称:,代码行数:20,代码来源:

示例8: _checkSingleStoreMode

 /**
  * Set correct scope if isSingleStoreMode = true
  *
  * @param array $fieldConfig
  * @param Mage_Core_Model_Config_Data $dataObject
  */
 protected function _checkSingleStoreMode($fieldConfig, $dataObject)
 {
     $isSingleStoreMode = $this->_application->isSingleStoreMode();
     if (!$isSingleStoreMode) {
         return;
     }
     if (!isset($fieldConfig['showInDefault']) || !(int) $fieldConfig['showInDefault']) {
         $websites = $this->_application->getWebsites();
         $singleStoreWebsite = array_shift($websites);
         $dataObject->setScope('websites');
         $dataObject->setWebsiteCode($singleStoreWebsite->getCode());
         $dataObject->setScopeId($singleStoreWebsite->getId());
     }
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:20,代码来源:Config.php

示例9: _canShowNode

 /**
  * Checks whether it is possible to show the node
  *
  * @param mixed $node
  * @param string $websiteCode
  * @param string $storeCode
  * @return boolean
  */
 protected function _canShowNode($node, $websiteCode = null, $storeCode = null)
 {
     $showTab = false;
     if ($storeCode) {
         $showTab = isset($node['showInStore']) ? (int) $node['showInStore'] : false;
     } elseif ($websiteCode) {
         $showTab = isset($node['showInWebsite']) ? (int) $node['showInWebsite'] : false;
     } elseif (isset($node['showInDefault']) && $node['showInDefault']) {
         $showTab = true;
     }
     $showTab = $showTab || $this->_app->isSingleStoreMode();
     $showTab = $showTab && !($this->_app->isSingleStoreMode() && isset($node['hide_in_single_store_mode']) && $node['hide_in_single_store_mode']);
     return $showTab;
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:22,代码来源:Structure.php

示例10: _getEntitySummaryData

 /**
  * Return data of rating summary
  *
  * @param Mage_Rating_Model_Rating $object
  * @return array
  */
 protected function _getEntitySummaryData($object)
 {
     $adapter = $this->_getReadAdapter();
     $sumColumn = new Zend_Db_Expr("SUM(rating_vote.{$adapter->quoteIdentifier('percent')})");
     $countColumn = new Zend_Db_Expr("COUNT(*)");
     $select = $adapter->select()->from(array('rating_vote' => $this->getTable('rating_option_vote')), array('entity_pk_value' => 'rating_vote.entity_pk_value', 'sum' => $sumColumn, 'count' => $countColumn))->join(array('review' => $this->getTable('review')), 'rating_vote.review_id=review.review_id', array())->joinLeft(array('review_store' => $this->getTable('review_store')), 'rating_vote.review_id=review_store.review_id', array('review_store.store_id'));
     if (!$this->_app->isSingleStoreMode()) {
         $select->join(array('rating_store' => $this->getTable('rating_store')), 'rating_store.rating_id = rating_vote.rating_id AND rating_store.store_id = review_store.store_id', array());
     }
     $select->join(array('review_status' => $this->getTable('review_status')), 'review.status_id = review_status.status_id', array())->where('review_status.status_code = :status_code')->group('rating_vote.entity_pk_value')->group('review_store.store_id');
     $bind = array(':status_code' => self::RATING_STATUS_APPROVED);
     $entityPkValue = $object->getEntityPkValue();
     if ($entityPkValue) {
         $select->where('rating_vote.entity_pk_value = :pk_value');
         $bind[':pk_value'] = $entityPkValue;
     }
     return $adapter->fetchAll($select, $bind);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:24,代码来源:Rating.php

示例11: addRatingInfo

 /**
  * Add rating info to select
  *
  * @param int $storeId
  * @return Mage_Rating_Model_Resource_Rating_Option_Vote_Collection
  */
 public function addRatingInfo($storeId = null)
 {
     $adapter = $this->getConnection();
     $ratingCodeCond = $adapter->getIfNullSql('title.value', 'rating.rating_code');
     $this->getSelect()->join(array('rating' => $this->getTable('rating')), 'rating.rating_id = main_table.rating_id', array('rating_code'))->joinLeft(array('title' => $this->getTable('rating_title')), $adapter->quoteInto('main_table.rating_id=title.rating_id AND title.store_id = ?', (int) Mage::app()->getStore()->getId()), array('rating_code' => $ratingCodeCond));
     if (!$this->_app->isSingleStoreMode()) {
         if ($storeId == null) {
             $storeId = Mage::app()->getStore()->getId();
         }
         if (is_array($storeId)) {
             $condition = $adapter->prepareSqlCondition('store.store_id', array('in' => $storeId));
         } else {
             $condition = $adapter->quoteInto('store.store_id = ?', $storeId);
         }
         $this->getSelect()->join(array('store' => $this->getTable('rating_store')), 'main_table.rating_id = store.rating_id AND ' . $condition);
     }
     $adapter->fetchAll($this->getSelect());
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:25,代码来源:Collection.php

示例12: _prepareForm

 protected function _prepareForm()
 {
     $rule = Mage::registry('current_promo_quote_rule');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('rule_');
     $fieldset = $form->addFieldset('default_label_fieldset', array('legend' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Default Label')));
     $labels = $rule->getStoreLabels();
     $fieldset->addField('store_default_label', 'text', array('name' => 'store_labels[0]', 'required' => false, 'label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Default Rule Label for All Store Views'), 'value' => isset($labels[0]) ? $labels[0] : ''));
     if (!$this->_app->isSingleStoreMode()) {
         $fieldset = $this->_createStoreSpecificFieldset($form, $labels);
     }
     if ($rule->isReadonly()) {
         foreach ($fieldset->getElements() as $element) {
             $element->setReadonly(true, true);
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:19,代码来源:Labels.php

示例13: isVisible

 /**
  * Check whether element should be displayed
  *
  * @return bool
  */
 public function isVisible()
 {
     if ($this->_application->isSingleStoreMode()) {
         return !(isset($this->_data['hide_in_single_store_mode']) && $this->_data['hide_in_single_store_mode']);
     }
     $result = false;
     switch ($this->_scope) {
         case Mage_Backend_Model_Config_ScopeDefiner::SCOPE_STORE:
             $result = isset($this->_data['showInStore']) && $this->_data['showInStore'];
             break;
         case Mage_Backend_Model_Config_ScopeDefiner::SCOPE_WEBSITE:
             $result = isset($this->_data['showInWebsite']) && $this->_data['showInWebsite'];
             break;
         case Mage_Backend_Model_Config_ScopeDefiner::SCOPE_DEFAULT:
             $result = isset($this->_data['showInDefault']) && $this->_data['showInDefault'];
             break;
     }
     return $result;
 }
开发者ID:,项目名称:,代码行数:24,代码来源:

示例14: isDisplayed

 /**
  * Get header css class name
  *
  * @return string
  */
 public function isDisplayed()
 {
     return !$this->_app->isSingleStoreMode();
 }
开发者ID:nayanchamp,项目名称:magento2,代码行数:9,代码来源:Multistore.php

示例15: testIsSingleStoreModeWhenDisabled

 /**
  * @magentoAppIsolation enabled
  * @magentoConfigFixture current_store general/single_store_mode/enabled 0
  */
 public function testIsSingleStoreModeWhenDisabled()
 {
     $this->assertFalse($this->_mageModel->isSingleStoreMode());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:8,代码来源:AppTest.php


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