0

I am working on magento 1.7 . I need to insert data in sales_flat_quote_item_option table.I tried with following code:-

$customerId= Mage::helper('customer')->getCustomer()->getId();
$product_id = $_REQUEST['id1'];
$model = Mage::getModel('catalog/product');
$_product = $model->load($product_id); 
$quoteObj=Mage::getModel('sales/quote')->assignCustomer($customerId);
$option = array('options'=>array(
    "option_id1" => 'option_value1',
"option_id2" => 'option_value2'
));
$request = new Varien_Object();
$request->setData($option);
$quoteObj->addProduct($productObj,$request);

but not able to insert data in this table. Actually this table contains custom options value.I I don't have custom options so just insert another values in this table which is coming from another form.Can anybody help me?

Neeraj
  • 101
  • 5
  • 16

1 Answers1

0

I'm not 100% sure what you are trying to do, but I think it would be better if

  1. Use an observer

  2. Add your options to 'additional_options' instead of 'options'

See Magento - Quote/order product item attribute based on user input

Community
  • 1
  • 1
MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62
  • thanks for reply.nice post but can you give me some more guidance that on which files I should write these code.and where on front end these options will display? – Neeraj Dec 06 '12 at 12:43
  • Could you explain to me the workflow on what you are trying to do. – MagePal Extensions Dec 06 '12 at 12:47
  • I already told you in my previous questions that i want to show a form after product detail page and after submit that form all the values should be store in db and show in add to cart page,sales,order,checkout page,emails etc. with product informations. – Neeraj Dec 06 '12 at 12:57
  • I am trying this method because if i replace custom options values with my form values in database then i'll be able to show them on all places automatically as magento default functionality of custom options.because custom option values stores in sales_flat_quote_item_option table in database. – Neeraj Dec 06 '12 at 13:01
  • i have following module structure: app\code\local\Louisoptical\ Prescriptionform In this folder i have following folders Block, controllers, etc,Helper,Model,sql – Neeraj Dec 06 '12 at 13:07