Here is how i setup session:

    error_reporting(E_ALL | E_STRICT);
    $mageFilename = 'app/Mage.php';
    require_once $mageFilename;
    $app = Mage::app('default'); 

    Mage::getSingleton('core/session', array('name' => 'frontend'));

    ini_set('display_errors', 1);

    $customer_id = Mage::getSingleton('customer/session')->getId();

    $GrandTotal = Mage::getModel('sales/quote')->loadByCustomer($customer_id)->getGrandTotal();
    $HalfTotal = $GrandTotal / 2;

    $PcPay = Mage::getSingleton('core/session')->getPcPayment();
    $result = array();
    if($PcPay != "") {
    $result['GrandTotal'][] = $GrandTotal;
    } else {
        $result['GrandTotal'][] = $HalfTotal;
    echo json_encode($result);

Then in the observer when i try:

$PcPay = Mage::getSingleton('core/session')->getPcPayment();
Mage::log("PCPAYMENT - $PcPay");

After that in the system log it seems the session is not set. It seems it's empty.

Why i can not use the frontend session to the observer, is it possible and how ?

1 Answer 1


Replace your observer code with this:

$PcPay = Mage::getSingleton("core/session", array("name"=>"frontend"))->getPcPayment();
Mage::log("PCPAYMENT - $PcPay");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.