Ubercart customized browsing experience..

Events happening in the community are now at Drupal community events on www.drupal.org.
texas-bronius's picture

Last night I asked for some knowledgeable Ubercart folks. Would you please drop me a line? I am having a couple stumbling blocks that I think someone who has built a custom view for catalog and product navigation may be able to push me over the hump.

Thanks!
-Bronius

Comments

What's the issue in particular?

Silicon.Valet's picture

lay it out here and we can make this group a resource.

Ubercart custom catalog navigation questions

texas-bronius's picture

I am having a hard time building my custom Ubercart catalog in a view that lives in a proper IA: I want a list of categories, and when I drill down, I want the breadcrumb to reflect it. Finally, when I click a specific product, I want the breadcrumb to reflect not the out-of-box Ubercart taxonomy "Catalog" path but my own custom view.

Add to that, I actually have three different site paths: a ready-made products page and a shared, pair of blank products. In the end, it's just three different view Displays with different filters and page paths.

Am I just lacking an Attachment? What about the breadcrumbs and, especially, down to the product level?

I think at least part of my breadcrumb issue might be solved by the Drupal Custom Breadcrumbs module.

Theme function?

Silicon.Valet's picture

http://drupal.org/project/taxonomy_breadcrumb

Alternatively (or additionally) you could just do it in your theme. The theme file could pull the tid from the node and walk the parents back pulling titles along the way.

Put this in your theme preprocessing file
function phptemplate_breadcrumb($breadcrumb) {
/* Get taxonomy ids, titles /
/
push relevant breadcrumbs to breadcrumb array or replace it */
return $breadcrumb;
}

As a matter of fact, I think that's probably the better way to go rather than use a module. Under a certain level of complexity I'd rather do a few oneliners than install a module. It's just one more thing for me to maintain and adds overhead needlessly. That said it's a matter of opinion which approach works best.

But.. multiple paths per node?

texas-bronius's picture

It's a good idea. I will have to learn a bit to do it, but it sounds good. One thing it doesn't cover (in my case) is the ability to refer to a single product/node from within multiple paths (or rather, doing it backwards: given a node, how can I determine "in which section" I am in the site?)

Hmm-- The simple (only?) solution might be to tag products with more tags or even create multiple product types, and in the case of "blank products," I will have to upload the same "blank mug" twice: once for each section of the website that serves them?.. Seems inefficient but maybe it's the way to go. Then breadcrumbing should be a snap based on node type or taxonomy.

In terms of choosing a path you have options

Silicon.Valet's picture

If I understand you correctly you are saying that you have a product that appears in multiple branches of a catalog. When looking at a particular product, you want to display the breadcrumbs related to taxonomy.
ie
ROOT > SECOND > THIRD > Product

It may make sense to display both/all paths, even more reason to override the breadcrumb function entirely.
ROOT > SECOND > THIRD > Product
ROOT > SECOND.2 > THIRD > Product

Otherwise, just pick the first. Depends on your need.

As for how to do it, taxonomy data is stored in the term_* tables.

term_node is a many/many bridge table nid = node id, tid = term id and vid = vocab id. tids are unique across vocabs.
term_hierarchy can be used to travel the hierarchy. lookup by tid, get parents, repeat.
term_data contains the titles for the terms.

from there it's just a SQL statement contrived to your needs.

I don't understand the second statement you wrote.

Thanks for the discussion. It

texas-bronius's picture

Thanks for the discussion. It is important to this site to "remain within the section of the site", and to that end, I've restructured products bit, with success. Products are now one type for each of the site sections, and paths are now ok:

<

section>/products/ (although I wouldn't mind slipping in an appropriate "product category" in there, but I am not sure which of the pathauto tax tokens that is).

Breadcrumbs I will just have to overlook for the time being. Maybe I'll just .. turn them off.. for now.

I will look forward to presenting this one day in the near future (and being blissfully humbled at all the better ways of doing it, once it's tangible and more easily explained)

I'd never join a club that would have me as a member

texas-bronius's picture

Leaps and bounds last night and this morning.. Just thought I'd share an update:

I am working with three "content types" for the products that fit into each of the three respective subsections of the web store. Using pathauto per content type, I can do something like:

giftshop/products/[term-raw]/[title-raw]
...

to get a product node to fit into a product category, in the shop, within the section of the website.

I have a single Taxonomy view that serves three Page Displays, each differing only in its path:

giftshop/products
...

to show product categories and descriptions (and can now be easily expanded to include images and whatnot)

I have a single Node view that serves three Page Displays, each differing only in its path:

giftshop/products/%
...

with an argument of [term] coming in. The key learning moment for me here was that in order for a view argument to match the argument as a term/termid with the desired vocabulary attached to the node I had to add that vocabulary to the Filters list (and push it up before other filters on vocab that did not need arguments).

Breadcrumbs: Using the contrib module Custom Breadcrumbs for both nodes and views (an included custom breadcrumb submodule), I am able to set breadcrumbs by content type (woo hoo!) and by View path to match my pathauto settings..!
Node breadcrumb titles:

GiftShop
Products
[term-raw]
...

Node breadcrumb paths:
giftshop
giftshop/products
giftshop/products/[term-raw]
...

Feeling rather accomplished this morning, but much work remains. Jason, thanks for the extensive, tangled, and tangential discussion yesterday. Sorry to disappoint by sticking to off-the-shelf modules thus far ;)

great!

Silicon.Valet's picture

Off the shelf is the way to go if the module meets your needs. The advantage is that somebody else is maintaining that code so you don't have to. Glad to hear that you've got a solution going. I'm interested to see what you come up with for the previewing. Sadly, my dreams were not interrupted with the name of that module/group I was mentioning.

Houston Drupal Users Group

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: