20 replies [Last post]
mattGWS's picture
Offline
Joined: 11/26/2008
Juice: 21
Was this information Helpful?

Hi all,

Ive been trying to create a custom view for my catalog instead of the existing one, hoping it would give me much more control over the end product.

I am struggling slightly with this complex a use of the Views module, and am wondering if anyone could give me any advice on the following areas in which i am finding it hard going:

- How do I grab the existing category image from within views? e.g. The image that you upload inside the taxonomy when creating a new term

- How do I use the arguments function properly so as to display things in the correct order - firstly the list of top-level terms, then when the right argument is passed in, a list of items (or sub-categories) within that category. I'm sure views is clever enough to allow this but I have not used multiple arguments before and am struggling somewhat.

Any help with this is greatly appreciated

thill's picture
Offline
Joined: 01/25/2008
Juice: 815
Re: Drupal 6x & Ubercart - Creating a custom catalog view?

MattGWS welcome to Ubercart,

You bring up an excellent point, I think we all agree there could be more functionality with the way Ubercart handles the image in regards to the catalog/category.

I like what you are trying to do, I use the Taxonomy Image module for this. It extends the image functionality for the taxonomy to a whole new level.

I wish I knew more PHP I would submit a patch to add some of Taxonomy Image's functionality to Ubercart.

mattGWS's picture
Offline
Joined: 11/26/2008
Juice: 21
Thanks for the reply. If I

Thanks for the reply.

If I were to install Taxonomy Image would that not interfere with the existing category image code?

Looks like a good delve into Views is whats in order..

thill's picture
Offline
Joined: 01/25/2008
Juice: 815
Re: Thanks for the reply. If I

From my understanding of your intentions you want to use views to create the catalog vs actually using the catalog module. This being the case you wouldn't enable the catalog module and therefor the image upload that Ubercart Catalog module creates wouldn't ever be inserted. You won't have an issue.

stephthegeek's picture
Offline
Theminator
Joined: 10/20/2007
Juice: 575
Re: Drupal 6x & Ubercart - Creating a custom catalog view?

Ok, I'm determined to help tackle this one because Views 2 is destined to take over the world Smiling

Using Views to replicate catalog grid listings of categories is no biggie. I've attached the admin screen as well as a screenshot of the view. The screenshot shown is just using the "Buy it now" button, which doesn't give you the quantity field, attributes, etc. but you can swap the "Add to cart form" as a field shown in the view to get all that too. I'm just overriding the default taxonomy_term view to display in a grid, essentially.

Using Taxonomy Image, it's also not too tough to get a category listing with thumbnails (ignore the fact that they're teensy icons, they could be larger images like UC does now just as easily). They then link to their category pages, which goes to the view above.

Where I'm stuck is how to have a drill-down of taxonomy terms in a hierarchical vocabulary. That view of taxonomy images is ALL terms, top level and child items. What we need here is a way to have it only show those at the first level depth first, then you click on one and get the sub-categories. I think once that part is figured out, it also won't be too tough to use views attachments to display multiple views on a page and have your sub-categories show at the top and the items that are in the top level term below. My grasp of arguments is really not that advanced so I'm sure I'm missing something here.

I tried out the summary option for taxonomy as well, but that doesn't give you much flexibility of formatting and you can't put in the taxonomy images. The summary would be great for blocks with category listings though, like the existing UC catalog block.

Any ideas on how to accomplish the nested taxonomy browsing?

AttachmentSize
views-category-products.png 205.11 KB
views-category-products-admin.png 155.18 KB
views-taxonomy-image.png 58.08 KB
views-taxonomy-image-admin.png 142.26 KB

Gorgeous original Drupal themes (and Ubercart themes!) ~ Psst: more Ubercart themes on our new site

urbanx@drupal.org's picture
Offline
Joined: 10/29/2008
Juice: 30
steph, hey, i didn't get the

steph,

hey, i didn't get the time to look at this like i was hoping for yesterday (my mom called, and mom's always win out over computers), but i did get a little time to look at it. i think i *might* be able to give you a nudge in the right direction.

if you look at a (what i assume is) stock d6/views2 install, you'll notice that there are a couple of views that are not enabled by default. one of these is "Default Node view: taxonomy_term (default)."

looking at that, it seems that the way to fine tune the taxonomy stuff may be to use arguments instead of fields. specifically, the ones they use seem to be:

Taxonomy: Term ID (with depth)
Taxonomy: Term ID depth modifier

unfortunately, i haven't yet had a proper chance to set up some subcategories via taxonomy and populate them and test this myself, but i think it might be a step in the right direction. i hope it's useful to you.

i'll try to get to poking around with this in the next day or two if i can.

d.

andy-at-home's picture
Offline
Joined: 09/02/2009
Juice: 2
Taxonomy Image and Views
stephthegeek@drupal.org wrote:

Using Taxonomy Image, it's also not too tough to get a category listing with thumbnails (ignore the fact that they're teensy icons, they could be larger images like UC does now just as easily). They then link to their category pages, which goes to the view above.

Sorry about reopening an old thread but I've not been able to get the Taxonomy Image module and Views to work. Can someone go through the process quickly? Or post a View that produces images next to terms?

No matter how I setup a View I just can't get the images appear next to the terms.

Thanks.

Finbarr's picture
Offline
Joined: 07/13/2009
Juice: 46
Re: Taxonomy Image and Views

I have come to the conclusion that really the only way to get a nice custom catalog is to delve deep into the code and actually make changes there. You don't need to hack core either. If you are not using the product grid, but you want to have a product table, you only need to customise these two theme functions:

theme_uc_catalog_browse
theme_uc_catalog_products (change this so that it calls theme(modulename_product_table) and not theme(uc_product_table))

And you need to have your own module that declares:

modulename_product_table
modulename_product_table_header

You can largely copy and paste the code out of uc_catalog.pages uc_catalog.module and uc_product.module aswell.

If you want a completely custom view you don't need the product table stuff at all - simply change the function call in theme_uc_catalog_products so that the product list is themed by whatever function you want.

Finbarr

nanopatch's picture
Offline
Joined: 03/31/2010
Juice: 12
best solution

Finbarr,
I think your solution might be the best I found until now.
Only, I don't know how to do it, could you be more specific.

I like to implement your solution but I have no experience in module development.

  • How tot customise the two theme functions? (what should I place in the new functions and where do I place them)
  • What code should be in the declarations of my custom module?
  • What part of the code out of uc_catalog.pages uc_catalog.module and uc_product.module should I copy. You said 'largely' but maybe you can be specific.

I found a lot of forumtopics on the net regarding the same issue.
So far it can not completely be solved with views2.

For my specific situation: The only thing I want is that the ubercart standard product table has the product price in it as well.

thank you in advance

best regards
nanopatch

stephthegeek's picture
Offline
Theminator
Joined: 10/20/2007
Juice: 575
Re: Drupal 6x & Ubercart - Creating a custom catalog view?

I still haven't had the time to devote to this either, but a couple of recent articles on summaries and attachments in Views 2 feel like they would be of help if anyone's tinkering with this...

http://drupaleasy.com/blogs/ultimike/2009/02/using-display-attachments-p...
http://drupaleasy.com/blogs/ultimike/2009/02/displaying-hierarchical-con...

Gorgeous original Drupal themes (and Ubercart themes!) ~ Psst: more Ubercart themes on our new site

Finbarr's picture
Offline
Joined: 07/13/2009
Juice: 46
Success?

Has anyone managed to do this yet?

sandroz's picture
Offline
Joined: 08/05/2009
Juice: 25
Re: Drupal 6x & Ubercart - Creating a custom catalog view?

Would be interested too in how to customize the default catalog table. especially how to add other columns and remove the "add to cart" button.

Any help appreciated.

Best Regards
Sandro

sandroz's picture
Offline
Joined: 08/05/2009
Juice: 25
Re: Re: Drupal 6x & Ubercart - Creating a custom catalog view?
xaris.tsimpouris's picture
Offline
Joined: 01/03/2011
Juice: 28
Views within Catalog Module

After working around the above ideas, I concluded to the follwing solution concerning Views 2 and Catalog Module (Table view).

1. Create a view "catalog_inner", that shows products from spesific taxonomy term as an argument, in any way you like.

2. Create a theme function, who has the same code from theme_uc_catalog_browse, for example:
function xaris_uc_catalog_browse($tid = 0)

3. Change the spesific "if" code to

if (count($catalog->products)) {
if (count($links)) {
$output .= theme('links', $links, array('class' => 'links inline uc-categories')) ."\n";
}
$output .= $catalog->description;
$output .= views_embed_view('catalog_inner', 'default', $catalog->tid);
}
else {
...

where "catalog_inner" is your view name, and "default" the view page (or "default" if there is no page)

epectasys's picture
Offline
Joined: 07/24/2011
Juice: 3
Re: Views within Catalog Module

Thanks for the help. I have been looking for this ... It works for me!

gav643's picture
Offline
Joined: 06/27/2010
Juice: 48
Hi all, I'm working on a

Hi all,

I'm working on a fabric e-commerce site and on the catalog page I'd like to show 5 'promoted/featured' fabrics for each category.

For example, some of my categories are Patterns, Plains and Oilcloth. For each of these I'd like to show 5 fabrics which would be chosen/managed and ordered by my client.

My thoughts on this are:

I'd have to add in some sort of 'promote to catalog' page for each product with weighting so that it can be ordered.
Some how create a view that displays the catalog terms and these 5 chosen products.

It seems like it should be straight forward but I'm unsure how to accomplish it.

Does anyone have any advice?

Thanks in advance for your help.

Gav

Cayenne's picture
Offline
Joined: 01/01/2009
Juice: 533
Re: Hi all, I'm working on a

1. add a cck field that includes the values "promoted"
2. Install views
3. create a view that sorts with a first sorting filter of "promoted" = true and then includes the rest

Good luck!!

gav643's picture
Offline
Joined: 06/27/2010
Juice: 48
Re: Re: Hi all, I'm working on a

Thanks Cayenne, this sounds like a good start.

Do you have any suggestions as to how I could order the promoted products?

Cayenne's picture
Offline
Joined: 01/01/2009
Juice: 533
Re: Re: Re: Hi all, I'm working on a

Well, you could do any of a couple of things:

Sort by last updated, which is an easy option, and often reflects something pretty close to your intent

or add (and I hate to do it) ANOTHER field with a title of "weight" or "priority" and add a sort by that

Or, modifying my suggestion above, the "promoted" field could be an integer, with its value being how high on the list you want it to appear.

Flexibility is a blessing and a curse

gav643's picture
Offline
Joined: 06/27/2010
Juice: 48
Re: Re: Re: Re: Hi all, I'm working on a

I like the idea of making the promoted field an integer - this removes the need for a weight field! Brilliant!

Thanks.

gav643's picture
Offline
Joined: 06/27/2010
Juice: 48
Hi Cayenne, I'm making

Hi Cayenne,

I'm making progress with my custom catalog view but I was wondering if you could provide some additional guidance?

I have added an integer field to my products, have created a View with a page display filtering by this integer (as long as not empty) and its taxonomy/vocabulary. I am showing the taxonomy: terms, image and node title fields but can't quite get the display I require. What I want is the taxonomy term as a header and then all products that relate to this (showing an image and title). What I currently have is the taxonomy term above each product's image and title.

Do you have any ideas?

Please let me know if you would like me to clarify anything.

Thanks.