Hi.
I have a line item type with an image field for customers to upload designs to be added to printed products.
When they change, say, the gsm or size (fields defined in the product type and exposed as attributes) another upload field appears beneath the initial one.
At first this wasn't such a problem as I had the number of values limited to 2 (two sides of a business card or similar) but my client has told me that there will also be brochures with 20 pages.
I'd like to be able to call up a certain number of empty imagefield upload slots with js (dependent on a product option - single / double sided, no. of pages). That part is more of a support request and may belong in the imagefield issue queue, but the first thing I need to deal with is the fact that an extra field is added when an option is changed.
Comments
Comment #1
xcusso CreditAttribution: xcusso commentedI have the same isssue.
Comment #2
griz CreditAttribution: griz commentedNudge.
At the moment I'm hiding the extra fields with jQuery, but clearly this is not ok.
One thing I've noticed is that it's only a problem while the field is empty.
Additionally, a weight dropdown is visible (as opposed to the drag handle).
Comment #3
urbanlegend CreditAttribution: urbanlegend commentedConfirmed this issue - using a field exposed as an attribute to be selected prior to Add to Cart (e.g. product color or size) and selecting a different value from default triggers an additional upload field for each selection. Conflict in jQuery script or based on reload of page from the attribute selection?
Comment #4
malberts CreditAttribution: malberts commentedI was working on something else and found that I couldn't reproduce this issue. Then I turned off my module and the issue occurred.
What I found was that if I altered the add to cart form and re-injected the line item using the add to cart form submit code then the issue would go away. I don't have the time to put this in a module and I feel this is a bit of a hack that needs to be solved either in this module or in commerce_line_item. I think the problem is that the data stored in $form_state['line_item'] is not complete until you set that to a submitted line item.
For now, you'd want to do something like:
Comment #5
griz CreditAttribution: griz commentedUnfortunately this code produces a WSOD for me. Anybody else had any luck with it?It actually just needs one more closing curly bracket at the end.
Thanks! This solves the problem for now.
Comment #6
malberts CreditAttribution: malberts commentedThanks for noticing it. I fixed it now.
I'm wondering if this issue shouldn't be moved to the Commerce module issue queue. I imagine that if you defined your line item type and fields in code (i.e. without Commerce Customizable Products) then the same problem should occur. The reason being that only core Commerce code is used when putting the line item onto the Add to Cart form, this one is just a UI for defining more line item types. However, somebody should try this first just to be sure.