/** * Ensure that the a database connection exists * If not, do load the route * * @return $this */ public function preDispatch() { if (Mage::registry('wordpress_controller')) { Mage::unregister('wordpress_controller'); } Mage::register('wordpress_controller', $this); parent::preDispatch(); try { if (!$this->_canRunUsingConfig()) { $this->_forceForwardViaException('noRoute'); return; } if ($this->getRequest()->getParam('feed_type')) { $this->getRequest()->setParam('feed', $this->getRequest()->getParam('feed_type')); // Legacy fix if (strpos(strtolower($this->getRequest()->getActionName()), 'feed') === false) { $this->_forceForwardViaException('feed'); return; } } } catch (Mage_Core_Controller_Varien_Exception $e) { throw $e; } catch (Exception $e) { Mage::helper('wordpress')->log($e->getMessage()); $this->_forceForwardViaException('noRoute'); return; } // Check for redirects and forwards $transport = new Varien_Object(); Mage::dispatchEvent('wordpress_' . strtolower(substr(get_class($this), strlen('Fishpig_Wordpress_'), -strlen('Controller'))) . '_controller_pre_dispatch_after', array('transport' => $transport, 'action' => $this)); if ($transport->getForward()) { return $this->_forward($transport->getForward()->getAction(), $transport->getForward()->getController(), $transport->getForward()->getModule()); } return $this; }
public function tearDown() { Mage::unregister('current_recurring_profile'); $this->_profile = null; $this->_block = null; $this->_layout = null; }
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'); }
/** * Preparing layout * * @return Mage_Catalog_Block_Breadcrumbs */ protected function _prepareLayout() { if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) { $breadcrumbsBlock->addCrumb('home', array('label' => Mage::helper('catalog')->__('Home'), 'title' => Mage::helper('catalog')->__('Go to Home Page'), 'link' => Mage::getBaseUrl())); // MOD to add the full category breadcrumb path. //$current_category = Mage::registry('current_category'); $current_category = Null; // Always get the all categories to get the full path $current_product = Mage::registry('current_product'); if (!$current_category && $current_product) { $categories = $current_product->getCategoryCollection()->addAttributeToSelect('name'); //$categories = $current_product->getCategoryCollection()->addAttributeToSelect('name')->setPageSize(1); foreach ($categories as $category) { Mage::unregister('current_category'); Mage::register('current_category', $category); } } // end MOD $title = array(); $path = Mage::helper('catalog')->getBreadcrumbPath(); foreach ($path as $name => $breadcrumb) { $breadcrumbsBlock->addCrumb($name, $breadcrumb); $title[] = $breadcrumb['label']; } if ($headBlock = $this->getLayout()->getBlock('head')) { $headBlock->setTitle(join($this->getTitleSeparator(), array_reverse($title))); } } return parent::_prepareLayout(); }
public function reset() { $this->_session->clear(); Mage::unregister('_singleton/adminhtml/session_quote'); $this->_session = Mage::getSingleton('adminhtml/session_quote'); return $this; }
/** * @param $storeId */ protected function _proccess($storeId) { //Mage::app()->setCurrentStore($storeId); Mage::unregister('_singleton/core/design_package'); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); Mage::getSingleton('core/design_package')->setStore($storeId); $adapter = Mage::getSingleton('core/resource')->getConnection('sales_read'); $this->days = array(0 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_1, $storeId), 1 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_2, $storeId), 2 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_3, $storeId), 3 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_4, $storeId), 4 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_5, $storeId)); $this->maxtimes = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $storeId) + 1; $this->sendcoupon = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $storeId); $this->firstdate = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_DATE, $storeId); $this->unit = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::UNIT, $storeId); $this->customergroups = explode(",", Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::CUSTOMER_GROUPS, $storeId)); $this->mandrillTag = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MANDRILL_TAG, $storeId) . "_{$storeId}"; //coupon vars $this->couponamount = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_AMOUNT, $storeId); $this->couponexpiredays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_EXPIRE, $storeId); $this->coupontype = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_TYPE, $storeId); $this->couponlength = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_LENGTH, $storeId); $this->couponlabel = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_LABEL, $storeId); // iterates one time for each mail number for ($run = 0; $run < $this->maxtimes; $run++) { if (!$this->days[$run]) { return; } $this->_processRun($adapter, $run, $storeId); } }
protected function tearDown() { parent::tearDown(); // unregister observer Mage::unregister('_singleton/fpc/observer'); Mage::getSingleton('customer/session')->setData(Lesti_Fpc_Helper_Block::LAZY_BLOCKS_VALID_SESSION_PARAM, false); }
protected function _generateStoreCss($type, $storeCode) { if (!Mage::app()->getStore($storeCode)->getIsActive()) { return false; } $fileName = $type . '_' . $storeCode . '.css'; $file = Mage::helper('legenda/config')->getGeneratedCssDir() . $fileName; $templateFile = 'smartwave/legenda/css/' . $type . '.phtml'; Mage::register('legenda_css_generate_store', $storeCode); try { $tempalte = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($templateFile)->toHtml(); if (empty($tempalte)) { throw new Exception(Mage::helper('legenda')->__("Template file is empty or doesn't exist: %s", $templateFile)); return false; } $io = new Varien_Io_File(); $io->setAllowCreateFolders(true); $io->open(array('path' => Mage::helper('legenda/config')->getGeneratedCssDir())); $io->streamOpen($file, 'w+'); $io->streamLock(true); $io->streamWrite($tempalte); $io->streamUnlock(); $io->streamClose(); } catch (Exception $exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('legenda')->__('Failed generating CSS file: %s in %s', $fileName, Mage::helper('legenda/config')->getGeneratedCssDir()) . '<br/>Message: ' . $exception->getMessage()); Mage::logException($exception); return false; } Mage::unregister('legenda_css_generate_store'); return true; }
/** * Render block content * * @return string */ protected function _renderBlock() { $productId = $this->_getProductId(); /** @var $product null|Mage_Catalog_Model_Product */ $product = null; if ($productId) { $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($productId); if ($product) { Mage::register('current_product', $product); } } $categoryId = $this->_getCategoryId(); if ($product !== null && !$product->canBeShowInCategory($categoryId)) { $categoryId = null; Mage::unregister('current_category'); } if ($categoryId && !Mage::registry('current_category')) { $category = Mage::getModel('catalog/category')->load($categoryId); if ($category) { Mage::register('current_category', $category); } } //No need breadcrumbs on CMS pages if (!$productId && !$categoryId) { return ''; } $breadcrumbsBlock = $this->_getPlaceHolderBlock(); $breadcrumbsBlock->setNameInLayout('breadcrumbs'); Mage::dispatchEvent('render_block', array('block' => $breadcrumbsBlock, 'placeholder' => $this->_placeholder)); return $breadcrumbsBlock->toHtml(); }
/** * Runs the WebApplication * * @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The request instance * * @return string The web applications content */ public function run(HttpServletRequestInterface $servletRequest) { try { // cleanup mage registry foreach ($this->registryCleanKeys as $registryCleanKey) { \Mage::unregister($registryCleanKey); } error_log("Successfully reset Magento"); // set headers sent to false and start output caching appserver_set_headers_sent(false); ob_start(); // reset and run Magento $appRequest = new \Mage_Core_Controller_Request_Http(); $appResponse = new \Mage_Core_Controller_Response_Http(); $appRequest->setRequestUri(); error_log("Set request URI: " . $_SERVER['REQUEST_URI']); $this->app->setRequest($appRequest); $this->app->setResponse($appResponse); // store or website code $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; // run store or run website $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; $this->app->run(array('scope_code' => $mageRunCode, 'scope_type' => $mageRunType, 'options' => array())); // write the session back after the request session_write_close(); // We need to init the session anew, so PHP session handling will work like it would in a clean environment appserver_session_init(); // grab the contents generated by Magento $content = ob_get_clean(); } catch (\Exception $e) { error_log($content = $e->__toString()); } // return the content return $content; }
/** * @param Varien_Object $_row * @return string */ public function render(Varien_Object $_row) { $this->setOrder($_row); $_shipmentCollectionAll = Mage::getResourceModel('sales/order_shipment_collection')->addFieldToFilter('order_id', array('eq' => $_row->getEntityId())); $_shipmentCollection = Mage::getResourceModel('payperrentals/sendreturn_collection')->addFieldToFilter('order_id', array('in' => array($_row->getEntityId(), $_row->getIncrementId()))); $_totalQtyShipped = 0; $_shippedDate = ''; $_shippedUnixtimeDate = 0; foreach ($_shipmentCollection as $_shipmentItem) { if ($_shipmentItem->getSendDate() != '0000-00-00 00:00:00' && $_shipmentItem->getSendDate() != '1970-01-01 00:00:00') { $_totalQtyShipped += $_shipmentItem->getQty(); } } $_totalQtyShippedAll = 0; foreach ($_shipmentCollectionAll as $_shipmentItem) { $_totalQtyShippedAll += $_shipmentItem->getTotalQty(); if ($_shippedUnixtimeDate < strtotime($_shipmentItem->getCreatedAt())) { $_shippedDate = $_shipmentItem->getCreatedAt(); $_shippedUnixtimeDate = strtotime($_shipmentItem->getCreatedAt()); } } Mage::unregister('total_qty_shipped'); Mage::register('total_qty_shipped', $_totalQtyShipped); /*$_totalQtyShipped = $this->_getValue($_row);*/ $_realOrder = Mage::getModel('sales/order')->load($_row->getId()); $_totalQtyOrdered = (int) $_realOrder->getTotalQtyOrdered(); $_shipButtonHtml = $this->_getShipButtonHtml(); if (!$_totalQtyShippedAll) { return Mage::helper('payperrentals')->__('Not Shipped') . '<br/>' . $_shipButtonHtml; } elseif ($_totalQtyShippedAll < $_totalQtyOrdered) { return Mage::helper('payperrentals')->__('Partially Shipped') . '<br/>' . $_shipButtonHtml; } else { return ITwebexperts_Payperrentals_Helper_Date::formatDbDate($_shippedDate, true, true); } }
protected function _resetCategoryFilter($category) { Mage::unregister('current_category'); if ($category) { Mage::register('current_category', $category); } }
protected function _initProduct() { $id = $this->getRequest()->getParam('id'); $product = Mage::getModel('catalog/product')->load($id); Mage::unregister('current_product'); Mage::register('current_product', $product); }
/** * Collect and get shipping rates * * @param Mage_Shipping_Model_Rate_Request $request * @return bool|false|Mage_Core_Model_Abstract|Mage_Shipping_Model_Rate_Result|null */ public function collectRates(Mage_Shipping_Model_Rate_Request $request) { if (!$this->getConfigFlag('active')) { return false; } // Check if the rates were requested by ChannelEngine and not by the frontend if (!Mage::registry('channelengine_shipping')) { return false; } Mage::unregister('channelengine_shipping'); $result = Mage::getModel('shipping/rate_result'); $shippingPrice = 0; if (Mage::registry('channelengine_shipping_amount')) { $shippingPrice = Mage::registry('channelengine_shipping_amount'); } Mage::unregister('channelengine_shipping_amount'); $method = Mage::getModel('shipping/rate_result_method'); $method->setCarrier($this->_code); $method->setCarrierTitle($this->getConfigData('title')); $method->setMethod($this->_code); $method->setMethodTitle($this->getConfigData('name')); $method->setPrice($shippingPrice); $method->setCost($shippingPrice); $result->append($method); return $result; }
protected function _generateStoreCss($design, $storeCode) { if (!Mage::app()->getStore($storeCode)->getIsActive()) { return; } $prefix = '_' . $storeCode; if ($design == 'layout') { $filename = $design . $prefix . '.css'; } else { $filename = $design . $prefix . '.less'; } $filedefault = Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir() . $filename; $path = 'dgtthemes/dgtyaris/css/' . $design . '.phtml'; Mage::register('cssgen_store', $storeCode); try { $block = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($path)->toHtml(); if (empty($block)) { throw new Exception(Mage::helper('dgtyaris')->__("Template file is empty or doesn't exist: %s", $path)); } $file = new Varien_Io_File(); $file->setAllowCreateFolders(true); $file->open(array('path' => Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir())); $file->streamOpen($filedefault, 'w+'); $file->streamLock(true); $file->streamWrite($block); $file->streamUnlock(); $file->streamClose(); } catch (Exception $gener) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dgtyaris')->__('Failed generating CSS file: %s in %s', $filename, Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir()) . '<br/>Message: ' . $gener->getMessage()); Mage::logException($gener); } Mage::unregister('cssgen_store'); }
/** * Returns the campaigns options. * * @return array * @throws Mage_Core_Exception */ public function toOptionArray() { $fields = array(); $websiteName = Mage::app()->getRequest()->getParam('website', false); $website = Mage::app()->getRequest()->getParam('website', false); if ($website) { $website = Mage::app()->getWebsite($website); } else { $website = 0; } $fields[] = array('value' => '0', 'label' => Mage::helper('ddg')->__('-- Please Select --')); if ($websiteName) { $website = Mage::app()->getWebsite($websiteName); } $enabled = Mage::helper('ddg')->isEnabled($website); //api enabled get campaigns if ($enabled) { $client = Mage::helper('ddg')->getWebsiteApiClient($website); $savedCampaigns = Mage::registry('savedcampigns'); //get campaigns from registry if ($savedCampaigns) { $campaigns = $savedCampaigns; } else { $campaigns = $client->getCampaigns(); Mage::unregister('savedcampigns'); Mage::register('savedcampigns', $campaigns); } foreach ($campaigns as $one) { if (isset($one->id)) { $fields[] = array('value' => $one->id, 'label' => Mage::helper('ddg')->__(addslashes($one->name))); } } } return $fields; }
/** * Prepare and set request to this instance * * @param Mage_Shipping_Model_Rate_Request $request * @return Mage_Usa_Model_Shipping_Carrier_Ups */ public function setRequest(Mage_Shipping_Model_Rate_Request $request) { $quote = $request->getQuote(); if (!$quote || !$quote->getId()) { $quote = Mage::getSingleton('checkout/session')->getQuote(); } if (!$quote || !$quote->getId() && Mage::registry('recurring_order', false)) { $quote = Mage::registry('recurring_order')->getQuote(); } if ($quote && $quote->getId()) { Mage::unregister('recurring_quote'); Mage::register('recurring_quote', $quote); } parent::setRequest($request); if (!$quote || !$quote->getId()) { return $this; } // last attempt at checking this damn thing if (!$quote->getShippingAddress()->getResidentialIndicator()) { Mage::dispatchEvent('widgetized_validate_address', array($this->_eventObject => $this, 'order' => $quote)); } // Manually overriding the residential indicator if ($indicator = $quote->getShippingAddress()->getResidentialIndicator()) { $this->_rawRequest->setDestType($indicator); } return $this; }
protected function tearDown() { $this->_block = null; Mage::unregister('entity_attribute'); Mage::unregister('attribute_type_hidden_fields'); Mage::unregister('attribute_type_disabled_types'); }
/** * Retrieve concatenation of ddq/ddq block outputs for products currently * being listed on the rendered page. * * @return string */ protected function _toHtml() { $result = ''; if (Mage::helper('ddq')->isEnabled() && Mage::helper('ddq')->isEnabledForProductCollections() && Mage::helper('ddq')->isCollectionInjectionUrl()) { $result .= parent::_toHtml(); // retrieve all products that were loaded during render $products = Mage::helper('ddq')->getLoadedProducts(); if (count($products)) { foreach ($products as $product) { if ($product && $product->getId() && !$product->getParentId() && $product->getDdqEnabled() && !$product->getHasOptions()) { // this is a work around, we need the product record to be available to us // in the ddq/ddq blocks constructor, and unfortunately this is currently // the best way of achieving that. Mage::unregister(MageParts_Ddq_Helper_Data::CUSTOM_PRODUCT_RECORD_REGISTRY_KEY); Mage::register(MageParts_Ddq_Helper_Data::CUSTOM_PRODUCT_RECORD_REGISTRY_KEY, $product->setDdqLayout('select')); // create and render ddq/ddq block for the product record. $block = Mage::app()->getLayout()->createBlock('ddq/ddq', 'mp.ddq.product.' . $product->getId()); if ($block) { $result .= $block->toHtml(); } } } } } return $result; }
public function has_value_for_configuration_changed($observer) { if (Mage::registry('orderexport_modify_event') == true) { Mage::unregister('orderexport_modify_event'); Xtento_OrderExport_Model_System_Config_Source_Order_Status::isEnabled(); } }
/** * @param Varien_Data_Collection $soapCalls */ public function setSoapCallsCollection(Varien_Data_Collection $soapCalls) { if (Mage::registry(self::SOAP_CALL_COLLECTION_NAMESPACE)) { Mage::unregister(self::SOAP_CALL_COLLECTION_NAMESPACE); } Mage::register(self::SOAP_CALL_COLLECTION_NAMESPACE, $soapCalls); }
/** * processes the grid block, checks gridcontrol configuration for updates on this block and calls column actions * * @param Mage_Adminhtml_Block_Widget $block */ public function processBlock($block) { $config = Mage::getSingleton('hackathon_gridcontrol/config')->getConfig(); $blockConfig = $config->getNode('grids/' . $block->getId()); // process columns foreach ($blockConfig->children() as $column) { // process column actions foreach ($column->children() as $action) { // create method name $func = '_' . $action->getName() . 'Action'; $funcArr = array($this, $func); if (!is_callable($funcArr)) { continue; } // call function and give a reference to the actual block, column and action call_user_func($funcArr, new Varien_Object(array('block' => $block, 'action' => $action, 'column' => $column))); } } // resort columns $block->sortColumnsByOrder(); // register current block, needed to extend the collection in Hackathon_GridControl_Model_Observer Mage::register('hackathon_gridcontrol_current_block', $block); // call _prepareCollection to reload the collection and apply column filters $this->_callProtectedMethod($block, '_prepareCollection'); // remove current block to prevent race conditions in later collection loads Mage::unregister('hackathon_gridcontrol_current_block'); }
/** * Catches moment after database upgrade to rerun data replication actions (handles events * "controller_action_predispatch", "core_config_data_save_commit_after") * @param Varien_Event_Observer $observer */ public function replicateAllIfPending($observer) { if (Mage::registry('m_run_db_replication')) { Mage::unregister('m_run_db_replication'); $this->_getProcess()->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX)->reindexAll(); } }
public function getlistdataAction() { if (!isset($_REQUEST['pids'])) { exit; } if (!Mage::helper('configurableswatches')->isEnabled()) { // check if functionality disabled exit; // exit without loading swatch functionality } $pids = explode(',', $_REQUEST['pids']); $response = $swatches = $jsons = array(); $this->loadLayout(); $viewMode = isset($_REQUEST['viewMode']) ? $_REQUEST['viewMode'] : 'grid'; $keepFrame = $viewMode == 'grid' ? true : false; foreach ($pids as $pid) { Mage::unregister('catViewKeepFrame'); Mage::register('catViewKeepFrame', $keepFrame); $swatches[] = array('id' => $pid, 'value' => $this->getLayout()->createBlock('Wigman_AjaxSwatches/swatchlist', 'swatchlist-' . $pid)->setPid($pid)->setViewMode($viewMode)->setTemplate('configurableswatches/catalog/product/list/swatches.phtml')->toHtml()); $productsCollection = $this->getLayout()->getBlock('swatchlist-' . $pid)->getCollection(); //Mage::log($productsCollection); $jsons[$pid] = $this->getLayout()->createBlock('Wigman_AjaxSwatches/catalog_media_js_list', 'mediajslist-' . $pid)->setPid($pid)->setViewMode($viewMode)->setProductCollection($productsCollection)->setTemplate('wigman/ajaxswatches/media/js.phtml')->toHtml(); } $response['swatches'] = $swatches; $response['jsons'] = $jsons; $this->getResponse()->clearHeaders()->setHeader('Content-type', 'application/json', true); $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response)); return; }
/** * Fetch all customer account navigation links from layout-block * * @return array of Varien_Object(s) */ public function getLinks() { $links = array(); /** * Save current store and design package */ $currentStoreId = Mage::app()->getStore()->getId(); $currentDesign = Mage::registry('_singleton/core/design_package'); /** * Fetch all links from customer account navigation block */ foreach (Mage::app()->getStores() as $store) { Mage::app()->setCurrentStore($store->getId()); Mage::unregister('_singleton/core/design_package'); /** @var $layout Mage_Core_Model_Layout */ $layout = Mage::getModel('core/layout'); $layout->getUpdate()->load('customer_account'); $layout->generateXml(); $layout->generateBlocks(); /** @var $navigation Mage_Customer_Block_Account_Navigation */ $navigation = $layout->getBlock('customer_account_navigation'); if ($navigation instanceof Mage_Customer_Block_Account_Navigation) { $storeNavigationLinks = $navigation->getLinks(); $links = array_merge($links, $storeNavigationLinks); } } /** * Restore store and design package */ Mage::app()->setCurrentStore($currentStoreId); Mage::unregister('_singleton/core/design_package'); Mage::register('_singleton/core/design_package', $currentDesign); return $links; }
protected function _toHtml() { Mage::register('current_megamenu_category_or_id', $this->getCategoryOrId()); $html = parent::_toHtml(); Mage::unregister('current_megamenu_category_or_id'); return $html; }
public function _prepareLayout() { parent::_prepareLayout(); $form = new Varien_Data_Form(); $form->setDataObject(Mage::registry('current_category')); $this->setForm($form); $fieldset = $form->addFieldset('design', array('legend' => Mage::helper('blog')->__('Custom Design'), 'class' => 'fieldset-wide')); $group = array('custom_apply_to_products', 'custom_design', 'custom_design_from', 'custom_design_to', 'custom_layout', 'custom_layout_update_xml'); if (Mage::registry('current_category')->getLevel() != 1) { $group[] = 'custom_use_parent_settings'; if (Mage::registry('current_category')->getData('custom_use_parent_settings')) { Mage::register('disabled', '1'); } } $attributes = $this->getCategory()->getAttributes($group); $this->_setFieldset($attributes, $fieldset); if (Mage::registry('disabled')) { Mage::unregister('disabled'); } if (Mage::getSingleton('adminhtml/session')->getCategoryData()) { $form->setValues(Mage::getSingleton('adminhtml/session')->getCategoryData()); Mage::getSingleton('adminhtml/session')->getCategoryData(null); } elseif (Mage::registry('current_category')) { $form->setValues(Mage::registry('current_category')->getData()); } $form->addValues(Mage::registry('category')->getData()); $form->setFieldNameSuffix('general'); $this->setForm($form); }
/** * @param $storeId */ protected function _processStore($storeId) { //Mage::app()->setCurrentStore($storeId); Mage::unregister('_singleton/core/design_package'); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); Mage::getSingleton('core/design_package')->setStore($storeId); if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_CRON_TIME, $storeId))) { $this->_processNewOrders($storeId); } if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_CRON_TIME, $storeId))) { $this->_processRelated($storeId); } if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_CRON_TIME, $storeId))) { $this->_processReview($storeId); } if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CRON_TIME, $storeId))) { $this->_processBirthday($storeId); } if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_CRON_TIME, $storeId))) { $this->_processNoActivity($storeId); } if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_CRON_TIME, $storeId))) { $this->_processWishlist($storeId); } if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_CRON_TIME, $storeId))) { $this->_processVisited($storeId); } if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_CRON_TIME, $storeId))) { $this->_processBackToStock($storeId); } $this->_cleanAutoresponderExpiredCoupons(); }
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'); }
/** * Redirect to romview after validating that correct information has actually been answered */ public function viewAction() { Mage::unregister('rom_order'); /** @var Zend_Controller_Request_Http */ $request = $this->getRequest(); $orderId = $request->getPost('oar_order_id'); $orderEmail = $request->getPost('oar_email'); $orderZip = $request->getPost('oar_zip'); $orderLastname = $request->getPost('oar_billing_lastname'); /** @var Mage_Core_Model_Session */ $session = $this->_orderFactory->getCoreSessionModel(); // Clearing out messages $session->getMessages(true); /** @var EbayEnterprise_Order_Model_Detail */ $detailApi = $this->_orderFactory->getNewRomOrderDetailModel($orderId); try { /** @var EbayEnterprise_Order_Model_Detail_Order $romOrderObject */ $romOrderObject = $detailApi->process(); } catch (EbayEnterprise_Order_Exception_Order_Detail_Notfound_Exception $e) { $session->addError($e->getMessage()); $this->_redirect('sales/guest/form'); return; } if ($this->_hasValidOrderResult($romOrderObject, $orderEmail, $orderZip, $orderLastname)) { $this->_redirect('sales/order/romguestview', ['order_id' => $orderId]); } else { $session->addError($this->_orderHelper->__('Order not found.')); $this->_redirect('sales/guest/form'); } return; }