Originally Posted by
Dave224
This post picks up following the discussion of "How to control extra_cart_actions file loading order" in the General Questions forum.
The offer for mc... to add a notifier in the includes/extra_cart_actions/stock_by_attributes.php file would most likely solve my problem, but I'm not sure it's the best solution. If a notifier is added, it should be at the start of the file.
I need to bring up a form and process the customer's responses to the form when a certain product with attributes is added to the shopping cart. So my extra_cart_actions file detects the product being added to the cart, saves the $_POST variables (because $_POST data is lost on redirect), and redirects to files that display the form and when the form is submitted, processes the responses. For reasons that escape me at the moment, the $_POST variables are not restored until the extra_cart_actions file is executed again later in the add product to cart process. When I developed this code, SBA did not have an extra_cart_action file, so the missing $_POST data was not missed by other extra_cart_actions files. But now, SBA has a file there, and it runs before my file, and it doesn't like missing $_POST data. I get a undefined index products_id notice on or about lines 372, 492, and 513.
So while a notifier in SBA could trigger an observer that restores the $_POST data if not present, I think a better solution is to try and display the form, process the results, and restore $_POST (if necessary) all at once, instead of over two cycles through extra_cart_actions. I'm not sure I can accomplish that but that's what I'm going to try.
Dave
Bookmarks