I have a Drupal 7 / Ubercart 3 installation where I have been struggling to implement a multi-lingual catalog.

On the individual Product level, things now seem to be working correctly. I say this because visitors, when viewing an [English] version of a product, can easily navigate to a [Chinese, Traditional] version or a [Chinese, Simplified] version by simply choosing the appropriate flag in the Language Switcher dropdown.

Where things are not working so well is when I want to implement any kind of Catalog.


I created a custom view (available at http://www.holisticpethelp.com/shop) that enables visitors to access a large number of sub-catalogs by applying filters to the Catalog vocabulary/taxonomy. The view works well, but not when the Language Switcher is used. Then, the view breaks because the Taxonomy tid differs between languages.

For example:

  • The Taxonomy tid for "Cat" in [English] is 80
  • The Taxonomy tid for the [Chinese, Traditional] translation of "Cat", or "貓" is 82

So /shop breaks if you happen to apply a filter in one language, and then switch to another language upon receiving the results. You are presented with a blank screen.


The reason why I created the custom View was because I could never get the Catalogs links that appeared in the details section of Products to work right. While the name related to the Catalog in question was right, the URL appeared to be incorrect.

For example the "Cat" Catalog featured a link that pointed to:


Instead of:


As you can probably guess, the same Language Switcher dropdown problem happened with these URLs, where the system got "lost" because (once again) the tid for "Cat" is 80 and the tid for the translation of "Cat", or "貓" is 82.

So, I went ahead and re-programmed the PHP code in the Product details area of node--product.tpl.php to actually use Taxonomy Term and not the Taxonomy Id, by commenting out the following line of code:

print strip_tags(render($content['field_catalog']),'<a>');

and replacing it with a the following code:

      # GL  2022-06-17    Get the current language
      global $language;
      $current_language = $language->language;

      # GL  2022-06-17    Step through the terms until they are are all collected
      $iteration = 0;
      foreach ($node->field_catalog[$current_language] as $item) {

        # GL  2022-06-17    Get the raw taxonomy term into a local variable
        $taxonomy_term = $node->field_catalog[$current_language][$iteration][taxonomy_term]->name;

        # GL  2022-06-17    Create clickable URLs by replacing
        #                   " / " with "-" in taxonomy terms
        $taxonomy_term_URL = str_replace(" / ", " ", $taxonomy_term);

        # GL  2022-06-17    The word " in " is eliminated in taxonomy URLs
        $taxonomy_term_URL = str_replace(" In ", "-", $taxonomy_term_URL);

        # GL  2022-06-17    Get rid of any lingering spaces
        #                   clickable URLs by replacing " " with "-"
        $taxonomy_term_URL = str_replace(" ", "-", $taxonomy_term_URL);

        # GL  2022-06-17    Get rid of any lingering apostrophes
        #                   clickable URLs by replacing "'" with ""
        $taxonomy_term_URL = str_replace("'", "", $taxonomy_term_URL);

        # GL  2022-06-17    Output the clickable URL, with commas added automatically
        print "<a href=\"/$current_language/catalog/$taxonomy_term_URL\">$taxonomy_term</a>\n";


I believe that the system now creates URLs that result in the correct Catalog.

By this I mean that the resulting URL now points to:


If you click on the URL you do indeed get to the right Catalog (Cat)

And, if you use the Language Switcher dropdown you do indeed get to the right translated Catalog (貓)

Which appears as:


So I feel close to solving this problem - EXCEPT FOR ONE THING

The Catalog page is terrible looking.

No matter what I do I cannot alter it.

I have tried:

Changing settings in http://www.holisticpethelp.com/en/admin/store/settings/catalog

This does not seem to do anything. Maybe it alters the way the Catalog Block is presented. I am not using the Catalog Block.

Creating a uc_catalog_browse.tpl.php template

This does not seem to do anything, and I do not know where I should be putting it. Where does it go? In the theme directory, the theme_sub directory or somewhere else?

Does anyone have any idea how I can make


Look like


All suggestions and comments welcome.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.