i created custom model(e.g. 'Sample' model) and create one table(fields are like name,price,description) and their fields value store in form input type so i want to add their data in cart so how can i achieve this functionality ?
1 Answer
I'm assuming you mean that you're trying to load a model:
Mage::getModel('module/sample')->load(1234)
And then write some/all of its data to the checkout session model:
Mage::getSingleton('checkout/session')->setSampleDescription($sampleModel->getDescription())
This will effectively write a value to $_SESSION['checkout']['sample_description']
and remain for the duration of this particular session's lifetime.
Now you can access this value:
Mage::getSingleton('checkout')->getSampleDescription();
See this answer for a deeper explanation about working with sessions in Magento: https://stackoverflow.com/a/9805663/1442685