Hi David,
It's been a while since I posted on here, I hope you've been well. Can you tell me if it's possible to have a price comparison table for each product in searchresults.php. By doing this I'm removing the need for a link to product.php for each product. Can you think of any disadvantages to this? I'm using PT for Wrodpress as well. Thanks.
Allan
Thanks David,
I'll give it a try this evening. Loving your work as always!
Morning David,
I gave the code a go and I get this error msg:
Fatal error: Cannot use object of type stdClass as array in /public_html/wp-content/plugins/pto/pto_search.php on line 562
Do you know what could be causing it? Thanks
Sorry Allan, all corrected above had used array rather than object style access of the $row variable, but also missed out the call to $wpdb->query()...
Cheers,
David.
--
PriceTapestry.com
Hello Allan,
No problem!
In pto_search.php, look for the following code at line 557:
$each = str_replace("%PRODUCT_URL%",pto_common_productHREF($row),$each);
...and REPLACE with:
$each = str_replace("%PRODUCT_URL%",pto_common_productHREF($row),$each);
global $pto_config_databaseTablePrefix;
global $pto_productResults;
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE name = '".$wpdb->escape($row->name)."' ORDER BY price";
$wpdb->query($sql)
$pto_productResults = $wpdb->last_result;
$each = str_replace("%PRICES%",pto_product_prices(),$each);
And then in your Search Results / Each template, use the place holder %PRICES% at the point at which you wish the price comparison table to be inserted. It will appear exactly as it does on the product pages, using the Prices Before / Each / After templates.
Hope this helps!
Cheers,
David.
--
PriceTapestry.com