Hi David,
Following your advice in the other thread, I managed to include the search.php page - albeit empty!
I've been reading around the forum all day to try and work out how to stick the search results for a particular product query on a particular page.
I used the post here - http://www.pricetapestry.com/node/1740 - to create a page at - featuredbrands.co.uk/shop/tshirts.php, (/shop is PT) just to check it works before trying to include it on a WP post. It does...
Yet I stick the same code on a wordpress post:
<?php
// now preload $_GET["q"] to be the query you want to display search results for
$_GET["q"] = "t shirt";
// now bring in the search code
require(ABSPATH. '/shop/searchcode.php');
// now use Price Tapestry's search results HTML module to display the results
require(ABSPATH. '/shop/html/searchresults.php');
?>
... and get the lovely database error here - http://www.featuredbrands.co.uk/adidas-clothing/adidas-t-shirts/
I suspect it's due to some sort of conflict between WP and PT - but that's as far as my technical knowledge goes! I've tried searching for $sql, $link and $rows in the wordpress files but no matches - could any of the other bits in this file be conflicting?
Or maybe it could be something to do with global variables (whatever they are) - here's what the plugin creator has to say about them - http://bluesome.net/post/2005/08/18/50/#globals.
Hope I've given as much information as possible there :)
Thanks
Ah, great, thanks David!
Hmmm I now get the following error though:
Fatal error: Cannot redeclare tapestry_search() (previously declared in /home/featured/public_html/shop/includes/tapestry.php:2) in /home/featured/public_html/shop/includes/tapestry.php on line 7
Again, it works perfectly outside of WP.
The code being used in the post is as you just posted.
(Also got the same thing with javascript_focus(), but temporarily deleted the contents of that file to see what would happen...)
Hi Harvey,
Sorry - that implies that the includes are already "included". Could you undo this change, and also email me searchcode.php and i'll take a look at the error and check searchcode.php out for you...
Cheers,
David.
^ Just to add, I was including common.php in searchcode.php (which is search.php minus the header include).
When I delete require("includes/common.php"); from searchcode.php, I get the string of MYSQL invalid link errors :(
Cheers
Hi Harvey,
Just incase you missed my reply above (I think we cross-posted), if you want to send me your searchcode.php i'll take a look for you...
Cheers,
David.
Hi David, did indeed, let me know if you didn't get it; it was your gmail address right?
Hi Harvey,
If you're not doing already, you'll need to include common.php first, for example:
<?php
// now preload $_GET["q"] to be the query you want to display search results for
$_GET["q"] = "t shirt";
// now bring in the search code
require(ABSPATH. '/shop/includes/common.php');
require(ABSPATH. '/shop/searchcode.php');
// now use Price Tapestry's search results HTML module to display the results
require(ABSPATH. '/shop/html/searchresults.php');
?>
Cheers,
David.