Closed (fixed)
Project:
ImageField
Version:
6.x-3.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2009 at 02:39 UTC
Updated:
2 Mar 2011 at 23:38 UTC
I'm using Ubercart with Imagefield CCK.
I've just realized that I haven't set the Title and Alt Text for any of the images of any of my products. I now have about 200 products.
I've figured out how to set the default value using a token for Title and Alt Text in the CCK field settings, but this only works for new nodes created from this point forward.
How to set it for all the previous 200 nodes/images that I have already created without going in and manually editing each one?
I just want to set [title] token for all values.
If you could specify which table/field this is stored in, I could just do it with a SQL statement.
Cheers.
Comments
Comment #1
quicksketchThe table depends on what content types you've added the ImageField to. Since you're using it with Ubercart, my guess is that the table is "content_type_product", and the column is "field_product_image_title".
I would like to note though that if you just want all the titles on the whole site to be the node title, you'd be better off theming your node-product.tpl.php file and setting the title attribute directly in HTML, rather than storing two database columns with the exact same information.
Comment #2
cookiesunshinex commentedI do not have "field_product_image_title" in my content_type_product.
However, this is a default field for the image content type.
I have found where the value is stored. It's in "content_field_image_cache" table in the "field_image_cach_data" column, but it's the actual name of the Title and Alt text, not the token "[title]"
I don't really agree with you because these two field are not custom CCK fields that I have added, they are fields that are available with any image.
It looks like the only way to do this is to manually edit and save each previously created node.
Comment #3
quicksketchI'm just saying that if your node title is identical to your image title, it makes no sense at all to have the title field enabled within the image field. Despite ImageField "providing" this field for you, there's no point in storing the exact data in two places. Right now you're experiencing the exact reason why this is a bad idea, since one of your columns (the image title) contains stale data. Down the road you might decide to change the image titles to "Caption: [title]" for example, and then you're going to resave every node on the entire site again? Oh well.
Comment #4
selinav commentedHello,
I'm also using ubercart but I've not the token [title] available, how to do to have it?
I have only
[site-login]
[site-logo]
[store-name]
[store-url]
[store-link]
[store-owner]
[store-email]
[store-phone]
[store-address]
[store-help-url]
[user-name]
[user-id]
[user-mail]
[site-url]
[site-name]
[site-slogan]
[site-mission]
[site-mail]
[site-date]
[site-date-yyyy]
[site-date-yy]
[site-date-month]
[site-date-mon]
[site-date-mm]
[site-date-m]
[site-date-ww]
[site-date-date]
[site-date-day]
[site-date-ddd]
[site-date-dd]
[site-date-d]
[page-number]
Thanks in advance
Comment #5
quicksketchselinav, your request is not related to this issue. I'm closing this issue after lack of activity.
Comment #6
nooysters3 commentedI used this to update mine... I tried theming but it was a pain because of lightbox2 and imagcache to get all the right functions in there, I'm sure I could have figured it out but I got lazy and knew how to do this...
I would be very careful doing this and back up the db. You will also have to change the CONCAT string to meet your specific needs.
UPDATE content_field_image_cache cc RIGHT JOIN node up ON cc.nid = up.nid
SET cc.field_image_cache_data = CONCAT('a:2:{s:3:"alt";s:',CHAR_LENGTH(up.title),':"' ,up.title,'";s:5:"title";s:',CHAR_LENGTH(up.title),':"', up.title ,'";}')
WHERE up.type = "product"
If this was a crazy or stupid thing to do someone please let me know and tell me the right way... its always trial by fire around here:) It worked anyway after I flushed image cache. Theres also a patch you need to get alt and titles to show up at all in ubercart here-> http://www.ubercart.org/forum/support/8988/cant_get_titles_imagefield_di...