I’m trying to achieve an ajax file upload in Magento, rather than the typical file input provided by adding Custom Options.
I’m looking for insight on how to pull this off. My main stumbling block is how to attach the file back to the product when adding to the cart?
I have an Observer listening for the event “checkout_cart_add_product_complete” I’m trying to add the file information I’m storing to the session, back to the product, so it behaves like a normal file upload within the cart.
I’m looking at Mage::getModel(‘catalog/product’)->addCustomOption() but can’t get it to work.
Any insight would be really appreciated.
You need to be adding it to the
Itemobject in theQuotewhich is stored inMage::getSingleton('checkout/session'). Each Checkout session has a Quote which is basically the cart state. You can doto see all of the items in the cart (but the output will be very messy). So in terms of your ‘stumbling block’ of getting custom objects saved for that item selection in that person’s cart, you need to be editing data on the
Item.