The Internet florist & gift store www.fabryka-prezentow.pl is pretty much completed, development wise. It doesn’t have many products yet and some of the content is still in English, but I wanted to write this post because I encountered several development issues that I wanted to write about. Hopefully even clarify and solve some of them. There are three major issues.
-
Taxonomy pages / Ubercart catalog disconnection and page duplication
-
Breadcrumbs and navigational issues due to the above
-
Mixed-mode SSL with Boost and Ubercart - that will be covered in the next blog post this week.
So just read on for the juice.
1. In one sentence: use pathauto to create aliases for taxonomy terms like that: catalog/[term:tid] (the last being the token for term id) AND create aliases for catalog pages like that: [term:vocabulary]/[term:name] (again, tokens).
Explanation: Ubercart catalog module is a great way of sorting and displaying products in your e-store. It was based on taxonomy – great idea, the Drupal way to go. However, it creates duplicates pages for all the taxonomy terms from the vocabulary used. The problem was taken on several times, for instance here, here, and here. The solutions are either for Drupal 6, non-existing or total overkill like disabling taxonomy pages all together. That last thing is probably the reason why catalog pages were designed to duplicate taxonomy pages – the only reason that comes to my mind is the authors didn’t want to drastically change the taxonomy pages. The only issue I found with my solution is that if you have menus linking to taxonomy terms / catalog pages, you may need to adjust them every time you edit those menu item.
Anyway, having duplicate content on your website is a bad thing for SEO. My solution partly deals with that. The fact is, you can still manually access the mysite.com/catalog/[term:tid] page, but direct links to taxonomy pages do redirect to catalog pages which have semantic urls, based on whatever vocabulary is used. All the links on the website redirect there too, save for the links in pathauto module configuration. As I wrote, the catalog/[term:tid] pages can still be accessed, because they are considered aliases and modules like redirect or global redirect don’t check if those aliases are redirected once more – which is what happens in this case. What is needed now is to create stable path redirects from catalog/[term:tid] to [term:vocabulary]/[term:name], that will work no matter how the link is accessed. The problem is, there is no module for drupal 7 that would do that based on arguments or tokens. The Path Redirect module works isn’t ported to Drupal 7, the Rules module doesn’t have a trigger that would happen on a term page being browsed, and the Redirect module can’t assign a batch action for creating redirects. So basically that’s just what’s needed now – create a module that extends the Redirect module with batch redirect creation. That will also allow the Taxonomy Tree module to be used with Ubercart Catalog – because Ubercart Catalog Taxonomy Menu module is, unfortunately, abandoned. I am commencing work on that. In the meantime – my solution works well when it’s coupled with solution #2 (which is independently important).
2. The ubercart catalog breadcrumbs. This solution fixes them and ensures for semantic urls. They get duplicated and sometimes lead to taxonomy pages instead of catalog pages, which is a bad thing because the catalog pages add the Ubercart Catalog taxonomy view where relevant, in addition to the products (taxonomy pages only do the latter). So, first thing to do is disable the Catalog breadcrumbs in mysite.com/admin/store/settings/catalog. While there, I am using the grid catalog display, haven’t tried this solution with the table display. I also disabled showing breadcrumbs by default in my theme configuration and manually set the breadcrumbs display in /admin/structure/blocks. Now go to views and edit uc_catalog view. Check that you’re editing the Grid display, not table. Click on contextual filters and edit Content: Has taxonomy term ID (with depth). My working configuration:
-
Depth 0
-
Set the breadcrumb for the term parents is checked
-
When the filter value is NOT in the url: Display contents of “No results found” and the exception box has “all” as value (override title unchecked)
-
When the filter value Is in the url or a default filter is provided – override title is checked with the value “%1”, override breadcrumb is not checked, specify validation criteria is checked, “taxonomy term” is chosen as the validator, “Term ID” is chosen for Filter Value Type
-
All the other options are unchecked.

That should handle the breadcrumbs and urls. To also get proper redirection from catalog taxonomy terms, edit another view – uc_catalog_terms. Click to edit the “Taxonomy term: Name” field. There go to rewrite results and output this field as link. Insert [name_1]/[name] as the Link path (those are two tokens, the first is the name of the vocabulary, derived from a field that’s excluded from display, the second is the name of the current taxonomy term, from the current field). Ensure also that replace spaces with dashes is checked and change transform the case to “lower case”, that’s for SSL reasons (should you want to provide SSL for the catalog pages). If you are using drupal in a language other than English, as I do, go with the transliteration module to redirect links.
All your links should have proper semantic urls based on taxonomy AND lead to the proper catalog pages (if you followed both solutions #1 and #2).
Well, I hope I managed to help at least some of you struggling with Ubercart. Except for some issues, the module is really good and I recommend using it. My next small tutorial will help setting up SSL to work correctly with Ubercart in mix http/https mode.
Catch me twitter @trewebs, facebook (www.facebook.com/trewebs) and #drupal on freenode IRC (here under the nickname wiherek).