tags:

views:

182

answers:

3

I am currently tring to add in alt img tags for an existing website running the interspire shopping cart platform, I have gotten pretty close I bleieve, but i cannot seem to get it right. Any help would be grealty appreciated.

// Is there a thumbnail image we can show? 
$thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb(); 
$alttext = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductName(); 

if($thumb == '' && GetConfig('DefaultProductImage') != '') {
   if(GetConfig('DefaultProductImage') == 'template') {
     $thumb = GetConfig('ShopPath').'/templates/'.GetConfig('template').'/images/ProductDefault.gif'; 
     } else { 
        $thumb = GetConfig('ShopPath').'/'.GetConfig('DefaultProductImage'); 
     } 
  $thumbImage = '<img src="'.$thumb.'" alt="->GetProductName" />'; 
} else if($thumb != '') { 
    $thumbImage = '<img src="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.$thumb.'" alt=""'.$alttext.'" />';
}

I have tried posting the code but it says new users cannot post image tags for some reason

A: 

It looks to me like you have two double quotes after you open the alt attribute, then the text, then another closing quote.

ylebre
A: 

This line won't work

$thumbImage = '<img src="'.$thumb.'" alt="->GetProductName" />';

You probably want something like this

$thumbImage = '<img src="'.$thumb.'" alt="'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductName().'" />'; 

//or as you have already set $alttext:
$thumbImage = '<img src="'.$thumb.'" alt="' . $alttext . '" />';
Tom Haigh
I tried both and Im still not getting any alt tags =/
A: 

ylebre meant: (scroll the code box to the right)

} else if($thumb != '') { 
    $thumbImage = '<img src="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.$thumb.'" alt=""'.$alttext.'" />';
}
                                                                                                        ^
                                                                                                        |

there is one extra " at the end!

} else if($thumb != '') { 
    $thumbImage = '<img src="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.$thumb.'" alt="' . htmlspecialchars($alttext) . '" />';
}
Schnalle
I fixed that actually before I posted this and I am still not getting alt tags im not sure whats going on but I think im starting to lose it lol
When you load the site and view the source it still comes back as a blank alt tag like [Code]alt=""
is there even any content in "$alttext = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductName();"?
Schnalle
There is content in the getproductname, I am honestly just debating paying someone to fix it to get it over with.
i can only think of 2 possibilities: 1. $alttext is empty, because "$GLOBALS['ISC_CLASS_PRODUCT']->GetProductName();" doesn't return the expected value, or 2. the rendering codeblock is not the one drawing the actual images. you can verify both by inserting logging statements. i recommend FirePHP.
Schnalle