0

Here is how i setup session:

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

    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);
    Mage::getSingleton('core/session')->setPcPayment('pc_payment');
    Mage::getSingleton('core/session')->unsPayOnDel();
    ?>  

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

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.