After upgrading to version 2.9 I found that some of my pages failed to show the theme logo and favicon.

The path to the logo image was called up using the theme variable: $logo, but on some pages the theme path was being stripped out.

I have tracked this down to a the uc_store_token_values function in uc_store, and in particular the following lines of code:

      if ($logo = theme_get_setting('logo')) {
        // Strip base_path from path returned by theme_get_setting().
        $logo = substr($logo, strlen(base_path()));
        $values['site-logo'] = theme('image', url($logo, array('absolute' => TRUE)), '', '', NULL, FALSE);
      }
      else {
        $values['site-logo'] = '';
      }

If I comment them out everything is fine again. Can I ask why they are in there?

I note that the previous version, which didn't cause this problem used the following code:

      $theme_key = variable_get('theme_default', 'garland');
      $settings = theme_get_settings($theme_key);
      $themes = list_themes();
      $theme_object = $themes[$theme_key];
      if ($settings['toggle_logo']) {
        if ($settings['default_logo']) {
          $settings['logo'] = dirname($theme_object->filename) .'/logo.png';
        }
        elseif ($settings['logo_path']) {
          $settings['logo'] = $settings['logo_path'];
        }
      }

      // Use a logo; but only if we have one to use.
      if (isset($settings['logo']) && $settings['logo']) {
        $values['site-logo'] = '<img src="'. url($base_url .'/'. $settings['logo'], array('absolute' => TRUE)) .'" />';
      }
      else {
        $values['site-logo'] = '';
      }

Perhaps you need to switch back ... ?

PS: Why isn't "Store" in the list of components?

CommentFileSizeAuthor
#5 1901840-site-logo-token-fix.patch1.47 KBlongwave
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Component: Other » Code
Status: Active » Postponed (maintainer needs more info)

This code has changed twice recently:

#1532036: Use more of Drupal API while filling store token values
#1069590: wrong logo displayed in invoice when used in conjunction with domain access module

It would be helpful if you could track down exactly which change causes a problem for you. When you say "on some pages", which pages? Is there a pattern to this?

Leo Pitt’s picture

I am encountering the same problem, specifically on the cart/checkout/complete page.

I am using the Sagepay Server payment module. After completing payment on sagepay, I am returned to the website checkout complete page. In Garland or Minelli, the logo path is "//logo.png" rather than the correct path.

In my usual Fusion sub-theme, various theme-specific settings seem to have been lost too.

Leo Pitt’s picture

I can confirm that once the section highlighted by the first post is commented out, everything works fine.

longwave’s picture

Status: Postponed (maintainer needs more info) » Active

There is a static variable inside theme_get_setting(). What I guess is happening here is uc_store_token_values() is getting called early, before the theme (and global $theme_key) is properly initialized, and invalid theme settings are getting cached, then used later during page rendering. So, it looks like we cannot use theme_get_setting() here and instead must copy the code into uc_store_token_values() to avoid inadvertantly corrupting the static cache.

longwave’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
1.47 KB

Please test the attached patch.

longwave’s picture

Status: Needs review » Fixed

Committed #5.

alpirrie’s picture

Thanks for the patch; it worked for me.

Status: Fixed » Closed (fixed)

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

alpirrie’s picture

alpirrie’s picture