0

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

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

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.