Hi,
I have created a custom search box on the homepage of my wordpress
installation, and I am having difficulty in getting the box to work.
I am not using [pto] on the homepage.
I have included the raw code below:
<form action='/search' id='search-form' method='get' target='_top'>
<input id='search-text' name='q' placeholder='Search for eg. "Whey Protein"' type='text'/>
<button id='search-button' type='submit'><span>Search</span></button>
</form>
---------------------------------
Also, is it possible to display the most popular products on the homepage with
custom variables?
Thanks.
Norbert
Hi Norbert,
Assuming that /search (to where you are submitting the form) is your container permalink page, then the only change required to the form would be to use name="pto_q" for the text box input field rather than name="q" - that should be all it is.
Popular products can be tied in quite easily. First of all, you would need to add the `views` field to your products table, as described in this thread on PriceTapestry.com. With that in place, to update `views` within the plugin, in pto_product.php, look for the following code at line 271 within the pto_product() function:
$html = "";
...and REPLACE with:
$html = "";
$sql = "UPDATE `".$pto_config_databaseTablePrefix."products` SET views=views+1 WHERE normalised_name = '".$wpdb->escape($pto_product)."'";
$wpdb->query($sql);
Finally, to make a custom Featured Products handler for the "popular" section name, in pto_featured.php look for the following code at line 25:
if ($section)
...and REPLACE with:
if ($section="popular")
{
$sql = "SELECT name,1 AS sequence FROM `".$pto_config_databaseTablePrefix."products` ORDER BY views DESC LIMIT 3";
$section = "";
}
elseif ($section)
...and then on your homepage, add the shortcode
[pto featured="popular"]
Hope this helps!
Cheers,
David.
--
PriceTapestry.com