You are here:  » Search Form not appearing properly


Search Form not appearing properly

Submitted by fstore on Wed, 2011-11-02 08:24 in

Hi David
I have the following code in html "search form".

<div class=\'pto_search_form\'>
<form method=\'GET\' action=\'%ACTION%\'>
<input type=\'text\' size=\'35\' name=\'pto_q\' value=\'%PTO_Q%\' />
<input type=\'submit\' value=\'Search\' />
<br />Search or browse by <a href=\'%MERCHANTBASEHREF%\'>merchant</a>, <a href=\'%CATEGORYBASEHREF%\'>category</a> or <a href=\'%BRANDBASEHREF%\'>brand</a>
</form>
</div>

And I have [PTO] in html code of my home page. But search form is not appearing right on the page.
There is "\'\'" showing in search field and showing "\'Search\'" instead of button.

you can view it at {link saved}

Please advise what could be wrong.

Thanks

Submitted by support on Wed, 2011-11-02 09:22

Hi Hassan,

That indicates to me that magic quotes are somehow being handled incorrectly on your server. Magic quotes are a way that PHP automatically prefixes quote characters in any POSTed input (such as when you save the settings with a back-slash) which is designed to make input safe for use in SQL; however both WordPress and Price Tapestry will handle this automatically, and the feature has even been deprecated in version 6.

Before making configuration changes first of all I would suggest editing that section and replacing

\'

with just

'

Then save the settings, and review the page to see if the \ characters have re-appeared. If not, the search form should then display correctly but otherwise let me know and i'll help you look at the PHP configuration to disable magic_quotes_gpc...

Cheers,
David.

Submitted by fstore on Wed, 2011-11-02 09:25

I think I have found the reason, there were extra "\" in the code in pto_default.php. becuase i copied from the php file and paste into html search form plugin setting. After removing them all it looks good.

1- Can data from pto_default.php automatically filled into html area of pricetapestry plugin? or we have copy and paste, "/" came when i copied and paste.

2- How can I convert the WP search form into PT search form? I did that before but i lost my code.

WP search form

<form method="get" class="searchform" action="<?php echo home_url(); ?>/" onsubmit="this.submit();return false;">
<fieldset>
<input type="text" value="<?php _e('Search','pagelines');?>" name="s" class="searchfield" onfocus="if (this.value == '<?php _e('Search','pagelines');?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search','pagelines');?>';}" />
<input type="image" class="submit btn" name="submit" src="<?php echo PL_IMAGES;?>/search-btn.png" alt="Go" />
</fieldset>
</form>

Can I change it to this?

<form method="get" class="searchform" action="%ACTION%" onsubmit="this.submit();return false;">
<fieldset>
<input type="text" value="<?php _e('Search','pagelines');?>" name="s" class="searchfield" onfocus="if (this.value == '<?php _e('Search','pagelines');?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search','pagelines');?>';}" />
<input type="image" class="submit btn" name="submit" src="<?php echo PL_IMAGES;?>/search-btn.png" alt="Go" />
</fieldset>
</form>

Submitted by support on Wed, 2011-11-02 09:46

Hi Hassan,

Ah - that would explain it - the values in pto_default.php are PHP strings with quote characters escaped. You could paste directly in but any \ characters preceding a ' or " character would need to be deleted, that's all.

Regarding the form, the default WordPress search form is only (unless included by your theme separately) included as a widget, so what you can do is to remove the WordPress Search widget and replace with the PriceTapestry.org search widget; which has its own HTML template section in wp-admin > Settings > PriceTapestry.org (Search Widget) if you wish to make any changes...

Cheers,
David.