Hi, we were playing around with DS and ND Ubercart to customise the catalog grid page and product node layout, but can't work out how to
a) only show the primary image on the catalog grid - currently it's showing all images if there are more than one, and
b) on the product node page, show the primary image using one image cache preset, and the remainder using another image cache preset, just as the standard Ubercart product node page does.
Any suggestions?
Have attached the catalog grid page - note the products in the second row. Have also attached the product node page for your reference.
btw, love the work you're doing.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | product-grid.jpg | 86.5 KB | milplus |
| #17 | store_shot.jpg | 30.1 KB | milplus |
| #5 | Imagecache theming custom module for node display contribute | 1.56 KB | Rene Hostettler |
| product-node.jpg | 89.58 KB | linksync | |
| product-grid.jpg | 86.5 KB | linksync |
Comments
Comment #1
swentel commentedAha, never knew ubercart had this behavior by default. We've encountered the issue a few times as well (for other content types too) and what we did was simply creating 2 separate imagefields - a workaround which in a way sounds silly but works effectively :)
I think this belongs to the node displays cck component, since other imagefields could profit from that change too. I think we should look at the imagecache formatters and add new formatters based on existing presets (a bit like all the ones that lightbox2 gives). This might result in a lot of new formatters of course, but I think a valuable feature request which everyone can profit from.
Could just confirm that these are imagefields from cck ? If so, I'll change the title afterwards and should go in before the next release!
Comment #2
swentel commentedOk, after a long discussion with other developers, we came to this conclusion: only adding formatters for imagecache/imagefield is a waste of time, we need to make more general formatters which could apply to any cck field which has multiple items per instance. This implies some changes to the UI of display suite (so we can pass parameters to the formatters and other cool stuff). This won't make it for 1.1 at all, maybe not even 1.2 (depending on external factores like an UI change, because we're limited in that area right now), however, we'll post some snippets by the end of this week on the documentation pages which you can easily paste into a custom module to achieve the goal you want - and which we'll be able to reuse too in custom projects :) More to come later!
Comment #3
Stalski commentedsubscribe.
I am already dreaming about a flexible showcase gallery for juwelery products I am working on...
Comment #4
swentel commentedOk, here's some code to add extra formatters. The formatter only prints one field if there are multiple images on a that field. Replace 'modulename' by the name of your custom module.
Comment #5
Rene Hostettler commentedHi
Thanks for providing the custom module code unfortunately we are having problems getting our custom module to work.
Having followed the tutorial in the Drupal 6 module development guide it appeared our custom module was working ok.
The module installed with no error messages, however when viewing the Ubercart full node display page the standard image cache theme function is being called rather then the one in our custom module making all images the same as being set in node display.
I have attached the custom module would really appreciate it you could have a look as we haven't had any experience building modules before.
Thanks again
Comment #6
Rene Hostettler commentedreopen
Comment #8
swentel commentedOk, there is a logical flaw in my theming function which makes imagecache stop at least on a list of different images. All the rest working fine now for me. Change the theming function underneath to fix the logic.
Comment #9
Rene Hostettler commentedThanks for taking the time to look at this issue swentel it's much appreciated. I have tried replacing the new theming function but still can't get it to work. Is there another module that may be interfering with it getting called? When I inspect the node output with theme developer it is still the standard theme_imagecache() function being called on all images. Just to confirm I have replaced all the code in the theme function with your new code as shown below.
Is there any chance you could post your working module?
Comment #10
swentel commentedWell I've plugged in the module that you guys gave me (with the small changes I also posted) and it work without any problems. Saw the formatter popping up, chose the single image and it used the formatter which is defined in that module, so not exactly sure right now .. do you have this online somewhere to test ?
Comment #11
swentel commentedI'm closing this one for now - did some more testing and everything worked out fine for now. Now that 1.1 is out, we're working on a fields ds plugin which makes it possible to order fields within a view if choose a fields style plugin - see http://drupal.org/node/770368
Comment #12
jr50 commentedthank you
Comment #13
amariotti commentedAny progress on this? I'm almost wondering if this should be pushed to be an ubercart feature, if it isn't already. The problem is that Ubercart just uses the imagefield module for product images. There must be some way to make this easier for people to create grid type views with just the primary image...help?
Comment #14
johnflower commentedI also would like to see support for replicating UBercart's default display of images in the Product node. It would be nice to have the first image large, and the following images smaller.
Comment #15
johnflower commented1) To replicate Ubercart's handling of images in the product node, try the Gallery Formatter module. http://drupalmodules.com/module/gallery-formatter whilst not exactly the same (it's better!) it can make the first image large and the following images smaller, and it puts them tidily underneath.
2) To have one image for the product grid, you could use Views to create the catalogue and restrict it to using the first image field. Or you could add a second image field for the thumbnails, and allow only one image for the default field and unlimited images for the second. Probably need to do a bit of work for formatting in the node, but the catalogue should be fine :)
Comment #16
swentel commentedNice comment in #15 - closing again.
Comment #17
milplus commentedGuys
I'm trying to collect a snapshot of my store products onto a Region of a Panel or View.
I done this before - now reinstalled all onto live page- this view does not work anymore.
I need to have a Multipage view with all items thumbnail paged onto there - however now I canno tlimit the view to one Image Thumbnail only but I get listed all produc images in column instead in row.
See enclosed what I need , as per thread above.