1

I need to set session data in array in magento ...not in particular variable... And after success ..I want to remove data by array id ... I created in variable... But on success i have to be remove all session ...so I need to store session data in array..

  $vhelper->_vendorsession()->setVname($this->getRequest()->getPost('vname'));
            $vhelper->_vendorsession()->setEmail($this->getRequest()->getPost('email'));
            $vhelper->_vendorsession()->setPhoneNumber($this->getRequest()->getPost('phone_number'));
            $vhelper->_vendorsession()->setCompanyName($this->getRequest()->getPost('company_name'));

            $vhelper->_vendorsession()->setBrandsName($this->getRequest()->getPost('brands_name'));
            $vhelper->_vendorsession()->setAboutBusiness($this->getRequest()->getPost('about_business'));
            $vhelper->_vendorsession()->setSellerTrade($this->getRequest()->getPost('seller_trade'));
            $vhelper->_vendorsession()->setSellerPrimaryCategory($this->getRequest()->getPost('seller_primary_category'));
            $vhelper->_vendorsession()->setSellerUniqueProductCount($this->getRequest()->getPost('seller_unique_product_count'));
            $vhelper->_vendorsession()->setSellerUniqueSkuDepth($this->getRequest()->getPost('seller_unique_sku_depth'));
            $vhelper->_vendorsession()->setSellerPrimarClientType($this->getRequest()->getPost('seller_primary_client_type'));
            $vhelper->_vendorsession()->setCompanyWebsite($this->getRequest()->getPost('company_website'));
            $vhelper->_vendorsession()->setSellerCity($this->getRequest()->getPost('seller_city'));

I need to know that how can i set this in array..

1

I didn't really understand what you need, but session in php it's serialized data so you can store in it almost everything, even objects. If you need to store some request data in session you can do this for example in such way:

$session = Mage::getSingleton('core/session');
$session->setData('current_request', Mage::app()->getRequest()->getParams());

and then unset it when you need

$session->unsetData('current_request');

in your example it may be something like

$vhelper->_vendorsession()->setPostData($this->getRequest()->getPost());

and then when you need to unset use unsPostData magic method or unsetData('post_data') to do this

or explain what you need

1
$arr = array(1,2,3);
Mage::getSingleton('core/session')->setMysession($arr);

to get the session

$ab = Mage::getSingleton('core/session')->getMysession();
echo $ab[0];

Your Answer

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

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