/** * Hook to record all fron controller events * @param Varien_Event_Observer $observer */ public function controller_action_predispatch(Varien_Event_Observer $observer) { try { if (extension_loaded('newrelic')) { $controllerAction = $observer->getControllerAction(); $request = $controllerAction->getRequest(); $controllerName = explode("_", $request->getControllerName()); if (Mage::getStoreConfig('newrelic/settings/ignore_admin_routes') && $request->getRouteName() == 'adminhtml' || $request->getModuleName() == 'admin' || in_array('adminhtml', $controllerName)) { Mage::Helper('newrelic')->setAppName(false); newrelic_ignore_transaction(); newrelic_ignore_apdex(); return $this; } if (mage::helper('newrelic')->ignoreModule($request->getModuleName()) === true) { Mage::Helper('newrelic')->setAppName(false); newrelic_ignore_transaction(); newrelic_ignore_apdex(); return $this; } if (Mage::getStoreConfig('newrelic/settings/named_transactions')) { $route = $request->getRouteName() . '/' . $request->getControllerName() . '/' . $request->getActionName(); if (Mage::getStoreConfig('newrelic/settings/add_module_to_named_transactions')) { $route .= ' (module: ' . $request->getModuleName() . ')'; } newrelic_name_transaction($route); Mage::Helper('newrelic')->setAppName(true); return $this; } } } catch (Exception $e) { mage::logException($e); } }
public function changeQty($observer) { $event = $observer->getEvent(); // $observer->getData(); // $quoteItem = $observer->getQuoteItem(); $model = Mage::getModel('itdelight_first/quantity'); $model->getCollection(); // Zend_Debug::dump($observer); // die; // $observer->getData('cart')->getData(); // $observer->getData('cart')->getData('quote')->setData(array('cart_qty'=>'20')); // $_POST['qty'] = "4"; // Zend_Debug::dump($_POST); // $quoteItem = $observer->getEvent()->getQuoteItem()->setQty('15'); try { $quoteItem = $observer->getQuoteItem(); if (is_null($quoteItem->getParentItem())) { $qty_my = $quoteItem->getQty(); $qty = $qty_my * 2; $quoteItem->setQty($qty); $quoteItem->setQtyToAdd($qty); } else { $qty_my = $quoteItem->getParentItem()->getQty(); $qty = $qty_my * 2; $quoteItem->getParentItem()->setQty($qty); $quoteItem->getParentItem()->setQtyToAdd($qty); } } catch (Exception $e) { mage::logException($e); } }
public function __construct() { try { $this->setDefaults(); } catch (Mage_Core_Model_Store_Exception $e) { // cannot determine default store id (??) // try and load by default store id $this->setDefaults(0); } catch (Exception $e) { $this->_enabled = false; mage::logException($e); } if (empty($this->_account_Id) || empty($this->_api_key) || empty($this->_data_key)) { $this->_enabled = false; } }
/** * Clear the carousel cache daily. * This will allow the carousels to rebuild taking into account any changes on scheduled items in the carousel. * The next time it is viewed, a carousel will load the latest (in scheduled) items for display */ public static function clearCache() { try { // use global tag, whuch will clear all carousels $tag = array(Doghouse_Carousel_Block_Carousel::CACHE_GROUP); mage::helper('dhcarousel')->clearCache($tag); // pageCache only listens to adminhtml requests to clear, so force it to clear if (Mage::app()->useCache('full_page')) { $fpc = mage::getModel('enterprise_pagecache/observer'); if (is_object($fpc)) { $fpc->cleanCache(); } } } catch (Exception $e) { mage::logException($e); } }
public function __construct() { $this->_userAgentString .= '/' . $this->getExtensionVersion(); $this->_userAgentString .= ' (https://github.com/ProxiBlue/NewRelic)'; try { $this->setDefaults(); } catch (Mage_Core_Model_Store_Exception $e) { // cannot determine default store id (??) // try and load by default store id $this->setDefaults(0); } catch (Exception $e) { $this->_enabled = false; mage::logException($e); } if (empty($this->_account_Id) || empty($this->_api_key) || empty($this->_data_key)) { $this->_enabled = false; } }