Good morning,

I've used this module and I found it really helpful and it perfectly works with Taxonomy, but not with Ubercart Catalog (that uses taxonomy). The reason is because the module is implemented if the args sent are:

    'taxonomy'
    'term'
    An integer greater than 0

But Ubercart's catalog arguments are:

    'catalog'
    An integer (the term id) [and maybe a list of "subterms" ids separated by spaces]

In this way, when the module found a Ubercart's catalog term, it doesn't do anything.

I've already done a module that fixes this issue, and I asked for a CVS account to add it as a new project, id joins Taxonomy Title with Ubercart's catalog, in fact, both modules are required. But as my module doesn't add anything new to Drupal, and it doesn't have any configuration page, just a function that check for catalog terms, I think this function would be added to Taxonomy Terms instead to be a whole different project.

You can find my module here: http://drupal.org/node/791900 it perfectly works without changing anything in Catalog or Taxonomy Title modules, but I think that is better to implement it directly on Taxonomy Title.

If you need more information I'll be pleased to help you. If you want, you can add me as a co-maintainer and will help you with this implementation and maybe other things in the future.

Good bye.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jenlampton’s picture

Version: 6.x-1.3 » 5.x-1.x-dev

I agree, the right place for this function is in taxonomy title. I have added it into the latest dev version, but since I don't have any sites running ubercart + taxonomy to test on, can you test this on one of your dev sites and let me know if it's working as intended?

I added a check for the Ubercart module, but is there a way we can test for the catalog as well? I don't want this to fire on every page if not necessary... Would love a code snippet if you can provide me with one.

Thanks!
Jen

jenlampton’s picture

Version: 5.x-1.x-dev »

Whoopsie, wrong dev version

juankvillegas’s picture

Yes, the Catalog itself is an independent module, and its name is uc_catalog, you should change line 65 with:

  if (module_exists('uc_catalog') && arg(0) == 'catalog') {

Because Ubercart isn't a module, just a group of a lot of modules but none of them is named 'ubercart'.

With this change the < H 1 > title is perfectly added... but the head title isn't working, and what I can see is that this isn't a problem only for Ubercart Catalog... so I'll try Utility module.

jenlampton’s picture

Thanks, that was exactly what I needed. I've committed the code. Would you please try it again?

I'm sure the head title issue is because the preprocess function in this module happens too early, and something else is setting the title later on in the order of execution. You can always copy the preprocess function (or something similar) into your theme to make it fire later.

Jen

juankvillegas’s picture

Status: Needs work » Needs review

You haven't uploaded the new changes... but if you only changed line 65 with the text I sent, it works... I've already test it.

Bye.

DrupalGideon’s picture

I couldn't get this to work for me unfortunately with Ubercart and Page Title installed as well. Something was causing it to fallback to the default Page Title setting.

However, a bit of investigation led me to find a nifty hook function hook_page_title_pattern_alter(&$page_title_pattern, &$tokens = NULL) from the Page Title module

In my hook, I added

  if (arg(0) == 'catalog' && arg(1)) {
    $page_title_pattern = '[product-category] | [site-name]';
  }

which references my own [product-category] token which I set up using hook_token_values() as follows

function MODULENAME_token_values($type, $object = NULL) {
  switch ($type) { 
   case 'global':
     if (module_exists('uc_catalog') && arg(0) == 'catalog' && arg(1)) {
       $tids = explode(' ', arg(1));
       if (is_numeric($tids[0]) && $tids[0] > 0) {
         $tid = $tids[0];
         $values['product-category'] = taxonomy_get_term($tid)->name;
       }
     }
   break;
  }
  return $values;
}

That code was modified from the Taxonomy Title module and seems to do the trick for me.

floown’s picture

Category: feature » bug

Hello,

I have try Taxonomy title 6.x-1.4.x-dev to add a page title to my Ubercart catalog (based on Taxonomy) but in fact the <title>My page title for my product, good for SEO</title> and the taxonomy title apparing like that <h1>The name of my category product</h1> are inversed ! oO

Could you add a correct, please ? Thx for this module and your work.

(@SkidNCrashwell : I use Page title too, perhaps it's a better way to set title for page, views (dev), taxonomy and so on Ubercart catalog ? Page title does not works with Ubercart catalog at this moment. Could you do a bug report to Page title's maintainers ? Thx)

kazah’s picture

subscribe

u210ks’s picture

Hi,
Same as @floown I have

  • Page title,
  • Ubercart catalog based on Taxonomy enabled, but overtaken by a custom view page,
  • Taxonomy Title 6.x - 1.4.x-dev

The fields I have on my edit term page are:
under identification tab

  • Term Name - displayed as page title
  • Term Page Title (Taxonomy Title module field) it is displayed as H1 title
  • upload image and Term description

under additional settings

  • Page Title (another one, which doesn't seem to be displayed anywhere on Ubercart Catalog pages)
  • - other fields are 'related terms, 'weight', etc.

The input of Term Page Title field is displayed as H1 (before installing Taxonomy Title, for H1 was the input from 'Term Name' field);
and term's name is displayed as page title also.
Basically nothing changed but the H1 which is not the case. The page title is still the term's name, as it was before.
I have also in my view some arguments, and I'm not sure if they are conflicting with the taxonomy title module.

I'm not sure if I've described the issue well. I can give more info if needed.
Thx for your time!

Regards

broncomania’s picture

same here i only see taxonomy terms and not my page title

jenlampton’s picture

Assigned: Unassigned » jenlampton
Priority: Critical » Normal
Status: Needs review » Closed (fixed)
FileSize
74.64 KB
76.65 KB

The taxonomy title module is working exactly as it was intended. This is not even an issue for taxonomy title, nor is it critical.

This module was designed to update the H1 heading tag at the top of the taxonomy term page. The contents of this H1 (or sometimes H2) tag are *extremely* important for SEO (Search Engine Optimization) and this is the only module that let's you control that title (if you have not overridden the taxonomy page with another tool, like a view or a pannel.

That said, this module *also* provides tokens which can be used in conjunction with the Page title module. The Page title module is designed to let you control the header title tag - which seems like the one all of you are having trouble with.

More detail than you probably wanted

1) I've confirmed that with only Taxonomy module (drupal core) and Taxonomy Title 6.x-1.4.x-dev everything works exactly as intended with Taxonomy title. When a taxonomy title is provided, heading tag for the page, and the header page title are both updated to use the title specified by this module.

2) By simply enabling the Page title module, the header page titles defined by Taxonomy Title are instantly disabled - and the defaults provided by the page title module are used instead:

3) After configuring the page title module to use the tokens that are provided by the taxonomy title module (example: [term-title] | [site-name]) The header page titles behave as you would expect again:

4) By enabling all of the Ubercart core modules, and the catalog module, I was able to recreate the same behavior as in #2 above. On the catalog pages the heading tag on the page works as intended, but the header page title is not affected by Taxonomy Title, OR Page title.

The problem you are reporting has to do with the order in which all these modules are run. I have opened a new issue for you here: #1157908: bunp up module weight for page title to 1 which should solve the problem for you - eventually.

The Fix

1) If you are comfortable fiddling with your database, the fastest way to solve the problem is to change the weight in your system table from 0 to 1 for the Page Title module. (UPDATE system SET weight = 1 WHERE name = 'page_title';) I know touching the DB can be scary, so see option #2 below.

2) Create a GIANT theme function for your catalog page in your own theme's template.php file.
2a) Copy the function named theme_uc_catalog_browse from the uc_catalog.pages.inc file that came with ubercart.
2b) Paste this entire function into the template.php file in your theme
2c) Change the name of this function to YOURTHEME__uc_catalog_browse
2d) Locate the line that says drupal_set_title(check_plain($catalog->name)); and delete it.
2e) In that same place insert the following code instead:

  // Fake what page title does.
  if (arg(0) == 'catalog' && is_numeric(arg(1)) && module_exists('page_title')) {
    // Get the pattern based on the category (or vocab).
    $types['taxonomy'] = taxonomy_get_term(arg(1));
    $page_title_pattern = variable_get('page_title_vocab_'. $types['taxonomy']->vid, '');
    // Apply token patterns by resetting the token cache first and then using token_replace_multiple to insert token values
    token_get_values('global', NULL, TRUE);
    $title = token_replace_multiple($page_title_pattern, $types);
  }
  // Set the page title.
  drupal_set_title(check_plain($title));

I hope this helps guys :)

ucf713’s picture

This is what I use to fix this issue.

The code was generated using the patch found here: http://drupal.org/node/636976

I placed this inside my template.php file and added the check for page_title and the setting of the head_title. Replace THEME with your theme name.

function THEME_preprocess_page(&$vars) 
{
    if (arg(0) == 'catalog' && is_numeric(arg(1)) && module_exists('uc_catalog') && module_exists('page_title')) 
    {
        $term = taxonomy_get_term(arg(1));

        if (variable_get('page_title_vocab_'. $term->vid .'_showfield', 0) && ($term_title = page_title_load_title($term->tid, 'term')))
        {
            $title = check_plain(strip_tags($term_title));
            $vars['head_title'] = $title;
        }
    }
}