Created
July 5, 2016 14:48
-
-
Save ProxiBlue/9859e437ad0cf548fcbb6e9f41c0cb81 to your computer and use it in GitHub Desktop.
inject vars to session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected $_paramsToTrack = array("offer_followup"); | |
/** | |
* Capture any listened for parameters, and inject them into the session | |
* under a variable called : ProductOfferUrlParams | |
* | |
* You must clear this variable with a call to | |
* | |
* Mage::getSingleton('customer/session')->unsProductOfferUrlParams(); | |
* | |
* if the usage is no longer required, and it may trigger actions no longer | |
* required. | |
* | |
* | |
* @param Varien_Event_Observer $observer | |
* | |
* @return Viyet_ProductOffers_Model_Observer | |
*/ | |
public function controller_front_send_response_before(Varien_Event_Observer $observer) | |
{ | |
try { | |
if (Mage::getStoreConfig('productoffers/followup/disabled') == false) { | |
$request = $observer->getFront()->getAction()->getRequest(); | |
$params = $request->getParams(); | |
if (0 === count(array_diff($this->_paramsToTrack, array_keys($params)))) { | |
Mage::getSingleton('customer/session')->setProductOfferUrlParams($params); | |
} | |
} | |
} catch (Exception $e) { | |
// log any issues, but allow system to continue. | |
mage::logException($e); | |
} | |
return $this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment