In uc_ajax_cart_preprocess_uc_ajax_cart_block_content() of uc_ajax_cart.theme.inc, it is possible to have the function return by enabling uc_discounts or uc_discount_alt and having no discounts:
if ($discount_total) {
return
}
If this branch executes, then $vars['items'] does not get set among other things, causing the template to use the cart item stdClass objects as arrays which causes a fatal PHP error. Attached patch resolves the problems.
Also, although not directly related to this issue, please consider using a different index in $vars than one that already exists (perhaps something like 'display_items' or 'ajax_cart_items') to avoid situations like this in the future. An empty array would cause an empty cart to be displayed, but a fatal error like this one stops the site from functioning entirely on certain pages.
Comment | File | Size | Author |
---|---|---|---|
#1 | uc_ajax_cart-discounts_return-1455636-1.patch | 786 bytes | stewart.adam |
Comments
Comment #1
stewart.adam CreditAttribution: stewart.adam commentedPatch attached, switching status to needs review.
Comment #2
stewart.adam CreditAttribution: stewart.adam commentedCommitted.