I've created a standalone PHP Script to test something.

This script shows an html page which triggers an ajax request to another module in the same environment which adds data to checkout/session.

After refreshing the standalone script, I'm not being able to retrieve that data in Mage::registry.

I also checked I'm running it in the same website and store.

Here how it works:

  1. My standalone script
include_once 'app/Mage.php';
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

Mage::app($mageRunCode, $mageRunType);
//... html that triggers a controller in the same store/environment
echo Mage::getSingleton('checkout/session')->getData('myKey'); //nothing was saved. I should see something here after the ajax saved something and I refresh this page.
  1. My controller saves the data in the following way:
Mage::getSingleton($session)->setData('myKey', Zend_Serializer::serialize($someArray);

This works well in the frontend, when running the store, and retrieving its values. But for the standalone script/page it's not working at all.

I tried to compare many things and also xdebug as far as I could.

Am I missing something here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.