Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
i have some product types. Button "Save and add another" is doesn't work, it's only save the product.
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedDo you have any custom fields on the product types that don't work? We need to know how to reproduce the error to fix it. : )
Comment #2
zolee CreditAttribution: zolee commentedYes, I have custom fields: integer, list, image and long text.
Comment #3
rszrama CreditAttribution: rszrama commentedHmm, ok. I have product types using similar field types and haven't had any "Save and add another" problems. Will look into those... only thing I can imagine interrupting the redirect process might be the image field, but I do my testing with an image field, too.
Comment #4
rszrama CreditAttribution: rszrama commentedI just tested this using the exact same fields mentioned and "Save and add another" worked just fine. Closing this out as unreproducible.
Comment #5
jeffschulerI'm experiencing this too, in 7.x-1.0.
In debugging
commerce_product_ui_product_form_submit()
(when the Save and add another button is pressed,):$form_state['triggering_element']['#parents'][0]
is set to 'actions',while
$form_state['triggering_element']['#parents'][1]
is set to 'save_continue'.If I change that function to test index 1 instead of 0, the button works as I'd expect it to.
Comment #6
rszrama CreditAttribution: rszrama commentedAlrighty, I just pushed a fix that changes the way I determine which button is pushed. In reality, it should be looking at the final element of the array_parents array on the triggering element. This way it isn't dependent on any particular order / tree. All I can figure is something is altering the forms of those it's failing for to make that submit element show up in a #tree parent container. Thanks for pointing out the problem with the array key - never would've found that on my own!
Commit: http://drupalcode.org/project/commerce.git/commitdiff/154a224
Comment #7
jeffschulerWorks for me. Thanks!
Might be because Commerce (Product Display Manager) is adding its display reference fieldset to the form...
Comment #8
rszrama CreditAttribution: rszrama commentedYep, that could be the problem. Sounds like the module might not be using our form support properly, then... if the product form is being embedded anywhere, it should be instantiated as a form specific to that module. The reason the normal add another button isn't working is because it expects to be that one particular product entry form with that form structure.
It may be worth pointing this out to that module's maintainer and linking to http://www.drupalcommerce.org/specification/apis/instantiating-forms.
Comment #9
jeffschuler#1289280: Breaks "Save and add another" product posted to Commerce (Product Display Manager) module