0

On product page I've a custom text field and I want to save it to order's comment section, if it is filled and order placed for that user.

I can either use sales_order_status_history_save_after or sales_order_place_after event to add comment to an order. How I can manage the session of the entered text ? Will it be fine to set session of the entered text in my controller using Mage::getSingleton('core/session')->setOrderComment($text); and observe it in sales_order_status_history_save_after and update order?

All I wanted to make sure is this comment goes for the particular product and customer who has entered this text. Can I set it on quote creation level ?

1 Answer 1

1

To save info in session

Use an observer for product add to cart(eg checkout_cart_product_add_after), then in your observer save the information to session.

Maybe a better way to do this would be to add the comment to the product custom option

To save order comment

Using sales_order_place_before event. Then in your observer check if session exist, then append the comment using addStatusHistoryComment.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.