You are here:  » Displaying Additional Database Fields in the searchresults ?


Displaying Additional Database Fields in the searchresults ?

Submitted by alecs on Tue, 2011-11-08 17:20 in
Submitted by support on Tue, 2011-11-08 17:29

Hi Alecs,

Sure - in pto_search.php search for this code at line 506 (BETA3)

    $html .= $each;

...and REPLACE with:

    if (strpos($each,"%DB_"))
    {
      preg_match_all('/%DB_(.*)%/U',$each,$matches);
      foreach($matches[1] as $field)
      {
        $each = str_replace("%DB_".$field."%",$product->$field,$each);
      }
    }
    $html .= $each;

And this will add support for %DB_fieldname% to Search Results/Each.

Cheers,
David.

Submitted by alecs on Tue, 2011-11-08 18:01

mh ... doesnt shows any error on the searchresults, but also nothing else ... ;-)

cheers
alecs

Submitted by support on Tue, 2011-11-08 18:16

Hi alecs,

Could you email me your modified pto_search.php and I'll check it out..

Thanks,
David.

Submitted by alecs on Thu, 2011-11-10 05:54

hi david,

thanks ! works well !!!

it would very helpfull to use the placeholders (%%) globaly. i need it because i like to display
the merchantnames and jumplinks etc. in the searchresults for a precompare.

cheers
alecs

Submitted by support on Thu, 2011-11-10 10:42

Hi Alecs,

I'm going to release a BETA3 update later today with %DB_fieldname% support for all HTML templates for which a product is in scope...

Cheers,
David.