You are here:  » Metatags on product page


Metatags on product page

Submitted by henk on Tue, 2013-02-05 20:06 in

Hi David,

I am trying to us %db_brand% in metatagswhat must change in the script to use it?

Thx
Henk

Submitted by support on Tue, 2013-02-05 22:28

Hi Henk,

In pto.php look for this code around line 389:

      $sql = "SELECT name FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name='".$wpdb->escape($pto_product)."' LIMIT 1";
      if ($wpdb->query($sql))
      {
        $pto_productName = $wpdb->last_result[0]->name;
      }

...and REPLACE with:

      $sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name='".$wpdb->escape($pto_product)."' LIMIT 1";
      if ($wpdb->query($sql))
      {
        $pto_productName = $wpdb->last_result[0]->name;
        global $pto_productRecord;
        $pto_productRecord = $wpdb->last_result[0];
      }

Then further up the script, look for this code at line 192:

      $keywords = str_replace("\n"," ",$keywords);

...and REPLACE with:

      $keywords = str_replace("\n"," ",$keywords);
      global $pto_productRecord;
      preg_match_all('/%DB_(.*)%/U',$keywords,$matches);
      if (is_array($matches[1]))
      {
        foreach($matches[1] as $field)
        {
          $keywords = str_replace("%DB_".$field."%",$pto_productRecord->$field,$keywords);
        }
      }

And finally the following code at line 211:

      $description = str_replace("\n"," ",$description);

...and REPLACE with:

      $description = str_replace("\n"," ",$description);
      global $pto_productRecord;
      preg_match_all('/%DB_(.*)%/U',$description,$matches);
      if (is_array($matches[1]))
      {
        foreach($matches[1] as $field)
        {
          $description = str_replace("%DB_".$field."%",$pto_productRecord->$field,$description);
        }
      }

Cheers,
David.
--
PriceTapestry.com