/** * Checks which edition is used * @return int */ public static function getPlatform() { if (self::$_platform == -1) { $pathToClaim = BP . DS . "app" . DS . "etc" . DS . "modules" . DS . self::ENTERPRISE_DETECT_COMPANY . "_" . self::ENTERPRISE_DETECT_EXTENSION . ".xml"; $pathToEEConfig = BP . DS . "app" . DS . "code" . DS . "core" . DS . self::ENTERPRISE_DETECT_COMPANY . DS . self::ENTERPRISE_DETECT_EXTENSION . DS . "etc" . DS . "config.xml"; $isCommunity = !file_exists($pathToClaim) || !file_exists($pathToEEConfig); if ($isCommunity) { self::$_platform = self::CE_PLATFORM; } else { $_xml = @simplexml_load_file($pathToEEConfig, 'SimpleXMLElement', LIBXML_NOCDATA); if (!$_xml === FALSE) { $package = (string) $_xml->default->design->package->name; $theme = (string) $_xml->install->design->theme->default; $skin = (string) $_xml->stores->admin->design->theme->skin; $isProffessional = $package == self::PROFESSIONAL_DESIGN_NAME && $theme == self::PROFESSIONAL_DESIGN_NAME && $skin == self::PROFESSIONAL_DESIGN_NAME; if ($isProffessional) { self::$_platform = self::PE_PLATFORM; return self::$_platform; } } self::$_platform = self::EE_PLATFORM; } } return self::$_platform; }
protected function _initExtensions() { $extensions = array(); $modules = array_keys((array) Mage::getConfig()->getNode('modules')->children()); sort($modules); foreach ($modules as $moduleName) { if (strstr($moduleName, 'AW_') === false) { continue; } if ($moduleName == 'AW_Core' || $moduleName == 'AW_All') { continue; } // Detect extension platform try { if ($platform = Mage::getConfig()->getNode("modules/{$moduleName}/platform")) { $platform = strtolower($platform); $ignore_platform = false; } else { throw new Exception(); } } catch (Exception $e) { $platform = "ce"; $ignore_platform = true; } $platform = AW_All_Helper_Versions::convertPlatform($platform); // Detect installed version $ver = Mage::getConfig()->getModuleConfig($moduleName)->version; $isPlatformValid = $platform >= $this->getPlatform(); $feedInfo = $this->getExtensionInfo($moduleName); $upgradeAvailable = $this->_convertVersion($feedInfo->getLatestVersion()) - $this->_convertVersion($ver) > 0; $extensions[] = new Varien_Object(array('version' => $ver, 'name' => $moduleName, 'is_platform_valid' => $isPlatformValid, 'platform' => $platform, 'feed_info' => $feedInfo, 'upgrade_available' => $upgradeAvailable)); } return $extensions; }
public function toOptionArray() { $package = Mage_Core_Model_Design_Package::DEFAULT_PACKAGE; if (AW_All_Helper_Versions::getPlatform() == 100) { $package = 'enterprise'; } if (AW_All_Helper_Versions::getPlatform() == 10) { $package = 'pro'; } $dir = Mage::getDesign()->getSkinBaseDir(array('_area' => Mage_Core_Model_Design_Package::DEFAULT_AREA, '_default' => true, '_theme' => Mage_Core_Model_Design_Package::DEFAULT_THEME, '_package' => $package)) . DS . 'aw_countdown'; $scopes = $this->_listDirectories($dir); return $scopes; }
protected function _initExtensions() { $extensions = array(); $modules = array_keys((array) Mage::getConfig()->getNode('modules')->children()); sort($modules); foreach ($modules as $moduleName) { if (strstr($moduleName, 'AW_') === false) { continue; } if ($moduleName == 'AW_Core' || $moduleName == 'AW_All') { continue; } // Detect extension platform try { if ($platform = Mage::getConfig()->getNode("modules/{$moduleName}/platform")) { $platform = strtolower($platform); $ignore_platform = false; } else { throw new Exception(); } } catch (Exception $e) { $platform = "ce"; $ignore_platform = true; } $platform = AW_All_Helper_Versions::convertPlatform($platform); // Detect installed version $ver = Mage::getConfig()->getModuleConfig($moduleName)->version; if ((bool) $ver === false) { $_moduleConfigFilePath = Mage::getConfig()->getModuleDir('etc', $moduleName) . DS . 'config.xml'; if (file_exists($_moduleConfigFilePath)) { $_configXml = new SimpleXMLElement(file_get_contents($_moduleConfigFilePath)); $ver = (string) $_configXml->modules->{$moduleName}->version; } } $isPlatformValid = $platform >= $this->getPlatform(); $feedInfo = $this->getExtensionInfo($moduleName); $upgradeAvailable = $this->_convertVersion($feedInfo->getLatestVersion()) - $this->_convertVersion($ver) > 0; if (null !== $feedInfo->getDisplayName()) { $moduleName = $feedInfo->getDisplayName(); } $extensions[] = new Varien_Object(array('version' => $ver, 'name' => $moduleName, 'is_platform_valid' => $isPlatformValid, 'platform' => $platform, 'feed_info' => $feedInfo, 'upgrade_available' => $upgradeAvailable)); } return $extensions; }
public function checkExtensions() { $modules = array_keys((array) Mage::getConfig()->getNode('modules')->children()); sort($modules); $magentoPlatform = AW_All_Helper_Versions::getPlatform(); foreach ($modules as $extensionName) { if (strstr($extensionName, 'AW_') === false) { continue; } if ($extensionName == 'AW_Core' || $extensionName == 'AW_All') { continue; } if ($platformNode = $this->getExtensionPlatform($extensionName)) { $extensionPlatform = AW_All_Helper_Versions::convertPlatform($platformNode); if ($extensionPlatform < $magentoPlatform) { $this->disableExtensionOutput($extensionName); } } } return $this; }
protected function _prepareFinalPriceData($entityIds = null) { $this->_prepareDefaultFinalPriceTable(); $write = $this->_getWriteAdapter(); $select = $write->select()->from(array('e' => $this->getTable('catalog/product')), array('entity_id'))->join(array('cg' => $this->getTable('customer/customer_group')), '', array('customer_group_id')); $this->_addWebsiteJoinToSelect($select, true); $this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', 'e.entity_id'); $select->columns(array('website_id'), 'cw')->columns(array('tax_class_id' => new Zend_Db_Expr('0')))->where('e.type_id = ?', $this->getTypeId()); $statusCond = $write->quoteInto('=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED); $this->_addAttributeToSelect($select, 'status', 'e.entity_id', 'cs.store_id', $statusCond, true); $openAmountMinExp = $this->_addAttributeToSelect($select, 'aw_gc_open_amount_min', 'e.entity_id', 'cs.store_id'); $openAmountMaxExp = $this->_addAttributeToSelect($select, 'aw_gc_open_amount_max', 'e.entity_id', 'cs.store_id'); $allowOpenAmountExp = $this->_addAttributeToSelect($select, 'aw_gc_allow_open_amount', 'e.entity_id', 'cs.store_id'); $attrAmounts = $this->_getAttribute('aw_gc_amounts'); $select->joinLeft(array('gca' => $this->getTable('aw_giftcard/product_amount')), 'gca.entity_id = e.entity_id AND gca.attribute_id = ' . $attrAmounts->getAttributeId() . ' AND (gca.website_id = cw.website_id OR gca.website_id = 0)', array()); $_finalPrice = $this->_getPriceExprForOpenAmountAttr($openAmountMinExp, 'MIN', $allowOpenAmountExp); $_columns = array('price' => $_finalPrice, 'final_price' => $_finalPrice, 'min_price' => $_finalPrice, 'max_price' => $this->_getPriceExprForOpenAmountAttr($openAmountMaxExp, 'MAX', $allowOpenAmountExp), 'tier_price' => new Zend_Db_Expr('NULL'), 'base_tier' => new Zend_Db_Expr('NULL')); if (AW_All_Helper_Versions::getPlatform() == AW_All_Helper_Versions::CE_PLATFORM && version_compare(Mage::getVersion(), '1.7', '>=')) { $_columns = array('orig_price' => $_finalPrice, 'price' => $_finalPrice, 'min_price' => $_finalPrice, 'max_price' => $this->_getPriceExprForOpenAmountAttr($openAmountMaxExp, 'MAX', $allowOpenAmountExp), 'tier_price' => new Zend_Db_Expr('NULL'), 'base_tier' => new Zend_Db_Expr('NULL'), 'group_price' => new Zend_Db_Expr('NULL'), 'base_group_price' => new Zend_Db_Expr('NULL')); } if (AW_All_Helper_Versions::getPlatform() == AW_All_Helper_Versions::EE_PLATFORM && version_compare(Mage::getVersion(), '1.12', '>=')) { $_columns = array('price' => $_finalPrice, 'final_price' => $_finalPrice, 'min_price' => $_finalPrice, 'max_price' => $this->_getPriceExprForOpenAmountAttr($openAmountMaxExp, 'MAX', $allowOpenAmountExp), 'tier_price' => new Zend_Db_Expr('NULL'), 'base_tier' => new Zend_Db_Expr('NULL'), 'group_price' => new Zend_Db_Expr('NULL'), 'base_group_price' => new Zend_Db_Expr('NULL')); } $select->group(array('e.entity_id', 'cg.customer_group_id', 'cw.website_id'))->columns($_columns); if (!is_null($entityIds)) { $select->where('e.entity_id IN(?)', $entityIds); } Mage::dispatchEvent('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()); $write->query($query); return $this; }
public function isEEVersion() { return AW_All_Helper_Versions::getPlatform() == AW_All_Helper_Versions::EE_PLATFORM; }
public function hasOptions($product = null) { if ($this->getProduct($product)->getOptions() || !Mage::registry('current_product') || AW_All_Helper_Versions::getPlatform() == AW_All_Helper_Versions::EE_PLATFORM || Mage::helper('aw_giftcard')->isAWMobile2Package()) { return true; } return false; }
public function hasOptions($product = null) { if ($this->getProduct($product)->getOptions() || !Mage::registry('current_product') || AW_All_Helper_Versions::getPlatform() == AW_All_Helper_Versions::EE_PLATFORM) { return true; } return false; }