I need to take input file and want to attach that file while adding product to cart programmatically. i want to attach file like photo to sale order while adding to cart
How would i achieve that? below is what i do for normal text field. similarly i want for input type file.
$request = new Varien_Object(array(
'qty'=>1,
'options' => array(3=>'test') // 3 is id of custom option
));
$cart = Mage::getModel('checkout/cart');
$cart->init();
$cart->addProduct($my_product, $request);
$cart->addProduct($sub_product,$request);
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
Help me Out
Magento includes a file type custom option type that can be assigned to products.
When set correctly, a field will become available on the Product View page for the customer to upload a file.