/** * Check whether redirect should be set * * @return Mage_Adminhtml_Model_System_Config_Backend_Admin_Custom */ protected function _beforeSave() { if ($this->getOldValue() != $this->getValue()) { Mage::register('custom_admin_path_redirect', true, true); } return $this; }
public function editAction() { $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('rewardpoints/pointrules'); if ($id) { $model->load($id); if (!$model->getRuleId()) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('rewardpoints')->__('This rule no longer exists')); $this->_redirect('*/*'); return; } } $data = Mage::getSingleton('adminhtml/session')->getPageData(true); //$data = $this->_filterDates($data, array('from_date', 'to_date')); if (!empty($data)) { $model->addData($data); } $model->getConditions()->setJsFormObject('pointrules_conditions_fieldset'); $model->setData('segments_cut', explode(';', $model->getSegmentsCut())); $model->setData('segments_paste', explode(';', $model->getSegmentsPaste())); Mage::register('pointrules_data', $model); $this->loadLayout(); $this->_setActiveMenu('rewardpoints'); $block = $this->getLayout()->createBlock('rewardpoints/adminhtml_pointrules_edit')->setData('action', $this->getUrl('*/rewardpoints_pointrules/save')); $this->getLayout()->getBlock('head')->setCanLoadExtJs(true)->setCanLoadRulesJs(true); $this->_addContent($block)->_addLeft($this->getLayout()->createBlock('rewardpoints/adminhtml_pointrules_edit_tabs'))->renderLayout(); }
/** * Edit Newsletter Template * */ public function editAction() { $model = Mage::getModel('newsletter/template'); if ($id = $this->getRequest()->getParam('id')) { $model->load($id); } Mage::register('_current_template', $model); $this->loadLayout(); $this->_setActiveMenu('newsletter/template'); if ($model->getId()) { $breadcrumbTitle = Mage::helper('newsletter')->__('Edit Template'); $breadcrumbLabel = $breadcrumbTitle; } else { $breadcrumbTitle = Mage::helper('newsletter')->__('New Template'); $breadcrumbLabel = Mage::helper('newsletter')->__('Create Newsletter Template'); } $this->_addBreadcrumb($breadcrumbLabel, $breadcrumbTitle); // restore data if ($values = $this->_getSession()->getData('newsletter_template_form_data', true)) { $model->addData($values); } if ($editBlock = $this->getLayout()->getBlock('template_edit')) { $editBlock->setEditMode($model->getId() > 0); } $this->renderLayout(); }
/** * Initialize requested category and put it into registry. * Root category can be returned, if inappropriate store/category is specified * * @param bool $getRootInstead * @return Mage_Catalog_Model_Category */ protected function _initCategory($getRootInstead = false) { $this->_title($this->__('Catalog'))->_title($this->__('Categories'))->_title($this->__('Manage Categories')); $categoryId = (int) $this->getRequest()->getParam('id', false); $storeId = (int) $this->getRequest()->getParam('store'); $category = Mage::getModel('catalog/category'); $category->setStoreId($storeId); if ($categoryId) { $category->load($categoryId); if ($storeId) { $rootId = Mage::app()->getStore($storeId)->getRootCategoryId(); if (!in_array($rootId, $category->getPathIds())) { // load root category instead wrong one if ($getRootInstead) { $category->load($rootId); } else { $this->_redirect('*/*/', array('_current' => true, 'id' => null)); return false; } } } } if ($activeTabId = (string) $this->getRequest()->getParam('active_tab_id')) { Mage::getSingleton('admin/session')->setActiveTabId($activeTabId); } Mage::register('category', $category); Mage::register('current_category', $category); Mage::getSingleton('cms/wysiwyg_config')->setStoreId($this->getRequest()->getParam('store')); return $category; }
public function viewAction() { if (!Mage::helper('magenotification')->checkLicenseKeyAdminController($this)) { return; } $id = $this->getRequest()->getParam('id'); $transaction = Mage::getModel('affiliateplus/transaction')->load($id); $this->_title($this->__('Affiliateplus'))->_title($this->__('Manage Transactions'))->_title($this->__($transaction->getAccountName())); if ($transaction->getId() || $id == 0) { $data = Mage::getSingleton('adminhtml/session')->getFormData(true); if (!empty($data)) { $transaction->setData($data); } Mage::register('transaction_data', $transaction); $this->loadLayout(); $this->_setActiveMenu('affiliateplus/transactions'); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Transaction Manager'), Mage::helper('adminhtml')->__('Transaction Manager')); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('New Transaction'), Mage::helper('adminhtml')->__('New Transaction')); $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); $this->_addContent($this->getLayout()->createBlock('affiliateplus/adminhtml_transaction_edit'))->_addLeft($this->getLayout()->createBlock('affiliateplus/adminhtml_transaction_edit_tabs')); $this->renderLayout(); } else { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('affiliateplus')->__('The transaction does not exist.')); $this->_redirect('*/*/'); } }
/** * view and edit item action */ public function editAction() { $pluginId = $this->getRequest()->getParam('id'); $plugin = Mage::getModel('usermanagement/plugin')->load($pluginId); if ($plugin->getId() || $pluginId == 0) { $data = Mage::getSingleton('adminhtml/session')->getFormData(true); if (!empty($data)) { $plugin->setData($data); } Mage::register('plugin_data', $plugin); $this->loadLayout(); $this->_setActiveMenu('usermanagement/plugin'); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Plugin Manager'), Mage::helper('adminhtml')->__('Plugin Manager')); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Plugin News'), Mage::helper('adminhtml')->__('Plugin News')); // set title in admin $this->_title($this->__('UserManagement'))->_title($this->__('Manage Plugins')); if ($pluginId == 0) { $this->_title($this->__('New Plugin')); } else { $this->_title($plugin->getData('plugin_name')); } //end $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); $this->_addContent($this->getLayout()->createBlock('usermanagement/adminhtml_plugin_edit'))->_addLeft($this->getLayout()->createBlock('usermanagement/adminhtml_plugin_edit_tabs')); $this->renderLayout(); } else { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('usermanagement')->__('Plugin does not exist')); $this->_redirect('*/*/'); } }
protected function _generateStoreCss($x0b, $x0d) { if (!Mage::app()->getStore($x0d)->getIsActive()) { return; } $x11 = '_' . $x0d; $x12 = $x0b . $x11 . '.css'; $x13 = Mage::helper('ultimo/cssgen')->getGeneratedCssDir() . $x12; $x14 = Mage::helper('ultimo/cssgen')->getTemplatePath() . $x0b . '.phtml'; Mage::register('cssgen_store', $x0d); try { $x15 = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($x14)->toHtml(); if (empty($x15)) { throw new Exception(Mage::helper('ultimo')->__("Template file is empty or doesn't exist: %s", $x14)); } $x16 = new Varien_Io_File(); $x16->setAllowCreateFolders(true); $x16->open(array('path' => Mage::helper('ultimo/cssgen')->getGeneratedCssDir())); $x16->streamOpen($x13, 'w+', 0777); $x16->streamLock(true); $x16->streamWrite($x15); $x16->streamUnlock(); $x16->streamClose(); } catch (Exception $x17) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ultimo')->__('Failed generating CSS file: %s in %s', $x12, Mage::helper('ultimo/cssgen')->getGeneratedCssDir()) . '<br/>Message: ' . $x17->getMessage()); Mage::logException($x17); } Mage::unregister('cssgen_store'); }
public function editAction() { $id = $this->getRequest()->getParam('id'); $data = Mage::getModel('kbase/category')->load($id)->getData(); $session = Mage::getSingleton('adminhtml/session'); if (isset($data['category_id']) || $id == 0) { $sessionData = $session->getKBaseCategoryData(true); $session->setKBaseCategoryData(false); if (is_array($sessionData)) { $data = array_merge($data, $sessionData); } // for compatibility with previous KB versions if (isset($data['category_url_key'])) { $data['category_url_key'] = urldecode($data['category_url_key']); } Mage::register('kbase_category', $data); $this->loadLayout(); $this->_setActiveMenu('kbase/category'); $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); $this->_addContent($this->getLayout()->createBlock('kbase/adminhtml_category_edit'))->_addLeft($this->getLayout()->createBlock('kbase/adminhtml_category_edit_tabs')); if ($id === null) { $this->_displayTitle('Add new category'); } else { $this->_displayTitle($this->__('Edit category #%d', $id)); } $this->renderLayout(); } else { $session->addError($this->__('Category does not exist')); $this->_redirect('*/*/'); } }
public function indexAction() { $this->loadLayout(); $customer = Mage::getSingleton('rewards/session')->getSessionCustomer(); Mage::register('customer', $customer); $this->renderLayout(); }
/** * Override field method to add js * * @param Varien_Data_Form_Element_Abstract $element * @return String */ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { // Get the default HTML for this option $html = parent::_getElementHtml($element); if (!Mage::registry('mColorPicker')) { $html .= ' <script type="text/javascript"> jQuery.fn.mColorPicker.init.replace = false; jQuery.fn.mColorPicker.init.enhancedSwatches = false; jQuery.fn.mColorPicker.init.allowTransparency = true; jQuery.fn.mColorPicker.init.showLogo = false; jQuery.fn.mColorPicker.defaults.imageFolder = "' . $this->getJsUrl('shopshark/mColorPicker/') . '"; </script> '; Mage::register('mColorPicker', 1); } $html .= ' <script type="text/javascript"> jQuery(function($){ $("#' . $element->getHtmlId() . '").width("200px").attr("data-hex", true).mColorPicker(); }); </script> '; return $html; }
public function editAction() { $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('managelicense/managelicense')->load($id); if ($model->getStatus() == 2) { $domain = $model->getMagentoUrl(); $extension = $model->getExtension(); $rendkey = Mage::helper('managelicense')->getKey($extension, $domain); $model->setKeyActive($rendkey); } else { $model->setKeyActive(""); } if ($model->getId() || $id == 0) { $data = Mage::getSingleton('adminhtml/session')->getFormData(true); if (!empty($data)) { $model->setData($data); } Mage::register('managelicense_data', $model); $this->loadLayout(); $this->_setActiveMenu('managelicense/items'); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager')); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News')); $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); $this->_addContent($this->getLayout()->createBlock('managelicense/adminhtml_managelicense_edit'))->_addLeft($this->getLayout()->createBlock('managelicense/adminhtml_managelicense_edit_tabs')); $this->renderLayout(); } else { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('managelicense')->__('Item does not exist')); $this->_redirect('*/*/'); } }
/** * Init currency by currency code from request * * @return Mage_Adminhtml_Controller_Action */ protected function _initCurrency() { $code = $this->getRequest()->getParam('currency'); $currency = Mage::getModel('directory/currency')->load($code); Mage::register('currency', $currency); return $this; }
/** * Prepare html for layer & product list block (catalog layer) * */ public function viewAction() { $categoryId = Mage::app()->getRequest()->getParam('id'); $currLayout = Mage::app()->getRequest()->getParam('curr'); $category = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($categoryId); if (!$category->getId()) { return; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { Mage::register('current_category', $category); $this->loadLayout('default'); $this->getLayout()->getBlock('root')->setTemplate($currLayout); $result = array(); $result['layer'] = $this->getLayout()->getBlock('em.catalog.leftnav')->toHtml(); $result['products'] = $this->getLayout()->getBlock('product_list')->toHtml(); $result['breadcrumbs'] = $this->getLayout()->getBlock('breadcrumbs')->toHtml(); if ($catId = $this->getRequest()->getParam('cat')) { $curCat = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($catId); } else { $curCat = $category; } $result['cat_title'] = $curCat->getName(); if ($_description = $curCat->getDescription()) { $result['cat_desc'] = Mage::helper('catalog/output')->categoryAttribute($curCat, $_description, 'description'); } $this->getResponse()->setHeader('Content-type', 'application/json'); $this->getResponse()->setBody(json_encode($result)); } else { $this->_redirectReferer(); } }
/** * Print specified block for its layout handle without the ESI tag */ public function esiAction() { if (!$this->getRequest()->getHeader('Cookie')) { // Skip writing the session (when using the Redis session backend) // is there is no cookie header present. We still need to render // the default blocks Mage::register('skip_session_write', 1); } $layoutHandles = explode(',', base64_decode($this->getRequest()->getParam('layout'))); $blockName = base64_decode($this->getRequest()->getParam('block')); $misc = unserialize(base64_decode($this->getRequest()->getParam('misc'))); if (is_array($misc)) { if (isset($misc['product'])) { $product = Mage::getModel('catalog/product')->load($misc['product']); Mage::register('product', $product); } } $layout = $this->getLayout(); $update = $layout->getUpdate(); $update->load($layoutHandles); $layout->generateXml(); $blockNodes = $layout->getNode()->xpath('//*[@name="' . $blockName . '"]'); if (!empty($blockNodes)) { foreach ($blockNodes as $node) { $layout->generateBlocks($node, true); } $block = $layout->getBlock($blockName)->setEsi(0); $cacheModifiers = Mage::helper('cache')->getBlockModifiers($block); $block->setCacheModifiers(join(' ', $cacheModifiers)); $sessionId = Mage::getSingleton('core/session')->getSessionId(); $this->getResponse()->setHeader('X-Session-UUID', $sessionId); $this->getResponse()->setBody($block->toHtml()); } }
/** * Create Backup * * @return Mage_Log_Model_Cron */ public function scheduledBackup() { if (!Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_ENABLED)) { return $this; } if (Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) { Mage::helper('backup')->turnOnMaintenanceMode(); } $type = Mage::getStoreConfig(self::XML_PATH_BACKUP_TYPE); $this->_errors = array(); try { $backupManager = Mage_Backup::getBackupInstance($type)->setBackupExtension(Mage::helper('backup')->getExtensionByType($type))->setTime(time())->setBackupsDir(Mage::helper('backup')->getBackupsDir()); Mage::register('backup_manager', $backupManager); if ($type != Mage_Backup_Helper_Data::TYPE_DB) { $backupManager->setRootDir(Mage::getBaseDir())->addIgnorePaths(Mage::helper('backup')->getBackupIgnorePaths()); } $backupManager->create(); Mage::log(Mage::helper('backup')->getCreateSuccessMessageByType($type)); } catch (Exception $e) { $this->_errors[] = $e->getMessage(); $this->_errors[] = $e->getTrace(); Mage::log($e->getMessage(), Zend_Log::ERR); Mage::logException($e); } if (Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) { Mage::helper('backup')->turnOffMaintenanceMode(); } return $this; }
public function indexAction() { // init category $categoryId = (int) Mage::app()->getStore()->getRootCategoryId(); if (!$categoryId) { $this->_forward('noRoute'); return; } $category = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($categoryId); Mage::register('current_category', $category); Mage::getSingleton('catalog/session')->setLastVisitedCategoryId($category->getId()); // need to prepare layer params try { Mage::dispatchEvent('catalog_controller_category_init_after', array('category' => $category, 'controller_action' => $this)); } catch (Mage_Core_Exception $e) { Mage::logException($e); return; } // observer can change value if (!$category->getId()) { $this->_forward('noRoute'); return; } $this->loadLayout(); $this->checkAddRwdBlocks(); $this->renderLayout(); }
public function editAction() { $this->_title($this->__('Catalog'))->_title($this->__('Search Terms')); $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('Mage_CatalogSearch_Model_Query'); if ($id) { $model->load($id); if (!$model->getId()) { Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Catalog_Helper_Data')->__('This search no longer exists.')); $this->_redirect('*/*'); return; } } // set entered data if was error when we do save $data = Mage::getSingleton('Mage_Adminhtml_Model_Session')->getPageData(true); if (!empty($data)) { $model->addData($data); } Mage::register('current_catalog_search', $model); $this->_initAction(); $this->_title($id ? $model->getQueryText() : $this->__('New Search')); $this->getLayout()->getBlock('head')->setCanLoadRulesJs(true); $this->getLayout()->getBlock('adminhtml.catalog.search.edit')->setData('action', $this->getUrl('*/catalog_search/save')); $this->_addBreadcrumb($id ? Mage::helper('Mage_Catalog_Helper_Data')->__('Edit Search') : Mage::helper('Mage_Catalog_Helper_Data')->__('New Search'), $id ? Mage::helper('Mage_Catalog_Helper_Data')->__('Edit Search') : Mage::helper('Mage_Catalog_Helper_Data')->__('New Search')); $this->renderLayout(); }
public function indexAction() { // make it compatible with aheadworks help desk if (strstr($this->getFullActionName(), "contacts") && (Mage::getStoreConfig('helpdeskultimate/modules/cf_enabled') || !Mage::getStoreConfig('webforms/contacts/enable'))) { parent::indexAction(); return; } Mage::register('show_form_name', true); $this->loadLayout(); if (Mage::getStoreConfig('webforms/contacts/enable') && $this->getFullActionName() == 'contacts_index_index') { // remove default contacts $this->getLayout()->getBlock('contactForm')->setTemplate(false); // remove aheadworks antibot $aw_antibot = $this->getLayout()->getBlock('antibot'); if ($aw_antibot) { $aw_antibot->setTemplate(false); } // add web-form to the layout $block = $this->getLayout()->createBlock('webforms/webforms', 'webforms', array('template' => 'webforms/default.phtml', 'webform_id' => Mage::getStoreConfig('webforms/contacts/webform'))); $this->getLayout()->getBlock('content')->append($block); } $this->_initLayoutMessages('customer/session'); $this->_initLayoutMessages('catalog/session'); $this->renderLayout(); }
public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse(); exit; } $identifier = trim($request->getPathInfo(), '/'); /* @var $parser Hackathon_Layeredlanding_Model_Layeredlanding */ $landingPage = Mage::getModel('layeredlanding/layeredlanding')->loadByUrl($identifier); if (!$landingPage->getId()) { return false; } Mage::register('current_landingpage', $landingPage); Mage::app()->getStore()->setConfig(Mage_Catalog_Helper_Category::XML_PATH_USE_CATEGORY_CANONICAL_TAG, 0); // disable canonical tag // if successfully gained url parameters, use them and dispatch ActionController action $categoryIdsValue = $landingPage->getCategoryIds(); $categoryIds = explode(',', $categoryIdsValue); $firstCategoryId = $categoryIds[0]; $request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $firstCategoryId); /** @var $attribute Hackathon_Layeredlanding_Model_Attributes */ foreach ($landingPage->getAttributes() as $attribute) { $attr = Mage::getModel('eav/entity_attribute')->load($attribute->getAttributeId()); $request->setParam($attr->getAttributeCode(), $attribute->getValue()); } $controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category'); $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse()); $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier); // dispatch action $request->setDispatched(true); $controllerInstance->dispatch('view'); return true; }
public function editAction() { if ((double) substr(Mage::getVersion(), 0, 3) > 1.3) { $this->_title($this->__('Web-forms'))->_title($this->__('Edit Field')); } $fieldsId = $this->getRequest()->getParam('id'); $webformsId = $this->getRequest()->getParam('webform_id'); $store = $this->getRequest()->getParam('store'); $field = Mage::getModel('webforms/fields')->setStoreId($store)->load($fieldsId); if ($field->getWebformId()) { $webformsId = $field->getWebformId(); } $webformsModel = Mage::getModel('webforms/webforms')->setStoreId($store)->load($webformsId); if ($field->getId() || $fieldsId == 0) { Mage::register('webforms_data', $webformsModel); Mage::register('field', $field); $this->loadLayout(); $this->_setActiveMenu('webforms/webforms'); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('WebForms'), Mage::helper('adminhtml')->__('Web-forms')); $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); $this->_addContent($this->getLayout()->createBlock('webforms/adminhtml_fields_edit'))->_addLeft($this->getLayout()->createBlock('webforms/adminhtml_fields_edit_tabs')); $this->renderLayout(); } else { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('webforms')->__('Field does not exist')); $this->_redirect('*/adminhtml_webforms/edit', array('id' => $webformsId)); } }
public function editAction() { $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('megamenupro/megamenupro')->load($id); if ($model->getId() || $id == 0) { $data = Mage::getSingleton('adminhtml/session')->getFormData(true); if (!empty($data)) { $model->setData($data); } //echo '<pre>';print_r($model);exit; Mage::register('megamenupro_data', $model); $this->loadLayout(); $this->_setActiveMenu('emthemes/items'); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager')); $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News')); $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); $this->_addContent($this->getLayout()->createBlock('megamenupro/adminhtml_menueditor_edit')); if (!$model->getId()) { $this->_addLeft($this->getLayout()->createBlock('megamenupro/adminhtml_mnueditor_edit_tabs')); } $this->renderLayout(); } else { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('megamenupro')->__('Item does not exist')); $this->_redirect('*/*/'); } }
public function editAction() { $this->_title($this->__('Promotions'))->_title($this->__('Catalog Price Rules')); $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('catalogrule/rule'); if ($id) { $model->load($id); if (!$model->getRuleId()) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalogrule')->__('This rule no longer exists.')); $this->_redirect('*/*'); return; } } $this->_title($model->getRuleId() ? $model->getName() : $this->__('New Rule')); // set entered data if was error when we do save $data = Mage::getSingleton('adminhtml/session')->getPageData(true); if (!empty($data)) { $model->addData($data); } $model->getConditions()->setJsFormObject('rule_conditions_fieldset'); Mage::register('current_promo_catalog_rule', $model); $this->_initAction()->getLayout()->getBlock('promo_catalog_edit')->setData('action', $this->getUrl('*/promo_catalog/save')); $breadcrumb = $id ? Mage::helper('catalogrule')->__('Edit Rule') : Mage::helper('catalogrule')->__('New Rule'); $this->_addBreadcrumb($breadcrumb, $breadcrumb)->renderLayout(); }
public function ajaxAction() { $idItem = Mage::app()->getRequest()->getParam('idItem'); Mage::register('current_log', Mage::getModel('amaudit/log')->load($idItem)); $block = $this->getLayout()->createBlock('amaudit/adminhtml_userlog_edit_tab_view_details'); $this->getResponse()->setBody($block->toHtml()); }
public function viewAction() { // @todo: add validation if products from orders belongs to the supplier $id = $this->getRequest()->getParam('id'); Mage::register('order_id', $id); $this->_renderBlocks(); }
public function newAction() { if (!Mage::helper("ves_blockbuilder")->checkModuleInstalled("Ves_Base")) { Mage::getSingleton("adminhtml/session")->addError(Mage::helper("ves_blockbuilder")->__("The module required Ves_Base module was installed. Please install and active the module Ves_Base.")); $this->_redirect("*/*/"); return; } $this->_title($this->__("Manage Css Selector Elements")); $this->_title($this->__("Selector")); $this->_title($this->__("New Item")); $id = $this->getRequest()->getParam("id"); $model = Mage::getModel("ves_blockbuilder/selector")->load($id); $data = Mage::getSingleton("adminhtml/session")->getFormData(true); if (!empty($data)) { $model->setData($data); } Mage::register("selector_data", $model); $this->loadLayout(); $this->_setActiveMenu("ves_blockbuilder/blockbuilder"); $this->getLayout()->getBlock("head")->setCanLoadExtJs(true); $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Manage Css Selector Elements"), Mage::helper("adminhtml")->__("Manage Css Selector Elements")); $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Manage Css Selector Elements"), Mage::helper("adminhtml")->__("Manage Css Selector Elements")); $this->_addContent($this->getLayout()->createBlock("ves_blockbuilder/adminhtml_selector_edit"))->_addLeft($this->getLayout()->createBlock("ves_blockbuilder/adminhtml_selector_edit_tabs")); $this->getLayout()->getBlock("head")->setCanLoadExtJs(true); if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) { $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); } if ($head = $this->getLayout()->getBlock('head')) { $head->addItem('js', 'prototype/window.js')->addItem('js_css', 'prototype/windows/themes/default.css')->addCss('lib/prototype/windows/themes/magento.css')->addItem('js', 'mage/adminhtml/variables.js')->addItem('js', 'lib/flex.js')->addItem('js', 'lib/FABridge.js')->addItem('js', 'mage/adminhtml/flexuploader.js')->addItem('js', 'mage/adminhtml/browser.js'); } $this->renderLayout(); }
protected function generateStoreCss($type, $storeCode) { if (!Mage::app()->getStore($storeCode)->getIsActive()) { return; } $str1 = '_' . $storeCode; $str2 = $type . $str1 . '.css'; $str3 = Mage::helper('mango/cssconfig')->getCssConfigDir() . $str2; $str4 = 'mango/css/' . $type . '.phtml'; Mage::register('cssgen_store', $storeCode); try { $block = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($str4)->toHtml(); if (empty($block)) { throw new Exception(Mage::helper('mango')->__("Template file is empty or doesn't exist: %s", $str4)); } $file = new Varien_Io_File(); $file->setAllowCreateFolders(true); $file->open(array('path' => Mage::helper('mango/cssconfig')->getCssConfigDir())); $file->streamOpen($str3, 'w+'); $file->streamLock(true); $file->streamWrite($block); $file->streamUnlock(); $file->streamClose(); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mango')->__('Failed generating CSS file: %s in %s', $str2, Mage::helper('mango/cssconfig')->getCssConfigDir()) . '<br/>Message: ' . $e->getMessage()); Mage::logException($e); } Mage::unregister('cssgen_store'); }
/** * Get product input types as option array * * @return array */ public function toOptionArray() { $inputTypes = array(array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image'))); $response = new Varien_Object(); $response->setTypes(array()); Mage::dispatchEvent('adminhtml_product_attribute_types', array('response' => $response)); $_disabledTypes = array(); $_hiddenFields = array(); foreach ($response->getTypes() as $type) { $inputTypes[] = $type; if (isset($type['hide_fields'])) { $_hiddenFields[$type['value']] = $type['hide_fields']; } if (isset($type['disabled_types'])) { $_disabledTypes[$type['value']] = $type['disabled_types']; } } if (Mage::registry('attribute_type_hidden_fields') === null) { Mage::register('attribute_type_hidden_fields', $_hiddenFields); } if (Mage::registry('attribute_type_disabled_types') === null) { Mage::register('attribute_type_disabled_types', $_disabledTypes); } return array_merge(parent::toOptionArray(), $inputTypes); }
public function editAction() { $id = $this->getRequest()->getParam('attribute_id'); $model = Mage::getModel('catalog/resource_eav_attribute')->setEntityTypeId($this->_entityTypeId); if ($id) { $model->load($id); if (!$model->getId()) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('This attribute no longer exists')); $this->_redirect('*/*/'); return; } // entity type check if ($model->getEntityTypeId() != $this->_entityTypeId) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('This attribute cannot be edited.')); $this->_redirect('*/*/'); return; } } // set entered data if was error when we do save $data = Mage::getSingleton('adminhtml/session')->getAttributeData(true); if (!empty($data)) { $model->addData($data); } Mage::register('entity_attribute', $model); $this->_initAction(); $this->_title($id ? $model->getName() : $this->__('New Attribute')); $item = $id ? Mage::helper('catalog')->__('Edit Product Attribute') : Mage::helper('catalog')->__('New Product Attribute'); $this->_addBreadcrumb($item, $item); $this->getLayout()->getBlock('attribute_edit_js')->setIsPopup((bool) $this->getRequest()->getParam('popup')); $this->renderLayout(); }
public function editAction() { $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('megamenu/parent')->load($id); if ($model->getId() || $id == 0) { $data = Mage::getSingleton('adminhtml/session')->getFormData(true); if (!empty($data)) { $model->setData($data); } Mage::register('parent_data', $model); $this->loadLayout(); $this->_setActiveMenu('mgscore/megamenu/parent'); $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); if ($model->getTitle()) { $this->getLayout()->getBlock('head')->setTitle($this->__('%s / Megamenu', $model->getTitle())); } else { $this->getLayout()->getBlock('head')->setTitle($this->__('New Megamenu')); } $this->_addContent($this->getLayout()->createBlock('megamenu/adminhtml_parent_edit'))->_addLeft($this->getLayout()->createBlock('megamenu/adminhtml_parent_edit_tabs')); $this->renderLayout(); } else { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('megamenu')->__('Item does not exist')); $this->_redirect('*/*/'); } }
public function editAction() { $this->_title($this->__('Slideshow'))->_title($this->__('Slides'))->_title($this->__('Manage Content')); // 1. Get ID and create model $id = $this->getRequest()->getParam('slideshow_id'); $model = Mage::getModel('slideshow/slideshow'); // 2. Initial checking if ($id) { $model->load($id); if (!$model->getId()) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slideshow')->__('This slide no longer exists.')); $this->_redirect('*/*/'); return; } } $this->_title($model->getId() ? $model->getTitle() : $this->__('New Slide')); // 3. Set entered data if was error when we do save $data = Mage::getSingleton('adminhtml/session')->getFormData(true); if (!empty($data)) { $model->setData($data); } // 4. Register model to use later in blocks Mage::register('slideshow', $model); // 5. Build edit form $this->_initAction()->_addBreadcrumb($id ? Mage::helper('slideshow')->__('Edit Slide') : Mage::helper('slideshow')->__('New Slide'), $id ? Mage::helper('slideshow')->__('Edit Slide') : Mage::helper('slideshow')->__('New Slide')); $this->renderLayout(); }