Two parts here:
1) Can product-specific tokens be available for alt/title on product images? ie. have the product's imagefield default to the product name for the alt and title
2) Could custom alt/title be enabled by default? Especially since this is (or should be, doesn't seem to be working for me, unless this patch still hasn't been added to UC: http://www.ubercart.org/forum/support/8988/cant_get_titles_imagefield_di...) used as the caption in the lightbox popups

CommentFileSizeAuthor
#9 alt_title_tokens.patch399 bytesIsland Usurper
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR’s picture

For 1), how should this work? Right now alt and title are chosen (or not) by the admin when the product is created, on the product edit page, using the imagefield controls. Do you want these values to default to a token, something like [product-title]? That sounds like a good idea because it will provide a reasonable default, reducing the amount of work it takes to create a product. But what happens when you have multiple images per product, what should the naming be?

For 2), In beta5, the alt and title fields appear properly on the product view page and the title shows in the image captions with both Thickbox and Lightbox2. I'm not sure what you mean by "custom alt/title be enabled by default".

stephthegeek’s picture

1) Well, it already does support tokens. [product-title] just isn't one of them. See screenshot. I would assume it would just keep whatever behaviour was there for the other tokens for multiple images (haven't tested this but I assume it just uses the same for each?).

2) The default right now on install is NO alt/title as far as I can tell. You don't see a way to enter it on the form and there's no default, and probably don't even know the option exists buried in the field settings unless you're familiar with CCK.

TR’s picture

OK, I'm a bit confused about what you're saying. Maybe I'm just not tuned into the issue, so I'm going to be verbose and summarize what I know. Then you can point out the gap in my understanding.

When you create a product, on the node/#/edit page, you have the option to upload an image for the product. A textfield is presented titled "New Upload", and a button brings up a file browser. Once you have selected an image from your local filesystem and pressed the "Upload" button, the product edit page will show a preview thumbnail of the image and will now show two additional textfields called "Alternate Text" and "Title" which can then be filled in. These two values, if entered, show up in the alt and title properties of the image tag for that image. There is currently no default for the alt and title, but you *are* allowed to set them, and they show up properly in the HTML and in thickbox/lightbox if set. Your comments lead me to believe it doesn't work this way for you?

The CCK settings for the product image field (admin/content/node-type/product/fields/field_image_cache) control what the default alt and title values are. Right now, they are blank by default, but the "Enable custom alternate text" and "Enable custom alternate title" are checked by default, allowing the person creating the product to specify the alt and title values as I described above. This page indicates tokens may be used for these default values, but when I tried to do this just now, only the raw tokens appeared in the HTML. For example, I set the alt text to be [store-name] and the resulting HTML contained 'alt="[store-name]"'

My read of your initial post was that you want to have the alt and title text default to some reasonable value instead of being blank. I think that's a good idea because it makes it easier to create products and ensures that the important alt and title fields get set in all cases. My question about 1) was, what should that default be, and what things are missing that are needed to make this happen? One thing you've identified as missing is [product-title] token. OK. I think the post at http://www.ubercart.org/forum/support/9385/there_producttitle_token_can_... explains why node-specific tokens don't show up in this list for generic CCK imagefields. This can probably be worked around in a Ubercart-only solution by filling in these defaults in the product image theme function - that would allow product-specific values to be used even when the images are shared by several products or several nodes.

Do you recommend product image titles all default to [product-title] ? Or maybe default to the image filename (minus the .jpg, .gif, .png, etc. extension)? What should the default alt tag be?

stephthegeek’s picture

Right now, they are blank by default, but the "Enable custom alternate text" and "Enable custom alternate title" are checked by default

Aha, that's the part that I think we got confused on. On my installation (started out several versions ago, now upgraded to beta 5), this is NOT the case, and they were NOT checked by default.

I'm much less concerned if they actually are enabled by default. My concern is that it was totally non-obvious where and that you even could set that option.

I love the idea of having [product-title] as an available option in Ubercart as well though, that would make it much easier for large catalogs. I don't think a filename makes that much sense (although I'd like to see others' opinions on this, maybe others use more descriptive filenames).

I hadn't tried the other available tokens though, so that sounds like a separate issue if the existing ones don't even work.

thill_’s picture

Hey guys, great conversation a very important SEO item (Image Titles), I wanted to point this thread to our other thread on the same subject. http://www.ubercart.org/forum/support/9385/there_producttitle_token_can_...

It is my understanding that node-title and product-title tokens are the exact same thing correct?

From talking to the imagefield people it seems as though the reason node tokens are not available for use is because the token is associated with the image not the node. I am trying to say that in the database the ALT and Title are kept with the image filed table not the node table. Technically an image can be moved from one node to another, so they did no want to associate node tokens with images.

This can be overcome of course, I just wanted to point out why imagefield doesn't support node tokens.

TR’s picture

stephthegeek: I think we understand each other now! +1 for your feature request of adding a default title & default alt text to product images, using the product title to fill in both. This will be the desired value for many/most cases, save effort when creating products, and ensure both the title and alt text are filled in for SEO and accessibility.

thill: Yup, I cited your thread above, in #3. Hence my idea on how to implement:

This can probably be worked around in a Ubercart-only solution by filling in these defaults in the product image theme function - that would allow product-specific values to be used even when the images are shared by several products or several nodes.

stephthegeek’s picture

mgifford’s picture

Issue tags: +Accessibility

adding accessibility tag

Island Usurper’s picture

Status: Active » Fixed
FileSize
399 bytes

I've played around with imagefield_tokens, and I think it works pretty well. I guess if it's enabled, the default image field added by Ubercart should be '[title]' by default.

Patch committed.

Status: Fixed » Closed (fixed)
Issue tags: -theme layer, -Accessibility

Automatically closed -- issue fixed for 2 weeks with no activity.