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?
Comment | File | Size | Author |
---|---|---|---|
#5 | 1901840-site-logo-token-fix.patch | 1.47 KB | longwave |
Comments
Comment #1
longwaveThis 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?
Comment #2
Leo Pitt CreditAttribution: Leo Pitt commentedI 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.
Comment #3
Leo Pitt CreditAttribution: Leo Pitt commentedI can confirm that once the section highlighted by the first post is commented out, everything works fine.
Comment #4
longwaveThere 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.
Comment #5
longwavePlease test the attached patch.
Comment #6
longwaveCommitted #5.
Comment #7
alpirrie CreditAttribution: alpirrie commentedThanks for the patch; it worked for me.
Comment #9
alpirrie CreditAttribution: alpirrie as a volunteer commentedComment #10
alpirrie CreditAttribution: alpirrie as a volunteer commented