0

I am basically trying to implement following thing. I have 2 parts in my app - one is magento for billing and another one is CMS which uses magento as biling gateway

CMS renders a page with hidden form where some encoded data is send with POST request to Magento. Something like this:

<form id="order-form" method="post" action="magentourl/proceed">
    <input type="hidden" name="order_data" value="{{ encryptedOrderData }}" />
</form>
<script type="text/javascript">
    var form = document.getElementById('order-form');
    form.submit();
</script>

Magento receives data and saves it to session. After that I am making redirect and I can't access my data. Session id is somehow changed between URLs but what is the reason for that I don't understand.

public function proceedAction()
    {

        $encodedOrderJson = $this->getRequest()->getParam('order_data');


        Mage::getSingleton('core/session', array('name' => 'frontend'))->setEncodedOrderJson($encodedOrderJson);
        $this->_redirect('*/*/login');
    }

    public function loginAction()
    {

        $encodedOrderJson = Mage::getSingleton('core/session', array('name' => 'frontend'))->setSessionId()->getEncodedOrderJson();
    }

The problem is that in login action I have different session, and thus I can't access my data.

Where redirect from proceed to login is done SID parameter is added. While is doesn't help a lot.

2 Answers 2

1

I found an issue. The issue was that when I was doing a request by hidden form, I was sending request by ip address, not by address. But when I was doing redirects I was using address no ip address. So the cookie were set for different hosts.

0

There are several sessions used in Magento for various reasons. I recommend trying the customer/session instead of core/session if you are trying to retrieve the data from a logged in user:

  $session = Mage::getSingleton( 'customer/session' );

Your Answer

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

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