Closed (fixed)
Project:
Commerce Wishlist v3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
16 Sep 2015 at 21:39 UTC
Updated:
4 Oct 2015 at 14:44 UTC
Jump to comment: Most recent, Most recent file
When setting a quantity in the wishlist to 0 and using 'Update Quantity', site errors.
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in array_flip() (line 388 of /var/www/html/includes/entity.inc)
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityDrupalWrapper->set() (line 737 of /var/www/html/sites/all/modules/entity/includes/entity.wrapper.inc).
Seems like the quantity function just needs to check if the new quantity is 0, and remove it instead of updating quantity.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | commerce_wishlist-2569827-zero_quantities-7.patch | 805 bytes | neograph734 |
| #4 | zero-quantity.patch | 1.06 KB | chadsten |
Comments
Comment #2
chadsten commented$form_state['order']->order_id doesn't seem to exist in commerce_wishlist_handler_field_edit_quantity.inc during the delete lines foreach. Will continue to investigate.
Comment #3
chadsten commentedCreated patch to resolve this issue.
The first change is pretty obvious - I just had to find the order ID.
The second change was due to the fact the old method of removing a line item was deleting all line items (for some reason) and deleting the wishlist. The function I replaced it with is the same used for the 'Remove' button, which seems to work correctly.
Comment #4
chadsten commentedPatch had gitignore changes. Removed.
Comment #5
chadsten commentedComment #6
neograph734I am not really sure why the order is loaded here as the variable is not used. I suppose only
commerce_line_item_delete($line_item_id);should be enough.
Comment #7
neograph734Attached proposed resolution.
Comment #9
neograph734Removing unused code not really needs a review... (and my patch was wrong). Committed the change from #6. Thanks for finding this error!
Comment #10
neograph734