On the front page of an empty site (rare, I know) section I get this error:

notice: Undefined variable: output in /path/to/drupal/sites/all/modules/ubercart/uc_cart/uc_cart.module on line 387.
notice: Undefined variable: output in /path/to/drupal/sites/all/modules/ubercart/uc_cart/uc_cart.module on line 427.

In the file uc_cart.module I can suppress this error by adjusting the following function:
373 function theme_uc_cart_block_content() {
374 global $user;
375 $output = ''; ************** added this line ***************
376 $total = ''; ************** added this line ***************

Both of these variables are only set initially under certain conditions. If a blank variable is added at the beginning of the function, the error does not occur.

Comments

rszrama’s picture

Version: 6.x-2.0-beta3 » 6.x-2.0-beta4
Status: Active » Fixed

Hey emmajane, the cart block code was actually totally changed in the beta4. I checked it out, and I think it's initializing everything properly now, so hopefully you won't see this any more. Feel free to re-open if you're still getting the error after an update.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

j0rd’s picture

Version: 6.x-2.0-beta4 » 5.x-1.10
Status: Closed (fixed) » Active

This bug also exists in the latest version of Drupal 5 - Ubercart 1.10

It's a problem because is provides you with a "null" Total in your cart block display.

Aka.

"Total: " instead of "Total: $0.00"

To resolve the issue as mentioned, $total variable has to be initialized by the begining of the function.

function theme_uc_cart_block_content() {                                                       
  global $user;                                                                                   
                                                                                                  
  $total = 0;                                                                                     
...
TR’s picture

Status: Active » Fixed

OK, initialized $output and $total, for those of you still using Ubercart 1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.