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


PHP Mage_Core_Model_Website::getCode方法代码示例

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


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

示例1: testLoad

 public function testLoad()
 {
     /* Test loading by id */
     $this->assertEquals(1, $this->_model->getId());
     $this->assertEquals('base', $this->_model->getCode());
     $this->assertEquals('Main Website', $this->_model->getName());
     /* Test loading by code */
     $this->_model->load('admin');
     $this->assertEquals(0, $this->_model->getId());
     $this->assertEquals('admin', $this->_model->getCode());
     $this->assertEquals('Admin', $this->_model->getName());
 }
开发者ID:natxetee,项目名称:magento2,代码行数:12,代码来源:WebsiteTest.php

示例2: _initCurrentStore

 /**
  * Initialize currently ran store
  *
  * @param string $scopeCode code of default scope (website/store_group/store code)
  * @param string $scopeType type of default scope (website/group/store)
  * @return unknown_type
  */
 protected function _initCurrentStore($scopeCode, $scopeType)
 {
     Varien_Profiler::start('mage::app::init::stores');
     $this->_initStores();
     Varien_Profiler::stop('mage::app::init::stores');
     if (empty($scopeCode) && !is_null($this->_website)) {
         $scopeCode = $this->_website->getCode();
         $scopeType = 'website';
     }
     switch ($scopeType) {
         case 'store':
             $this->_currentStore = $scopeCode;
             break;
         case 'group':
             $this->_currentStore = $this->_getStoreByGroup($scopeCode);
             break;
         case 'website':
             $this->_currentStore = $this->_getStoreByWebsite($scopeCode);
             break;
         default:
             $this->throwStoreException();
     }
     if (!empty($this->_currentStore)) {
         $this->_checkCookieStore($scopeType);
         $this->_checkGetStore($scopeType);
     }
     $this->_useSessionInUrl = $this->getStore()->getConfig(Mage_Core_Model_Session_Abstract::XML_PATH_USE_FRONTEND_SID);
     return $this;
 }
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:36,代码来源:App.php

示例3: _initCurrentStore

 /**
  * Initialize currently ran store
  *
  * @param string $scopeCode code of default scope (website/store_group/store code)
  * @param string $scopeType type of default scope (website/group/store)
  * @return unknown_type
  */
 protected function _initCurrentStore($scopeCode, $scopeType)
 {
     Varien_Profiler::start('mage::app::init::stores');
     $this->_initStores();
     Varien_Profiler::stop('mage::app::init::stores');
     if (empty($scopeCode) && !is_null($this->_website)) {
         $scopeCode = $this->_website->getCode();
         $scopeType = 'website';
     }
     switch ($scopeType) {
         case 'store':
             $this->_currentStore = $scopeCode;
             break;
         case 'group':
             $this->_currentStore = $this->_getStoreByGroup($scopeCode);
             break;
         case 'website':
             $this->_currentStore = $this->_getStoreByWebsite($scopeCode);
             break;
         default:
             $this->throwStoreException();
     }
     if (!empty($this->_currentStore)) {
         $this->_checkCookieStore($scopeType);
         $this->_checkGetStore($scopeType);
     }
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:35,代码来源:App.php

示例4: init

 /**
  * Initialize application
  *
  * @param string|array $code
  * @param string $type
  * @param string $etcDir
  * @return Mage_Core_Model_App
  */
 public function init($code, $type = null, $options = array())
 {
     $this->setErrorHandler(self::DEFAULT_ERROR_HANDLER);
     date_default_timezone_set(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
     if (is_string($options)) {
         $options = array('etc_dir' => $options);
     }
     if (VPROF) {
         Varien_Profiler::start('mage::app::init::config');
     }
     $this->_config = AO::getConfig();
     $this->_config->init($options);
     if (VPROF) {
         Varien_Profiler::stop('mage::app::init::config');
     }
     if (AO::isInstalled($options)) {
         if (VPROF) {
             Varien_Profiler::start('mage::app::init::stores');
         }
         $this->_initStores();
         if (VPROF) {
             Varien_Profiler::stop('mage::app::init::stores');
         }
         if (empty($code) && !is_null($this->_website)) {
             $code = $this->_website->getCode();
             $type = 'website';
         }
         switch ($type) {
             case 'store':
                 $this->_currentStore = $code;
                 break;
             case 'group':
                 $this->_currentStore = $this->_getStoreByGroup($code);
                 break;
             case 'website':
                 $this->_currentStore = $this->_getStoreByWebsite($code);
                 break;
             default:
                 $this->throwStoreException();
         }
         if (!empty($this->_currentStore)) {
             $this->_checkCookieStore($type);
             $this->_checkGetStore($type);
         }
         $this->getRequest()->setPathInfo();
     }
     $this->_initFrontController();
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:57,代码来源:App.php

示例5: _saveWebsiteConfigItems

 private function _saveWebsiteConfigItems(array $configs, Mage_Core_Model_Website $website)
 {
     try {
         if (!$website->getId()) {
             throw new Exception($this->__('Website does not exist'));
         }
         if (!empty($configs)) {
             foreach ($configs as $config) {
                 if (isset($config['encrypted']) && $config['encrypted'] == 1) {
                     $config['value'] = Mage::helper('core')->encrypt($config['value']);
                 }
                 // Save config
                 $this->_checkAndSaveConfig($config['path'], $config['value'], 'websites', $website->getId(), $website->getCode());
             }
         }
     } catch (Exception $e) {
         $this->log($e->getMessage());
     }
 }
开发者ID:ThomasNegeli,项目名称:magento-configurator,代码行数:19,代码来源:Config.php

示例6: _addWebsiteFieldset

 /**
  * Method add website fieldset to the form.
  * @param Mage_Core_Model_Website $website
  */
 private function _addWebsiteFieldset($website, $form)
 {
     $prefixWeb = 'website-' . $website->getCode();
     /* make fieldset */
     $layoutFieldset = $form->addFieldset($prefixWeb . '_fieldset', array('legend' => Mage::helper('mturbo')->__($website->getName() . ' settings'), 'class' => 'fieldset'));
     /* add extra user control */
     $layoutFieldset->addType('html_element', Artio_MTurbo_Helper_Data::FORM_HTML);
     $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
     /* indicator whether website is enabled */
     $layoutFieldset->addField($prefixWeb . '-enabled', 'select', array('name' => $prefixWeb . '-enabled', 'label' => Mage::helper('mturbo')->__('Enable website') . ':', 'value' => '1', 'options' => array(0 => Mage::helper('mturbo')->__('No'), 1 => Mage::helper('mturbo')->__('Yes'))));
     /* add field for turbopath */
     $layoutFieldset->addField($prefixWeb . '-base_dir', 'text', array('name' => $prefixWeb . '-base_dir', 'value' => Mage::getBaseDir(), 'label' => Mage::helper('mturbo')->__('Base directory') . ':'));
     /* add field for server name */
     $layoutFieldset->addField($prefixWeb . '-server_name', 'text', array('name' => $prefixWeb . '-server_name', 'value' => Mage::helper('mturbo/website')->getServerName($website->getDefaultStore()->getCode()), 'label' => Mage::helper('mturbo')->__('Server name') . ':'));
     /* every store has one select determines whether enabled is */
     foreach ($website->getStores() as $store) {
         if ($store->getIsActive()) {
             $layoutFieldset->addField($prefixWeb . '-store-' . $store->getCode(), 'select', array('name' => $prefixWeb . '-store-' . $store->getCode(), 'label' => $store->getGroup()->getName() . '<br />' . $store->getName(), 'value' => '1', 'options' => array(0 => Mage::helper('mturbo')->__('No'), 1 => Mage::helper('mturbo')->__('Yes'))));
         }
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:25,代码来源:Form.php

示例7: _addWebsiteFieldset

 /**
  * Method add website fieldset to the form.
  * @param Mage_Core_Model_Website $website
  */
 private function _addWebsiteFieldset($website)
 {
     $prefixWeb = 'website-' . $website->getCode();
     /* make fieldset */
     $layoutFieldset = $this->form->addFieldset($prefixWeb . '_fieldset', array('legend' => $this->getMyHelper()->__($website->getName() . ' settings'), 'class' => 'fieldset'));
     /* add extra user control */
     $layoutFieldset->addType('html_element', Artio_MTurbo_Helper_Data::FORM_HTML);
     $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
     /* indicator whether website is enabled */
     $layoutFieldset->addField($prefixWeb . '-enabled', 'select', array('name' => $prefixWeb . '-enabled', 'label' => $this->getMyHelper()->__('Enable website') . ':', 'options' => array(0 => $this->getMyHelper()->__('No'), 1 => $this->getMyHelper()->__('Yes'))));
     /* add field for base dir */
     $layoutFieldset->addField($prefixWeb . '-base_dir', 'text', array('name' => $prefixWeb . '-base_dir', 'label' => $this->getMyHelper()->__('Base directory') . ':'));
     /* add field for server name */
     $layoutFieldset->addField($prefixWeb . '-server_name', 'text', array('name' => $prefixWeb . '-server_name', 'label' => $this->getMyHelper()->__('Server name') . ':'));
     $layoutFieldset->addField($prefixWeb . '_dec1', 'html_element', array('label' => '<h4>' . $this->getMyHelper()->__('Enable/Disable Storeview') . '</h4>', 'code' => '<div style="height:10px;border-bottom:1px solid #808080"></div>'));
     /* every store has one select determines whether enabled is */
     foreach ($website->getStores() as $store) {
         if ($store->getIsActive()) {
             $layoutFieldset->addField($prefixWeb . '-store-' . $store->getCode(), 'select', array('name' => $prefixWeb . '-store-' . $store->getCode(), 'label' => $store->getGroup()->getName() . '<br />' . $store->getName(), 'options' => array(0 => $this->getMyHelper()->__('No'), 1 => $this->getMyHelper()->__('Yes'))));
         }
     }
     $layoutFieldset->addField($prefixWeb . '_dec2', 'html_element', array('label' => '<h4>' . $this->getMyHelper()->__('Htaccess settings') . '</h4>', 'code' => '<div style="height:10px;border-bottom:1px solid #808080"></div>'));
     /* get htaccess state and set color by it */
     $htaccess = Mage::getModel('mturbo/htaccess')->setWebsiteCode($website->getCode());
     $state = '';
     $pathToHtaccess = $htaccess->getPathToBaseHtaccess();
     $color = Mage::helper('mturbo/functions')->get_file_state($pathToHtaccess, $state, 'ew') ? 'green' : 'red';
     $layoutFieldset->addField($prefixWeb . '_dec3', 'html_element', array('label' => $this->getMyHelper()->__('File .htaccess path'), 'code' => '<span>' . $pathToHtaccess . '</span>'));
     $edit = $htaccess->isEditedByMTurbo() ? 'yes' : 'no';
     $layoutFieldset->addField($prefixWeb . '_dec5', 'html_element', array('label' => $this->getMyHelper()->__('Edited by MTurbo'), 'code' => '<span><b>' . $this->getMyHelper()->__($edit) . '</b></span>'));
     $layoutFieldset->addField($prefixWeb . '_dec4', 'html_element', array('label' => $this->getMyHelper()->__('File .htaccess state'), 'code' => '<span style="color:' . $color . '">' . $this->getMyHelper()->__($state) . '</span>'));
     /* button 'rebuild' show only if htaccess is ready */
     if ($color == 'green') {
         $layoutFieldset->addField($prefixWeb . '_htaccess_button', 'widget_button', array('name' => $prefixWeb . '_htaccess_button', 'label' => $this->getMyHelper()->__('Rebuild .htaccess for this website'), 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/htaccessbuild', array('websitecode' => $website->getCode())) . "')"));
     }
     $layoutFieldset->addField($prefixWeb . '_urllist_button', 'widget_button', array('name' => $prefixWeb . '_urllist_button', 'label' => $this->getMyHelper()->__('Generate URL list for this website'), 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/generateurllist', array('websitecode' => $website->getCode())) . "')"));
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:41,代码来源:Website.php

示例8: _ensureWebsite

 /**
  * Make sure website is set
  *
  * @throws Mage_Core_Exception
  */
 protected function _ensureWebsite()
 {
     if (!$this->_website || !$this->_website->getCode()) {
         Mage::throwException(Mage::helper('enterprise_staging')->__('Website code is not defined.'));
     }
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:11,代码来源:Entry.php

示例9: _initCurrentStore

 /**
  * Initialize currently ran store
  *
  * @param string $scopeCode code of default scope (website/store_group/store code)
  * @param string $scopeType type of default scope (website/group/store)
  * @return Mage_Core_Model_App
  * @throws Mage_Core_Model_Store_Exception
  */
 protected function _initCurrentStore($scopeCode, $scopeType)
 {
     Magento_Profiler::start('init_stores');
     $this->_initStores();
     Magento_Profiler::stop('init_stores');
     if (empty($scopeCode) && !is_null($this->_website)) {
         $scopeCode = $this->_website->getCode();
         $scopeType = 'website';
     }
     switch ($scopeType) {
         case Mage_Core_Model_App_Options::APP_RUN_TYPE_STORE:
             $this->_currentStore = $scopeCode;
             break;
         case Mage_Core_Model_App_Options::APP_RUN_TYPE_GROUP:
             $this->_currentStore = $this->_getStoreByGroup($scopeCode);
             break;
         case Mage_Core_Model_App_Options::APP_RUN_TYPE_WEBSITE:
             $this->_currentStore = $this->_getStoreByWebsite($scopeCode);
             break;
         default:
             $this->throwStoreException();
     }
     if (!empty($this->_currentStore)) {
         $this->_checkCookieStore($scopeType);
         $this->_checkGetStore($scopeType);
     }
     $this->_useSessionInUrl = $this->getStore()->getConfig(Mage_Core_Model_Session_Abstract::XML_PATH_USE_FRONTEND_SID);
     Mage::dispatchEvent('core_app_init_current_store_after');
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:38,代码来源:App.php


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