You are here:  » apply alt & title tag to products page

Support Forum



apply alt & title tag to products page

Submitted by webie on Wed, 2007-08-01 00:26 in

Hi Dave,

I am trying to apply title tag to link 'Review This Product' but i can't seem to work out how to do this.

many thanks

Darren

Submitted by support on Wed, 2007-08-01 08:09

Hi Darren,

The code that generates that link is actually in products.php and not the HTML module as it is displayed conditionally rather than all the time.

Look for the following code on line 41:

$rows[$k]["extraHTML"] = "<p><a href='".$rows[$k]["reviewHREF"]."'>".translate("Review This Product")."</a></p>";

You should be able to add the title tag as follows:

$rows[$k]["extraHTML"] = "<p><a title='Your Title Here!' href='".$rows[$k]["reviewHREF"]."'>".translate("Review This Product")."</a></p>";

Hope this helps!
Cheers,
David.

Submitted by webie on Thu, 2007-08-02 10:50

Hi David,

Cheers my friend

Submitted by webie on Thu, 2007-08-02 11:18

Hi David;

I am trying to get code to print product name inside the title tag but once again
having trouble as still a big learning curve this what i have got so far can you point out what i am doing wrong please

Many Thanks David

$rows[$k]["extraHTML"] = "<p>".tapestry_stars($rows[$k]["rating"],"")."&nbsp;<a title='Click here read product reviews for '" . $mainProduct["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".$rows[$k]["reviews"]." ".translate("Reviews")."</a></p>";

Submitted by support on Thu, 2007-08-02 12:53

Hi Darren,

The $mainProduct variable has not been established at that point in the code, so you will need to use $rows[$k]["name"] instead. Try this:

$rows[$k]["extraHTML"] = "<p>".tapestry_stars($rows[$k]["rating"],"")."&nbsp;<a title='Click here read product reviews for '" . $rows[$k]["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".$rows[$k]["reviews"]." ".translate("Reviews")."</a></p>";

Hope this helps!
Cheers,
David.

Submitted by webie on Thu, 2007-08-02 17:30

Hi David,

For some reason thats not working on the above code all I get is the first part of the title tag saying 'Click here read product reviews for' and no product name is printed?.

Many Thanks

Darren

Submitted by support on Thu, 2007-08-02 17:39

Hi Darren,

Can you try this version which should access the same variable but a different way...

$rows[$k]["extraHTML"] = "<p>".tapestry_stars($rows[$k]["rating"],"")."&nbsp;<a title='Click here read product reviews for '" . $row["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".$rows[$k]["reviews"]." ".translate("Reviews")."</a></p>";

The change is from $rows[$k]["name"] to $row["name"]...

Hope this helps,
Cheers,
David.

Submitted by webie on Thu, 2007-08-02 23:20

Hi David,

Still don't seem to work just get the same printed out below os code in /products.php

very strange sorry to be a pain here is my code below

many thanks
Darren

 if ($config_useRewrite)
        {
          $rows[$k]["merchantHREF"] = "../merchant/".tapestry_hyphenate($row["merchant"])."/";
          $rows[$k]["reviewHREF"] = "../review/".tapestry_hyphenate($row["name"]).".html";
        }
        else
        {
          $rows[$k]["merchantHREF"] = "search.php?q=merchant:".urlencode($row["merchant"]).":";
          $rows[$k]["reviewHREF"] = "reviews.php?q=".urlencode($row["name"]);
        }
        if ($config_useInteraction)
        {
          if ($rows[$k]["reviews"])
          {
$rows[$k]["extraHTML"] = "<p>".tapestry_stars($rows[$k]["rating"],"")."&nbsp;<a title='Click here read product reviews for '" . $row["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".$rows[$k]["reviews"]." ".translate("Reviews")."</a></p>";
           // $rows[$k]["extraHTML"] = "<p>".tapestry_stars($rows[$k]["rating"],"")."&nbsp;<a title='Click here read product reviews for '" . $mainProduct["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".$rows[$k]["reviews"]." ".translate("Reviews")."</a></p>";
          }
          else
          {
            $rows[$k]["extraHTML"] = "<p><a title='Click here to write your own personal review on'" . $rows[$k]["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".translate("Write review On This Product")."</a></p>";
          }
        }
      }

Submitted by support on Fri, 2007-08-03 08:16

Hi Darren,

I've just noticed that there is an extra ' infront of the product name, which is effectively breaking the HTML at the point just before the product name is inserted. Try this:

 if ($config_useRewrite)
        {
          $rows[$k]["merchantHREF"] = "../merchant/".tapestry_hyphenate($row["merchant"])."/";
          $rows[$k]["reviewHREF"] = "../review/".tapestry_hyphenate($row["name"]).".html";
        }
        else
        {
          $rows[$k]["merchantHREF"] = "search.php?q=merchant:".urlencode($row["merchant"]).":";
          $rows[$k]["reviewHREF"] = "reviews.php?q=".urlencode($row["name"]);
        }
        if ($config_useInteraction)
        {
          if ($rows[$k]["reviews"])
          {
$rows[$k]["extraHTML"] = "<p>".tapestry_stars($rows[$k]["rating"],"")."&nbsp;<a title='Click here read product reviews for " . $row["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".$rows[$k]["reviews"]." ".translate("Reviews")."</a></p>";
           // $rows[$k]["extraHTML"] = "<p>".tapestry_stars($rows[$k]["rating"],"")."&nbsp;<a title='Click here read product reviews for '" . $mainProduct["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".$rows[$k]["reviews"]." ".translate("Reviews")."</a></p>";
          }
          else
          {
            $rows[$k]["extraHTML"] = "<p><a title='Click here to write your own personal review on " . $rows[$k]["name"] ."' href='".$rows[$k]["reviewHREF"]."'>".translate("Write review On This Product")."</a></p>";
          }
        }
      }

That should do the trick!
Cheers,
David.