Question

I have a custom module that subscribes to an event called catalog_product_collection_apply_limitations_after. In the observer I am setting a variable (E.g $_GET['test'] = true)

Then later in my .phtml file I am accessing that to do logic based on the variable. It works well, however, once launched on one of our client's webshop, all the globals like $_GET, $_POST, $_REQUEST appears empty.

My guess is that there is a redirect happening, but then I ask myself why in the world would someone do that, as it definitely messes up most 3rd party extensions. But I might be wrong though.

Any other ideas of why would this be happening ?

P.S Here's a subset of var dump of $GLOBALS variable in the frontend:

array(16) { ["_GET"]=> array(1) { ["limit"]=> string(2) "12" } ["_POST"]=> array(0) { }

Was it helpful?

Solution

I think the using of the $_SESSION global variable is solution for you, because after the redirect your server drops all of the $_REQUEST variables.

Here is answer for similar problem:

Global variables are not persistent between http requests, like a redirect. You have to use a session to store this data between requests.

OTHER TIPS

I'd advise using the Magento registry rather than setting values using the GET variable.

// Set the registry value
Mage::register('test', TRUE);

// Gets the registry value
$registryValue = Mage::registry('test');

Of course, if it is redirecting your request then this also won't work :)

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top