The shopping cart block (generated by uc_cart_block(), delta 0) displays an incorrect item count in the cart summary when using product kits. For example, a kit containing 5 items will show the single kit as the cart contents but the summary will read "5 items".
This is due to the fact that hook_cart_display() is called on each item and if the returned result is an empty array, then that item is skipped for display. However, $item_count is incremented regardless of whether or not an item was successfully displayed.
The attached patch moves the increment operation ensuring that the item count is only incremented when a non-empty $item description is returned from hook_cart_display().
Comment | File | Size | Author |
---|---|---|---|
#1 | uc_cart_block_item_count-1391454-1.patch | 569 bytes | stewart.adam |
Comments
Comment #1
stewart.adam CreditAttribution: stewart.adam commentedComment #2
stewart.adam CreditAttribution: stewart.adam commentedComment #3
longwaveIt is debatable whether this is a bug or by design; if 5 items were to be shipped to the customer, shouldn't it show as "5 items", even if they are grouped together as one?
Comment #4
stewart.adam CreditAttribution: stewart.adam commentedIn this case the individual store products were created to for order administration only - the kit is configured as a unit with the individual products not visible to the user. Perhaps this should be configurable?
Comment #5
longwaveAs nobody else thinks this is a problem I consider it by design. You can always override the cart block theme functions if you need to count the items differently.