Example #1
2
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @throws InvalidArgumentException
  * @return int|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->detectMagento($output, true);
     if (!$this->initMagento()) {
         return;
     }
     $type = $input->getArgument('type');
     $areas = array('global', 'adminhtml', 'frontend', 'crontab');
     if ($type === null) {
         $type = $this->askForArrayEntry($areas, $output, 'Please select an area:');
     }
     if (!in_array($type, $areas)) {
         throw new InvalidArgumentException('Invalid type! Use one of: ' . implode(', ', $areas));
     }
     if ($input->getOption('format') === null) {
         $this->writeSection($output, 'Observers: ' . $type);
     }
     $frontendEvents = \Mage::getConfig()->getNode($type . '/events')->asArray();
     if (true === $input->getOption('sort')) {
         // sorting for Observers is a bad idea because the order in which observers will be called is important.
         ksort($frontendEvents);
     }
     $table = array();
     foreach ($frontendEvents as $eventName => $eventData) {
         $observerList = array();
         foreach ($eventData['observers'] as $observer) {
             $observerList[] = $this->getObserver($observer, $type);
         }
         $table[] = array($eventName, implode("\n", $observerList));
     }
     $this->getHelper('table')->setHeaders(array('Event', 'Observers'))->setRows($table)->renderByFormat($output, $table, $input->getOption('format'));
 }
Example #2
1
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix("template");
     $form->setFieldNameSuffix("template");
     /* @var $template Mzax_Emarketing_Model_Template */
     $template = Mage::registry('current_template');
     if ($template->getId()) {
         $form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
     }
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
     $fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
     $fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
     $fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
     $snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
     Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
     $editorConfig = new Varien_Object();
     $editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
     $editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
     $editorConfig->setSnippets($snippets);
     $editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
     // Setting custom renderer for content field to remove label column
     $renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
     $editor->setRenderer($renderer);
     $form->addValues($template->getData());
     $this->setForm($form);
     $form->setUseContainer(true);
     return parent::_prepareForm();
 }
 public function indexAction()
 {
     //echo 'Hello Index!';
     header('Content-Type: text/plain');
     echo $config = Mage::getConfig()->loadModulesConfiguration('system.xml')->getNode()->asXML();
     exit;
 }
Example #4
0
 public function allowGetFeed($item)
 {
     if ($item['related_extensions'] == null || $item['related_extensions'] == '0') {
         return true;
     }
     $modules = Mage::getConfig()->getNode('modules')->children();
     foreach ($modules as $moduleName => $moduleInfo) {
         if ($moduleName === 'Mage_Adminhtml') {
             continue;
         }
         if ($moduleName === 'Magegiant_Magegiantcore') {
             continue;
         }
         if (strpos('a' . $moduleName, 'Magegiant') == 0) {
             continue;
         }
         $extension_code = str_replace('Magegiant_', '', $moduleName);
         $related_extensions = explode(',', $item['related_extensions']);
         if (count($related_extensions)) {
             foreach ($related_extensions as $related_extension) {
                 if ($related_extension == $extension_code) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
Example #5
0
 public function getClassNameByType($type)
 {
     if (strpos($type, '/') !== false) {
         return Mage::getConfig()->getModelClassName($type);
     }
     return parent::getClassNameByType($type);
 }
 /**
  * Controller pre-dispatch method
  *
  * @return Mage_XmlConnect_Controller_AdminAction
  */
 public function preDispatch()
 {
     Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
     // override admin store design settings via stores section
     Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     foreach (array('layout', 'template', 'skin', 'locale') as $type) {
         $value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}");
         if ($value) {
             Mage::getDesign()->setTheme($type, $value);
         }
     }
     $this->getLayout()->setArea($this->_currentArea);
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     Mage_Core_Controller_Varien_Action::preDispatch();
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
     if ($this->_isCheckCookieRequired()) {
         $this->_checkCookie();
     }
     return $this;
 }
Example #7
0
 /**
  * Get compilation config
  *
  * @return Mage_Core_Model_Config_Base
  */
 public function getCompileConfig()
 {
     if ($this->_compileConfig === null) {
         $this->_compileConfig = Mage::getConfig()->loadModulesConfiguration('compilation.xml');
     }
     return $this->_compileConfig;
 }
Example #8
0
 /**
  * Run the uninstall sql script to remove everything from module in database
  * This uninstall script must be provided by the extension provider
  *
  * @param $moduleName
  */
 public function uninstallSqlCommand($moduleName)
 {
     Mage::getSingleton('adminhtml/session')->AddNotice('Running SQL Unininstall for Module:' . $moduleName);
     $result = false;
     $resources = Mage::getConfig()->getNode('global/resources')->children();
     foreach ($resources as $resName => $resource) {
         if (!$resource->setup) {
             continue;
         }
         if (isset($resource->setup->module)) {
             $testModName = (string) $resource->setup->module;
             if ($testModName == $moduleName) {
                 $resourceName = $resName;
             }
         }
     }
     if (empty($resourceName)) {
         return $result;
     }
     $fileName = $this->_getUninstallSQLFile($moduleName, $resourceName);
     if (!is_null($fileName)) {
         $resource = new Hackathon_MageTrashApp_Model_Resource_Setup($resourceName);
         $result = $resource->runUninstallSql($fileName, $resourceName);
     } else {
         Mage::getSingleton('adminhtml/session')->addNotice('Unable to find uninstall script for:' . $moduleName);
     }
     return $result;
 }
Example #9
0
 protected function _prepareForm()
 {
     $helper = Mage::helper('yanws');
     /** @var Emagedev_Yanws_Model_News $model */
     $model = Mage::registry('current_news');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $entry = $model->getData();
     $this->setForm($form);
     $fieldset = $form->addFieldset('news_form', array('legend' => $helper->__('News Information')));
     $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false, 'add_images' => true, 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'), 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'), 'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height')));
     $fieldset->addField('title', 'text', array('label' => $helper->__('Title'), 'required' => true, 'name' => 'title'));
     $fieldset->addField('article', 'editor', array('label' => $helper->__('Article'), 'wysiwyg' => true, 'style' => 'width:700px; height:400px;', 'config' => $wysiwygConfig, 'required' => true, 'name' => 'article'));
     $fieldset->addField('is_shorten', 'checkbox', array('label' => $helper->__('Use shorten'), 'required' => false, 'name' => 'is_shorten', 'value' => empty($entry) ? false : $model->getIsShorten(), 'checked' => empty($entry) ? false : $model->getIsShorten(), 'onclick' => 'this.value = this.checked ? 1 : 0;'));
     $fieldset->addField('shorten_article', 'editor', array('label' => $helper->__('Shorten article'), 'required' => false, 'style' => 'width:98%; height:600px;', 'wysiwyg' => true, 'config' => $wysiwygConfig, 'name' => 'shorten_article'));
     $fieldset->addField('url', 'text', array('label' => $helper->__('URL'), 'required' => false, 'after_element_html' => '
             <div id="url-view-helper">
                 <p>Пример ссылки: </p>
                 <span id="url-view-helper-url"></span>
             </div>
             ', 'name' => 'url'));
     $fieldset->addField('is_published', 'checkbox', array('label' => $helper->__('Is published'), 'required' => false, 'name' => 'is_published', 'value' => empty($entry) ? '1' : $model->isPublished(), 'onclick' => 'this.value = this.checked ? 1 : 0; '));
     $form->getElement('is_published')->setIsChecked(empty($entry) ? true : $model->isPublished());
     $form->setUseContainer(true);
     if ($data = Mage::getSingleton('adminhtml/session')->getFormData()) {
         $form->setValues($data);
     } else {
         $form->setValues($model->getData());
     }
     return parent::_prepareForm();
 }
Example #10
0
 protected function setUp()
 {
     parent::setUp();
     $this->_screenshots = array();
     $browserName = Xtest::getArg('browser', 'firefox');
     $browserData = Mage::getConfig()->getNode('default/xtest/selenium/browserlist/' . strtolower($browserName));
     if ($browserData) {
         $browserData = $browserData->asArray();
         $capabilities = array();
         if ($browserData['is_browserstack']) {
             if ($browserstackConfig = Mage::getConfig()->getNode('default/xtest/selenium/browserstack')) {
                 $browserstackConfig = $browserstackConfig->asArray();
                 $this->setHost($browserstackConfig['host']);
                 $this->setPort((int) $browserstackConfig['port']);
                 if (file_exists($browserstackConfig['authfile'])) {
                     list($user, $key) = explode(':', file_get_contents($browserstackConfig['authfile']));
                     $capabilities['browserstack.user'] = trim($user);
                     $capabilities['browserstack.key'] = trim($key);
                 }
             }
         }
         $this->setBrowser($browserData['name']);
         if ($caps = $browserData['capabilities']) {
             $capabilities = array_merge($capabilities, $caps);
         }
         $this->setDesiredCapabilities($capabilities);
     } else {
         $this->setBrowser($browserName);
     }
     $this->setBrowserUrl(Mage::getBaseUrl());
     $this->setUpSessionStrategy(null);
     // Default Browser-Size
     $this->prepareSession()->currentWindow()->size(array('width' => 1280, 'height' => 1024));
     Xtest::initFrontend();
 }
 public function fetchRatesAction()
 {
     try {
         $service = $this->getRequest()->getParam('rate_services');
         $this->_getSession()->setCurrencyRateService($service);
         if (!$service) {
             throw new Exception(Mage::helper('adminhtml')->__('Invalid Import Service Specified'));
         }
         try {
             $importModel = Mage::getModel(Mage::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray());
         } catch (Exception $e) {
             Mage::throwException(Mage::helper('adminhtml')->__('Unable to initialize import model'));
         }
         $rates = $importModel->fetchRates();
         $errors = $importModel->getMessages();
         if (sizeof($errors) > 0) {
             foreach ($errors as $error) {
                 Mage::getSingleton('adminhtml/session')->addWarning($error);
             }
             Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('adminhtml')->__('All possible rates were fetched, please click on "Save" to apply'));
         } else {
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All rates were fetched, please click on "Save" to apply'));
         }
         Mage::getSingleton('adminhtml/session')->setRates($rates);
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
     }
     $this->_redirect('*/*/');
 }
 /**
  * Retrieve website code sufix
  *
  * @return string
  */
 public function getWebsiteCodeSuffix()
 {
     if (is_null($this->_stagingCodeSuffix)) {
         $this->_stagingCodeSuffix = (string) Mage::getConfig()->getNode(self::XML_PATH_STAGING_CODE_SUFFIX);
     }
     return $this->_stagingCodeSuffix;
 }
Example #13
0
 public function scheduledUpdateCurrencyRates($schedule)
 {
     $importWarnings = array();
     if (!Mage::getStoreConfig(self::IMPORT_ENABLE) || !Mage::getStoreConfig(self::CRON_STRING_PATH)) {
         return;
     }
     $service = Mage::getStoreConfig(self::IMPORT_SERVICE);
     if (!$service) {
         $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::helper('directory')->__('Invalid Import Service specified.');
     }
     try {
         $importModel = Mage::getModel(Mage::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray());
     } catch (Exception $e) {
         $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::throwException(Mage::helper('directory')->__('Unable to initialize the import model.'));
     }
     $rates = $importModel->fetchRates();
     $errors = $importModel->getMessages();
     if (sizeof($errors) > 0) {
         foreach ($errors as $error) {
             $importWarnings[] = Mage::helper('directory')->__('WARNING:') . ' ' . $error;
         }
     }
     if (sizeof($importWarnings) == 0) {
         Mage::getModel('directory/currency')->saveRates($rates);
     } else {
         $translate = Mage::getSingleton('core/translate');
         /* @var $translate Mage_Core_Model_Translate */
         $translate->setTranslateInline(false);
         /* @var $mailTemplate Mage_Core_Model_Email_Template */
         $mailTemplate = Mage::getModel('core/email_template');
         $mailTemplate->setDesignConfig(array('area' => 'frontend'))->sendTransactional(Mage::getStoreConfig(self::XML_PATH_ERROR_TEMPLATE), Mage::getStoreConfig(self::XML_PATH_ERROR_IDENTITY), Mage::getStoreConfig(self::XML_PATH_ERROR_RECIPIENT), null, array('warnings' => join("\n", $importWarnings)));
         $translate->setTranslateInline(true);
     }
 }
Example #14
0
 /**
  * Add order totals rendered to XML object
  * (get from template: sales/order/totals.phtml)
  *
  * @param Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj
  * @return null
  */
 public function addTotalsToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj)
 {
     // all Enterprise renderers from layout update into array an realize checking of their using
     $enterpriseBlocks = array('reward.sales.order.total' => array('module' => 'Enterprise_Reward', 'block' => 'enterprise_reward/sales_order_total'), 'customerbalance' => array('module' => 'Enterprise_CustomerBalance', 'block' => 'xmlconnect/customer_order_totals_customerbalance', 'template' => 'customerbalance/order/customerbalance.phtml'), 'customerbalance_total_refunded' => array('module' => 'Enterprise_CustomerBalance', 'block' => 'xmlconnect/customer_order_totals_customerbalance_refunded', 'template' => 'customerbalance/order/customerbalance_refunded.phtml', 'after' => '-', 'action' => array('method' => 'setAfterTotal', 'value' => 'grand_total')), 'giftwrapping' => array('module' => 'Enterprise_GiftWrapping', 'block' => 'enterprise_giftwrapping/sales_totals'), 'giftcards' => array('module' => 'Enterprise_GiftCardAccount', 'block' => 'xmlconnect/customer_order_totals_giftcards', 'template' => 'giftcardaccount/order/giftcards.phtml'));
     foreach ($enterpriseBlocks as $name => $block) {
         // create blocks only for Enterprise/Pro modules which is in system
         if (is_object(Mage::getConfig()->getNode('modules/' . $block['module']))) {
             $blockInstance = $this->getLayout()->createBlock($block['block'], $name);
             $this->setChild($name, $blockInstance);
             if (isset($block['action']['method']) && isset($block['action']['value'])) {
                 $method = $block['action']['method'];
                 $blockInstance->{$method}($block['action']['value']);
             }
         }
     }
     $this->_beforeToHtml();
     $totalsXml = $orderXmlObj->addChild('totals');
     foreach ($this->getTotals() as $total) {
         if ($total->getValue()) {
             $total->setValue(strip_tags($total->getValue()));
         }
         if ($total->getBlockName()) {
             $block = $this->getLayout()->getBlock($total->getBlockName());
             if (is_object($block)) {
                 if (method_exists($block, 'addToXmlObject')) {
                     $block->setTotal($total)->addToXmlObject($totalsXml);
                 } else {
                     $this->_addTotalToXml($total, $totalsXml);
                 }
             }
         } else {
             $this->_addTotalToXml($total, $totalsXml);
         }
     }
 }
Example #15
0
 public function getTable($name)
 {
     $ret = parent::getTable($name);
     $tablePrefix = (string) Mage::getConfig()->getTablePrefix();
     $ret = preg_replace('~^' . preg_quote($tablePrefix) . '~', '', $ret);
     return $ret;
 }
 public function getFields()
 {
     if (!$this->_fields) {
         $this->_fields = Mage::getConfig()->getFieldset('customer_dataflow', 'admin');
     }
     return $this->_fields;
 }
Example #17
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $this->_getHeaderHtml($element);
     $renderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
     $attributes = Mage::getConfig()->getNode(self::XML_PATH_IMAGE_TYPES)->asArray();
     foreach ($attributes as $key => $attribute) {
         /**
          * Watermark size field
          */
         $field = new Varien_Data_Form_Element_Text();
         $field->setName("groups[watermark][fields][{$key}_size][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Size for %s', $attribute['title']))->setRenderer($renderer);
         $html .= $field->toHtml();
         /**
          * Watermark upload field
          */
         $field = new Varien_Data_Form_Element_Imagefile();
         $field->setName("groups[watermark][fields][{$key}_image][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Watermark File for %s', $attribute['title']))->setRenderer($renderer);
         $html .= $field->toHtml();
         /**
          * Watermark position field
          */
         $field = new Varien_Data_Form_Element_Select();
         $field->setName("groups[watermark][fields][{$key}_position][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Position of Watermark for %s', $attribute['title']))->setRenderer($renderer)->setValues(Mage::getSingleton('adminhtml/system_config_source_catalog_product_watermark_position')->toOptionArray());
         $html .= $field->toHtml();
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
 /**
  * Disable all the defined modules for the scope
  *
  * @param mixed   $scope          Site scope
  * @param integer $scopeId        Site scope id
  * @param boolean $includeCommon  switch to disable bronto_common module
  * @param boolean $deleteChildren if true will delete config values for child scopes
  */
 public function disableModules($scope, $scopeId, $includeCommon = false, $deleteChildren = false)
 {
     if ($includeCommon) {
         Mage::helper(self::COMMON)->disableModule($scope, $scopeId, $deleteChildren);
     }
     Mage::helper(self::CUSTOMER)->disableModule($scope, $scopeId, $deleteChildren);
     Mage::helper(self::EMAIL)->disableModule($scope, $scopeId, $deleteChildren);
     Mage::helper(self::NEWSLETTER)->disableModule($scope, $scopeId, $deleteChildren);
     Mage::helper(self::ORDER)->disableModule($scope, $scopeId, $deleteChildren);
     Mage::helper(self::REMINDER)->disableModule($scope, $scopeId, $deleteChildren);
     Mage::helper(self::REVIEWS)->disableModule($scope, $scopeId, $deleteChildren);
     Mage::getConfig()->reinit();
     Mage::app()->reinitStores();
     // Get Child Items
     if ('website' == $scope) {
         $website = Mage::app()->getWebsite($scopeId);
         foreach ($website->getStoreIds() as $storeId) {
             $this->disableModules('store', $storeId, $includeCommon, true);
         }
     } elseif ('default' == $scope) {
         foreach (Mage::app()->getWebsites(false) as $website) {
             $this->disableModules('website', $website->getId(), $includeCommon, true);
         }
     }
 }
 public function __construct()
 {
     $config = Mage::getConfig()->getNode(self::JARLSSEN_UPLOADER_GLOBAL_CONFIG_XML_PATH);
     if (!empty($config)) {
         $this->_config = $config->asCanonicalArray();
     }
 }
Example #20
0
 /**
  * Load config from merged adminhtml.xml files
  */
 public function __construct()
 {
     parent::__construct();
     $this->setCacheId('adminhtml_acl_menu_config');
     /* @var $adminhtmlConfig Varien_Simplexml_Config */
     $adminhtmlConfig = Mage::app()->loadCache($this->getCacheId());
     if ($adminhtmlConfig) {
         $this->_adminhtmlConfig = new Varien_Simplexml_Config($adminhtmlConfig);
     } else {
         $adminhtmlConfig = new Varien_Simplexml_Config();
         $adminhtmlConfig->loadString('<?xml version="1.0"?><config></config>');
         Mage::getConfig()->loadModulesConfiguration('adminhtml.xml', $adminhtmlConfig);
         $this->_adminhtmlConfig = $adminhtmlConfig;
         /**
          * @deprecated after 1.4.0.0-alpha2
          * support backwards compatibility with config.xml
          */
         $aclConfig = Mage::getConfig()->getNode('adminhtml/acl');
         if ($aclConfig) {
             $adminhtmlConfig->getNode()->extendChild($aclConfig, true);
         }
         $menuConfig = Mage::getConfig()->getNode('adminhtml/menu');
         if ($menuConfig) {
             $adminhtmlConfig->getNode()->extendChild($menuConfig, true);
         }
         if (Mage::app()->useCache('config')) {
             Mage::app()->saveCache($adminhtmlConfig->getXmlString(), $this->getCacheId(), array(Mage_Core_Model_Config::CACHE_TAG));
         }
     }
 }
Example #21
0
 /**
  * Retrieve Default desplay Currency value for current scope
  *
  * @return string
  */
 protected function _getCurrencyDefault()
 {
     if (!($value = $this->getData('groups/options/fields/default/value'))) {
         $value = Mage::getConfig()->getNode(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT, $this->getScope(), $this->getScopeId());
     }
     return strval($value);
 }
Example #22
0
 /**
  * @param Varien_Event_Observer $o
  */
 public function saveConfig(Varien_Event_Observer $o)
 {
     $store = is_null($o->getEvent()->getStore()) ? 'default' : $o->getEvent()->getStore();
     if (!Mage::helper('mandrill')->useTransactionalService()) {
         $config = new Mage_Core_Model_Config();
         $config->saveConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE, false, "default", $store);
         Mage::getConfig()->cleanCache();
     }
     if (!Mage::helper('mandrill')->useTransactionalService()) {
         $config = new Mage_Core_Model_Config();
         $config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, false, "default", $store);
         Mage::getConfig()->cleanCache();
     }
     if (!Mage::getStoreConfig('customer/address/dob_show')) {
         $config = new Mage_Core_Model_Config();
         $config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, "default", $store);
         Mage::getConfig()->cleanCache();
     }
     if (!Mage::getStoreConfig('customer/address/dob_show', $store)) {
         $config = new Mage_Core_Model_Config();
         $config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, "default", $store);
         Mage::getConfig()->cleanCache();
     }
     if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Wishlist', $store)) {
         $config = new Mage_Core_Model_Config();
         $config->saveConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE, false, "default", $store);
         Mage::getConfig()->cleanCache();
     }
     if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Review', $store)) {
         $config = new Mage_Core_Model_Config();
         $config->saveConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE, false, "default", $store);
         Mage::getConfig()->cleanCache();
     }
 }
Example #23
0
 /**
  * Retrieve config
  *
  * @return Mage_Core_Model_Config_Element
  */
 public function getConfig()
 {
     if (!$this->_config) {
         $this->_config = Mage::getConfig()->getNode('global/mzax_emarketing/mediums/email/transporters');
     }
     return $this->_config;
 }
 /**
  * Add Name to select
  *
  * @return Mage_Customer_Model_Resource_Customer_Collection
  */
 public function addNameToSelect()
 {
     $fields = array();
     $customerAccount = Mage::getConfig()->getFieldset('customer_account');
     foreach ($customerAccount as $code => $node) {
         if ($node->is('name')) {
             $fields[$code] = $code;
         }
     }
     $adapter = $this->getConnection();
     $concatenate = array();
     if (isset($fields['prefix'])) {
         $concatenate[] = $adapter->getCheckSql('{{prefix}} IS NOT NULL AND {{prefix}} != \'\'', $adapter->getConcatSql(array('LTRIM(RTRIM({{prefix}}))', '\' \'')), '\'\'');
     }
     $concatenate[] = 'LTRIM(RTRIM({{firstname}}))';
     $concatenate[] = '\' \'';
     if (isset($fields['middlename'])) {
         $concatenate[] = $adapter->getCheckSql('{{middlename}} IS NOT NULL AND {{middlename}} != \'\'', $adapter->getConcatSql(array('LTRIM(RTRIM({{middlename}}))', '\' \'')), '\'\'');
     }
     $concatenate[] = 'LTRIM(RTRIM({{lastname}}))';
     if (isset($fields['suffix'])) {
         $concatenate[] = $adapter->getCheckSql('{{suffix}} IS NOT NULL AND {{suffix}} != \'\'', $adapter->getConcatSql(array('\' \'', 'LTRIM(RTRIM({{suffix}}))')), '\'\'');
     }
     $nameExpr = $adapter->getConcatSql($concatenate);
     $this->addExpressionAttributeToSelect('name', $nameExpr, $fields);
     return $this;
 }
Example #25
0
 public function getElementClass()
 {
     if (!$this->_elementClass) {
         $this->_elementClass = Mage::getConfig()->getModelClassName('core/layout_element');
     }
     return $this->_elementClass;
 }
 /**
  * Get a list of installed extensions.
  *
  * @return array
  */
 protected function _getInstalledExtensions()
 {
     if (!is_array($this->_installedExtensions)) {
         $this->_installedExtensions = (array) Mage::getConfig()->getNode('modules')->children();
     }
     return $this->_installedExtensions;
 }
Example #27
0
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = $this->_getHeaderHtml($element);
     $modules = Mage::getConfig()->getNode('modules')->children();
     $linkTitle = Mage::helper('codall')->__('Goto Extension Page');
     foreach ($modules as $moduleName => $values) {
         if (0 !== strpos($moduleName, 'Codnitive_')) {
             continue;
         }
         /*if($moduleName == 'Codnitive_Codall'){
         			continue;
         		}*/
         if ($values->title) {
             $moduleName = (string) $values->title;
         }
         if ($values->link) {
             $link = (string) $values->link;
             $moduleName = "<a href='{$link}' target='_blank' title='{$linkTitle}'>{$moduleName}</a>";
         }
         $field = $element->addField($moduleName, 'label', array('label' => $moduleName, 'value' => (string) $values->version));
         $html .= $field->toHtml();
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
 protected function _afterToHtml($html)
 {
     $html = parent::_afterToHtml($html);
     if ('product.info.options.configurable' == $this->getNameInLayout() && 'true' != (string) Mage::getConfig()->getNode('modules/Amasty_Stockstatus/active')) {
         $allProducts = $this->getProduct()->getTypeInstance(true)->getUsedProducts(null, $this->getProduct());
         $_attributes = $this->getProduct()->getTypeInstance(true)->getConfigurableAttributes($this->getProduct());
         foreach ($allProducts as $product) {
             $key = array();
             foreach ($_attributes as $attribute) {
                 $key[] = $product->getData($attribute->getData('product_attribute')->getData('attribute_code'));
             }
             $stockStatus = '';
             $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
             if (!$product->isInStock()) {
                 $stockStatus = Mage::helper('amxnotif')->__('Out of Stock');
             }
             if ($key) {
                 $aStockStatus[implode(',', $key)] = array('is_in_stock' => $product->isSaleable(), 'custom_status' => $stockStatus, 'is_qnt_0' => (int) ($product->isInStock() && $stockItem->getData('qty') <= 0), 'product_id' => $product->getId(), 'stockalert' => Mage::helper('amxnotif')->getStockAlert($product, $this->helper('customer')->isLoggedIn()));
             }
         }
         foreach ($aStockStatus as $k => $v) {
             if (!$v['is_in_stock'] && !$v['custom_status']) {
                 $v['custom_status'] = Mage::helper('amxnotif')->__('Out of Stock');
                 $aStockStatus[$k] = $v;
             }
         }
         $html = '<script type="text/javascript">var stStatus = new StockStatus(' . Zend_Json::encode($aStockStatus) . ');</script>' . $html;
     }
     return $html;
 }
Example #29
0
 public function __construct()
 {
     parent::__construct(Mage::getSingleton('core/resource')->getConnection('newsletter_read'));
     $this->_templateTable = Mage::getSingleton('core/resource')->getTableName('newsletter/template');
     $this->_select->from($this->_templateTable, array('template_id', 'template_code', 'template_type', 'template_subject', 'template_sender_name', 'template_sender_email', 'added_at', 'modified_at'));
     $this->setItemObjectClass(Mage::getConfig()->getModelClassName('newsletter/template'));
 }
Example #30
0
 public function autosetArchieveOrders()
 {
     $isOrderManagerEnabled = Mage::getStoreConfig('orderview/general/enabled');
     $isEnableArchieveOrders = Mage::getStoreConfig('orderview/order_arch_mng/enable_archieve');
     if (!$isOrderManagerEnabled || !$isEnableArchieveOrders) {
         return;
     }
     $write = Mage::getSingleton('core/resource')->getConnection('core_write');
     $statusArray = Mage::getStoreConfig('orderview/order_arch_mng/archive_orders_on_status');
     $statusArray = explode(",", $statusArray);
     $order_collection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', array('in' => $statusArray));
     $prefix = Mage::getConfig()->getTablePrefix();
     foreach ($order_collection as $order) {
         $orderId = $order->getEntityId();
         $order = Mage::getModel('sales/order')->load($orderId);
         $order->setIsArchieved(1);
         $order->save();
         $vals = array();
         $vals['is_archieved'] = 1;
         //	$where = $write->quoteInto('entity_id =?', $orderId);
         //	$write->update("sales_flat_order_grid", $vals ,$where);
         $gridTable = $prefix . 'sales_flat_order_grid';
         $condition = "update " . $gridTable . " SET `is_archieved` = 1 where entity_id = '" . $orderId . "'";
         $write->query($condition);
     }
 }