本文整理汇总了PHP中Mage::getEdition方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getEdition方法的具体用法?PHP Mage::getEdition怎么用?PHP Mage::getEdition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getEdition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: info
/**
* Retrieve information about current Magento installation
*
* @return array
*/
public function info()
{
$result = array();
$result['magento_edition'] = Mage::getEdition();
$result['magento_version'] = Mage::getVersion();
return $result;
}
示例2: getMagentoEdition
/**
* Retrieve Magento edition
*
* @return string
*/
public function getMagentoEdition()
{
if (method_exists('Mage', 'getEdition')) {
// getEdition is only available after Magento CE Version 1.7.0.0
$edition = Mage::getEdition();
switch ($edition) {
case Mage::EDITION_COMMUNITY:
$edition = 'CE';
break;
case Mage::EDITION_ENTERPRISE:
$edition = 'EE';
break;
case Mage::EDITION_PROFESSIONAL:
$edition = 'PE';
break;
case Mage::EDITION_GO:
$edition = 'GO';
break;
}
} else {
// Check for different Licensetypes to get Magento-Edition
$path = Mage::getBaseDir();
if (file_exists($path . DS . 'LICENSE_EE.txt')) {
$edition = 'EE';
} elseif (file_exists($path . DS . 'LICENSE_PRO.html')) {
$edition = 'PE';
} else {
$edition = 'CE';
}
}
return $edition;
}
示例3: _createOrUpdateAttribute
private function _createOrUpdateAttribute($code, $data)
{
$attribute = $this->_getAttribute($code);
$canSave = false;
if (!$attribute) {
$this->log($this->__('Creating Attribute %s', $code));
$attribute = Mage::getModel('catalog/resource_eav_attribute');
$attribute->setData('attribute_code', $code);
$canSave = true;
$data = array_replace_recursive($this->_getAttributeDefaultSettings(), $data);
$data['backend_type'] = $attribute->getBackendTypeByInput($data['frontend_input']);
$data['source_model'] = Mage::helper('catalog/product')->getAttributeSourceModelByInputType($data['frontend_input']);
$data['backend_model'] = Mage::helper('catalog/product')->getAttributeBackendModelByInputType($data['frontend_input']);
}
foreach ($data as $key => $value) {
// Skip store labels to be processed after
if ($key == 'store_labels') {
continue;
}
// YAML will pass product types as an array which needs to be imploded
if ($key == "product_types") {
$key = "apply_to";
$value = implode(",", $value);
}
// YAML will pass options as an array which will require to be added differently
if ($key == "options") {
continue;
}
// Skip setting search_weight if not enterprise
if ($key == "search_weight" && Mage::getEdition() != Mage::EDITION_ENTERPRISE) {
continue;
}
if ($attribute->getId() && $attribute->getData($key) == $value) {
continue;
}
$attribute->setData($key, $value);
$this->log($this->__('Setting attribute "%s" %s with %s', $code, $key, $value));
$canSave = true;
}
unset($key);
unset($value);
if (!$attribute->getEntityTypeId()) {
$attribute->setEntityTypeId(Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId());
$attribute->setIsUserDefined(1);
}
try {
if ($canSave) {
$attribute->save();
$this->log($this->__('Saved Attribute %s', $code));
}
if ($data['options']) {
$this->_maintainAttributeOptions($attribute, $data['options']);
}
if ($data['store_labels']) {
$this->_maintainAttributeStoreLabels($attribute, $data['store_labels']);
}
} catch (Exception $e) {
throw $e;
}
}
示例4: nodeToArray
private function nodeToArray(Varien_Data_Tree_Node $node, $mediaUrl, $baseUrl)
{
$result = array();
$thumbnail = '';
try {
$thumbImg = $node->getThumbnail();
if ($thumbImg != null) {
$thumbnail = $mediaUrl . 'catalog/category/' . $node->getThumbnail();
}
} catch (Exception $e) {
}
$result['category_id'] = $node->getId();
$result['image'] = $mediaUrl . 'catalog/category/' . $node->getImage();
$result['thumbnail'] = $thumbnail;
$result['description'] = strip_tags($node->getDescription());
$result['parent_id'] = $node->getParentId();
$result['name'] = $node->getName();
$result['is_active'] = $node->getIsActive();
$result['children'] = array();
if (method_exists('Mage', 'getEdition') && Mage::getEdition() == Mage::EDITION_COMMUNITY) {
$result['url_path'] = $baseUrl . $node->getData('url_path');
} else {
$category = Mage::getModel('catalog/category')->load($node->getId());
$result['url_path'] = $category->getUrl();
}
foreach ($node->getChildren() as $child) {
$result['children'][] = $this->nodeToArray($child, $mediaUrl, $baseUrl);
}
return $result;
}
示例5: getEdition
public static function getEdition()
{
if (!self::$_edition) {
$configEE = BP . "/app/code/core/Enterprise/Enterprise/etc/config.xml";
if (!file_exists($configEE)) {
self::$_edition = 'ce';
} else {
$xml = @simplexml_load_file($configEE, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($xml !== false) {
$package = (string) $xml->default->design->package->name;
if (!$package) {
$package = strtolower(Mage::getEdition());
}
if ($package == 'enterprise') {
self::$_edition = 'ee';
} else {
self::$_edition = 'pe';
}
} else {
self::$_edition = 'unknown';
}
}
}
return self::$_edition;
}
示例6: getMageVersion
/**
* get Magento version
*
* @return string
*/
public function getMageVersion()
{
$mageVersion = Mage::getVersion();
if (is_callable('Mage::getEdition')) {
$mageVersion = Mage::getEdition() . ' ' . $mageVersion;
}
return $mageVersion;
}
示例7: getFeedUrl
/**
* Get Feed URL
* @return string
* @throws Zend_Uri_Exception
*/
public function getFeedUrl()
{
$version = Mage::getConfig()->getModuleConfig('PayEx_MasterPass')->version->asArray();
$params = array('site_url' => Mage::getStoreConfig('web/unsecure/base_url'), 'installed_version' => $version, 'mage_ver' => Mage::getVersion(), 'edition' => Mage::getEdition());
$uri = Zend_Uri::factory(self::URL_NEWS);
$uri->addReplaceQueryParameters($params);
return $uri->getUri();
}
示例8: indexAction
/**
* Display search result
*/
public function indexAction()
{
$query = Mage::helper('catalogsearch')->getQuery();
/* @var $query Mage_CatalogSearch_Model_Query */
$query->setStoreId(Mage::app()->getStore()->getId());
if ($query->getQueryText() != '') {
if (Mage::helper('catalogsearch')->isMinQueryLength()) {
$query->setId(0)->setIsActive(1)->setIsProcessed(1);
} else {
if ($query->getId()) {
$query->setPopularity($query->getPopularity() + 1);
} else {
$query->setPopularity(1);
}
if ($query->getRedirect()) {
$query->save();
$this->getResponse()->setRedirect($query->getRedirect());
return;
} else {
$query->prepare();
}
}
Mage::helper('catalogsearch')->checkNotes();
$this->loadLayout();
// apply custom ajax layout
if ($this->getRequest()->isAjax()) {
$update = $this->getLayout()->getUpdate();
$update->addHandle('catalog_category_layered_ajax_layer');
}
$this->_initLayoutMessages('catalog/session');
$this->_initLayoutMessages('checkout/session');
// return json formatted response for ajax
if ($this->getRequest()->isAjax()) {
$listing = $this->getLayout()->getBlock('search_result_list')->toHtml();
if (Mage::getEdition() == Mage::EDITION_ENTERPRISE) {
$block = $this->getLayout()->getBlock('enterprisesearch.leftnav');
} else {
$block = $this->getLayout()->getBlock('catalogsearch.leftnav');
}
$layer = $block->toHtml();
// Fix urls that contain '___SID=U'
$urlModel = Mage::getSingleton('core/url');
$listing = $urlModel->sessionUrlVar($listing);
$layer = $urlModel->sessionUrlVar($layer);
$response = array('listing' => $listing, 'layer' => $layer);
$this->getResponse()->setHeader('Content-Type', 'application/json', true);
$this->getResponse()->setBody(json_encode($response));
} else {
$this->renderLayout();
}
if (!Mage::helper('catalogsearch')->isMinQueryLength()) {
$query->save();
}
} else {
$this->_redirectReferer();
}
}
示例9: getEdition
/**
* Retrieves Magento Edition
*
* @return string
*/
public function getEdition()
{
if (method_exists('Mage', 'getEdition')) {
$systemEdition = Mage::getEdition();
if (isset($this->_editionMapping[$systemEdition])) {
return $this->_editionMapping[$systemEdition];
}
}
return $this->getBehaviourEdition();
}
示例10: _verifyMagento
/**
* Define magento version and edition
*/
protected function _verifyMagento()
{
include $this->_magentoDir . 'app/Mage.php';
$this->_version = Mage::getVersion();
if (method_exists('Mage', 'getEdition')) {
$this->_edition = Mage::getEdition();
} else {
$this->_edition = file_exists($this->_magentoDir . 'app/etc/modules/Enterprise_Enterprise.xml') ? 'Enterprise' : 'Community';
}
}
示例11: getCoreVersionInfo
/**
* @return array
*/
public function getCoreVersionInfo()
{
$core = array();
$core['store_id'] = $this->getStoreId();
$core['mage_version'] = Mage::getVersion();
if (method_exists('Mage', 'getEdition')) {
$core['mage_edition'] = Mage::getEdition();
}
return $core;
}
示例12: validateDesignConfig
private function validateDesignConfig()
{
if (method_exists('Mage', 'getEdition')) {
$editionVersion = [Mage::EDITION_ENTERPRISE => '1.14.0', Mage::EDITION_PROFESSIONAL => '1.14.0', Mage::EDITION_COMMUNITY => '1.9.0'];
if (!version_compare(Mage::getVersion(), $editionVersion[Mage::getEdition()], '>=')) {
$this->markTestSkipped('Does not supported in this Magento version');
}
}
return false;
}
示例13: _toHtml
/**
* Render block HTML
*
* @return string
*/
protected function _toHtml()
{
$configHelper = $this->getConfigHelper();
// Module disabled
if (!$configHelper->extensionEnabled()) {
return '';
}
if (Mage::getEdition() === Mage::EDITION_ENTERPRISE) {
// Recreate the widget parameter cache on FPC cleared or just created
if (!$this->getFullPageCacheEnvironment() && $this->getUniqueId()) {
$id = RapidCampaign_Promotions_Model_Fpc_Placeholder::CACHE_PREFIX . $this->getUniqueId() . '_params';
Enterprise_PageCache_Model_Cache::getCacheInstance()->save(serialize($this->getData()), $id);
}
}
if (!$this->validateRules()) {
return '';
}
/** @var RapidCampaign_Promotions_Model_Storage $promotionsStorage */
$promotionsStorage = Mage::getModel('rapidcampaign_promotions/storage');
try {
$promotionModel = $promotionsStorage->getPromotionsModel();
} catch (Exception $e) {
$promotionModel = $promotionsStorage->getCachedPromotionsModel();
}
$promotion = $promotionModel->load($this->getData('promotion'));
// Promotion does not exist
if ($promotion->isEmpty()) {
return '';
}
$urlParams = $this->getUrlParams($promotion);
$promotionData = $promotion->getData();
$iframeUrl = $promotionData['embed_url'] . '?' . http_build_query($urlParams);
$iframeWidth = $promotionData['width'] ?: self::IFRAME_WIDTH;
$iframeHeight = $promotionData['height'] ?: self::IFRAME_HEIGHT;
if ($configHelper->testModeEnabled()) {
$embedScript = self::IFRAME_JS_TEST_BASE_URL;
} else {
$embedScript = self::IFRAME_JS_BASE_URL;
}
$isModalEnabled = $this->getData('modal_enabled');
$hideDiv = $isModalEnabled ? "display:none" : "";
if (preg_match('/sales/i', $promotionData['promotion_category'])) {
$embedScript .= self::IFRAME_SALES_EMBED;
$iframeString = sprintf('<div class="_rc_iframe %s" style="%s" data-url="%s" data-width="%s" data-height="%s"></div>', $this->getIframeClass($this->getUniqueId()), $hideDiv, $iframeUrl, $iframeWidth, $iframeHeight);
} else {
$embedScript .= self::IFRAME_MARKETING_EMBED;
$iframeString = sprintf('<div class="_rc_miframe %s" style="%s" data-url="%s"></div>', $this->getIframeClass($this->getUniqueId()), $hideDiv, $iframeUrl);
}
$jsString = sprintf('<script type="text/javascript" src="%s"></script>', $embedScript);
$html = $iframeString . $jsString;
if ($isModalEnabled) {
$html .= $this->getPromotionModalJs($promotion);
}
return $html;
}
示例14: _verifyMagento
protected function _verifyMagento($pathToMagentoBaseDir)
{
include $pathToMagentoBaseDir . 'app/Mage.php';
$this->_version = \Mage::getVersion();
if (method_exists('Mage', 'getEdition')) {
$this->_edition = \Mage::getEdition();
} else {
preg_match('/^1\\.(\\d+)\\./', $this->_version, $matches);
$majorRelease = $matches[1];
$this->_edition = $majorRelease < 7 ? 'Community' : 'Enterprise';
}
echo 'Analyzing Magento ' . $this->_version . ' (' . $this->_edition . ' Edition)...' . PHP_EOL;
}
示例15: isAvailableVersion
public function isAvailableVersion()
{
$mage = new Mage();
if (!is_callable(array($mage, 'getEdition'))) {
$edition = 'Community';
} else {
$edition = Mage::getEdition();
}
unset($mage);
if ($edition == 'Enterprise' && $this->_version == 'CE') {
return false;
}
return true;
}