本文整理汇总了PHP中Mage_Core_Model_App::getWebsites方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_App::getWebsites方法的具体用法?PHP Mage_Core_Model_App::getWebsites怎么用?PHP Mage_Core_Model_App::getWebsites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_App
的用法示例。
在下文中一共展示了Mage_Core_Model_App::getWebsites方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initWebsites
/**
* Initialize website values
*
* @param bool $withDefault
* @return Mage_ImportExport_Model_Import_Entity_EavAbstract
*/
protected function _initWebsites($withDefault = false)
{
/** @var $website Mage_Core_Model_Website */
foreach ($this->_websiteManager->getWebsites($withDefault) as $website) {
$this->_websiteCodeToId[$website->getCode()] = $website->getId();
}
return $this;
}
示例2: getWebsites
/**
* Get websites
*
* @return array
*/
public function getWebsites()
{
$websites = $this->_application->getWebsites();
if ($websiteIds = $this->getWebsiteIds()) {
foreach ($websites as $websiteId => $website) {
if (!in_array($websiteId, $websiteIds)) {
unset($websites[$websiteId]);
}
}
}
return $websites;
}
示例3: _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());
}
}
示例4: _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());
}
}
示例5: execute
/**
* Run reindex
*/
public function execute()
{
$this->_app->dispatchEvent('catalogrule_before_apply', array('resource' => $this->_resource));
/** @var $coreDate Mage_Core_Model_Date */
$coreDate = $this->_factory->getModel('core/date');
$timestamp = $coreDate->gmtTimestamp('Today');
foreach ($this->_app->getWebsites(false) as $website) {
/** @var $website Mage_Core_Model_Website */
if ($website->getDefaultStore()) {
$this->_reindex($website, $timestamp);
}
}
$this->_prepareGroupWebsite($timestamp);
$this->_prepareAffectedProduct();
}
示例6: testGetWebsites
public function testGetWebsites()
{
$this->assertNotEmpty($this->_mageModel->getWebsites());
$this->assertNotContains(0, array_keys($this->_mageModel->getWebsites()));
$this->assertContains(0, array_keys($this->_mageModel->getWebsites(true)));
}
示例7: _getWebsitesMap
/**
* Prepare website to default assigned store map
*
* @return array
*/
protected function _getWebsitesMap()
{
$map = array();
foreach ($this->_app->getWebsites(true) as $website) {
if ($website->getDefaultStore()) {
$map[$website->getId()] = $website->getDefaultStore()->getId();
}
}
return $map;
}