You are here:  » Filter not carrying pto_q due to changes wordpress

Support Forum



Filter not carrying pto_q due to changes wordpress

Submitted by michael on Fri, 2012-09-07 14:31 in

Hi David
i have a problem because im passing lots of value with get i think the filter has stopped carrying the value for pto_q accross onto the filtered search page im guessing it will just be a case of altering the ? to an & but i dont understand at which point this seems to have gone wrong, also i need to carry the extra data accross onto the filtered page aswell.

just to clarify what i think has gone wrong is that the pto_q did have a ? before but with the changes ive made it now has & in front of it.

Thanks

Best Regards,

Michael.

Submitted by support on Fri, 2012-09-07 14:50

Hi Michael,

Could you post 2 examplified URLs; the first a working URL and then also the follow on link being generated incorrectly on that page. I should be able to work out from that which part of the code is generating the follow on URL and why it isn't being based correctly in this case...

Thanks,
David.
--
PriceTapestry.com

Submitted by michael on Fri, 2012-09-07 15:37

Hi David

Thanks for the speedy reply,

here is a link to a normal search the search is best western {link saved}

then this is the link when filtered {link saved}

the second link wont let you stay on the page because pto_q has no value and i have set it to divert back to home if nothing is entered.

i also need to add all the get fields from the first url to the filter url when it goes across to the filtered page.

Best Regards,

Michael

Submitted by support on Sat, 2012-09-08 07:47

Hello Michael,

Regarding pto_q not being propagated check your HTML template for the search filters widget (wp-admin > Settings > PriceTapestry.org) where it should contain:

<input type='hidden' name='pto_q' value='%PTO_Q%' />

...but I think %PTO_Q% may have gone missing in your template. %PTO_Q% is replaced out with the actual value of pto_q in pto_search.php by the following code at line 918:

$html = str_replace("%PTO_Q%",$pto_q,$html);

...which is also where you can also add hidden fields for each of your custom URL parameters. On the line after the above point, add this new code:

$custom = "";
$custom .= "<input type='hidden' name='fromdate' value='".htmlentities($_GET["fromdate"])."' />";
$custom .= "<input type='hidden' name='todate' value='".htmlentities($_GET["todate"])."' />";
$custom .= "<input type='hidden' name='nights' value='".htmlentities($_GET["nights"])."' />";
// add similar lines for any other custom fields
$html = str_replace("</form>",$custom."</form>",$html);

Cheers,
David.
--
PriceTapestry.com

Submitted by michael on Sat, 2012-09-08 14:00

Hi David
Thanks for your help that was whats wrong sorted now

not sure if should start another topic but, since the update to pto and pto_search on certain searches theres an error being thrown in_array() expects parameter 2 to be array, null given in pto_search.php on line 203 i cant understand why this is happening. when i first did the change before i moved the widgets it was throwing the same error but that stopped when i moved them to before the price tapestry content.

but when we search for certain words it throws the error again. is there a way to switch error reporting off unless we need it as the api's we make requests from may occasionally give bad data and cause errors to be thrown in our api code

heres a {link saved} to the search thats trowing the error, so far ive only noticed it doing it on this specific search but there could be more dont know.

Thanks

Best Regards,

Michael.

Submitted by support on Mon, 2012-09-10 08:59

Hi Michael,

I can see the cause of the warning regarding some searches in your re-arranged code. To resolve this, in the modified file that I sent to you look for this code at line 79:

  require_once("pto_stopwords.php");

...and REPLACE with:

  require("pto_stopwords.php");

Regarding warning messages in general; normally you would control this through your PHP configuration (php.ini etc.) but you could simply add the following line to the end of your wp-config.php:

  ini_set('display_errors','off');

Cheers,
David.
--
PriceTapestry.com

Submitted by michael on Wed, 2012-09-12 18:40

Thanks Again David
Thats sorted it.

Best Regards,

Michael