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().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stewart.adam’s picture

stewart.adam’s picture

Status: Active » Needs review
longwave’s picture

It 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?

stewart.adam’s picture

In 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?

longwave’s picture

Status: Needs review » Closed (works as designed)

As 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.