Hi David,
Is it possible to give the product images product name alt tags?
Thx
Henk
Hi David,
I'm trying to add the alt to the merchant logo show in prices/each (%MERCHANT_SEARCH_URL%)...
The logo's work, but I can't figure out how to add the alt. Can you please help me with this?
Thanks a lot!
Koen
Hello Koen,
There isn't a direct placeholder for the merchant name and whilst it can be picked up using %DB_merchant%, the script generates either the name or the logo image depending on whether the image exists, so to add the alt tag, look for the following code around line 103 in pto_product.php:
$merchant_html = "<img border='0' src='".$pto_config_externalBaseHREF."logos/".str_replace(" ","%20",$product->merchant)."' />";
...and REPLACE with:
$merchant_html = "<img border='0' src='".$pto_config_externalBaseHREF."logos/".str_replace(" ","%20",$product->merchant)."' alt='".htmlentities($product->merchant,ENT_QUOTES,get_settings("blog_charset"))."' />";
Cheers,
David.
--
PriceTapestry.com
Hello Henk,
Sure - you can do this entirely within the templates at wp-admin > Settings > PriceTapestry.org; where in each of the Search Results / Each, Featured Products / Each and Product / Main templates you'll find:
src='%IMAGE_URL%'
So at this point, you can insert your alt tags using the %PRODUCT_NAME% placeholder (if required) e.g:
src='%IMAGE_URL%' alt='Product Image of %PRODUCT_NAME%'
However, whilst on the product page replacement of %PRODUCT_NAME% does use htmlentities(), making it safe to use within the alt attribute of an img tag, for Search Results / Each and Featured Products / Each it does not; but that can be added easily. Look for the following code in both pto_search.php (line 449) and pto_featured.php (line 77)
$each = str_replace("%PRODUCT_NAME%",$row->name,$each);
...and REPLACE with:
$each = str_replace("%PRODUCT_NAME%",htmlentities($row->name,ENT_QUOTES,get_settings("blog_charset")),$each);
Cheers,
David.
--
PriceTapestry.com