Wordpress search form by category not working? - wordpress

Objective
I am trying to create different search forms for two different landing pages. Thus, users who end up on landing page A will only be able to search for products with categories Man and Book. Users landing on page B will only be able to search for products with categories Beast and Funny.
Here is my example setup in WooCommerce.
What I have tried
Based on this link, I have tried the following search function for page A.
<form role="search" method="get" id="searchform" action="https://test.com/">
<div>
<label for="s">Search for (Man and Book):</label>
<input type="text" value="" name="s" id="s" />
<input type="hidden" value="1" name="sentence" />
<input type="hidden" value="product" name="post_type" />
<input type="hidden" value="product_cat" name="man,book" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
Problem
If I key in GetAllX into the search form, I expect to see GetAllX (Copy 2) only. Instead, I see GetAllX (Copy 2) and GetAllX.
Also, when I key in test, I expect to see Test product 2 only. Instead, I see both Test product 2 and Test Product.
Questions
Why is WordPress behaving like this? Can someone help me out with this, please?
If there is an easier way to create search forms for different product categories based on landing pages, please do let me know.

Found the error. It was in this line:
<input type="hidden" value="product_cat" name="man,book" />
It should be instead:
<input type="hidden" value="man,book" name="product_cat" />
There was a typo in the article I linked to.

Related

How to pass custom amount with Bitpay hosted checkout form?

I am looking to integrate BitPay for processing bitcoin payments on one of my sites.
Their hosted checkout form (similar to PayPal checkout form) is easy to integrate however I don't know how I can pass order amount with the form so that the same checkout button can be used for different orders (payments).
Here's their page regarding hosted checkout: https://bitpay.com/help-hosted-checkout
Bitpay has clearly stated that we can pass different order amount but they have not provided any field for this on the above mentioned page. I have contacted them and they will reply in 3 days but since I need to integrate this at the earliest, I hope somebody here can help me fast.
Thanks.
I was also looking for help with a bitpay button for a project and found this question (and another one like it), so coming back to answer in case it can help others in the future: If you got your bitpay button code from the payment button option on bitpay, your code might look something like this:
<form action="https://test.bitpay.com/checkout" method="post">
<input type="hidden" name="action" value="checkout" />
<input type="hidden" name="posData" value="" />
<input type="hidden" name="price" value="<?php echo $price_var;?>" />
<input type="hidden" name="data" value="...(your data value)..." />
<input name="checkout" type="submit" value="Checkout" class="form-button-submit button"/>
</form>
Having the line of code with 'name="price"' allows you to set a global variable (potentially your shopping cart total) as an order amount. Hope this helps!

POST request to Paypal ignoring parameters

Good afternoon,
I'm attempting to send a POST request from my ASP.NET web app to the paypal API to process a payment. The code below is the standard generated button code from the developer site with a few more parameters added by me.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="business" value="testseller#mydomain.co.uk" />
<input type="hidden" name="hosted_button_id" value="myvalue"/>
<input type="hidden" name="item_name" value="<%:Article%>"/>
<input type="hidden" name="amount" value="<%Price%>"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
</form>
However when the paypal payment screen loads, it has reverted the cost to 0.01 US dollars and seemed to ignore my parameters. On inspection, the <%:Price%> variable is reading as I would expect. Is there anything glaring I'm doing wrong in the above HTML?
If you are using Hosted Button which is saved on PayPal side, you cannot edit the button code. PayPal will ignore any additional variable added / update to the button code. If you want to pass dynamic variables to PayPal end, then you should use non hosted button.

Integrating a custom built form with a subscriber list provider (Aweber)

I have created my own form because every other form out there for WordPress is horrible.
div class="exc-form">
<form action="action_page.php">
<fieldset>
<div id="form_jgrsh">
First name:<br>
<input type="text" name="firstname" placeholder="Please enter first name">
<br>
Last name:<br>
<input type="text" name="lastname" placeholder="Please enter last name">
<br>
Email:<br>
<input type="text" name="email" placeholder="Please enter email">
<div class="chk_bx">
<input type="checkbox" name="concent" value="agree">By entering my information and pressing submit I agree to subscribing to the Stockhouse AND Junior Gold Report (please check box before submiting)
<br>
</div>
<input type="submit" class="submit-btn" value="Submit">
</div>
</fieldset>
</form>
It's super simple and isn't anything special. I'm under the impression PHP will be needed as well.
I use Aweber as my list provider, and I've contacted them for support and they want me to use their horrible, ugly form builder, and won't help me integrate my own form to use their list.
I've never done something like this before, so I'm looking for some guidance on how to send subscriber information to a list. Aweber offer's a list ID and most plugins I've seen require a Aweber authentication before Aweber links up to the list.
https://labs.aweber.com/snippets/lists - this is as closest to the resources I could find from Aweber.
Here is the authentication list: https://labs.aweber.com/snippets/authentication

Text Input Types with Gravityforms

I currently build a complex form with gravityforms. What i need is an area where i have some text and in between the text are some input-fields to complete the text paragraph.
EXAMPLE.
I,"name-inputfield"____, agree to be available between__"text-inputfield"__ and ____.
I already created that in a html editor and placed the code into a HTML Box of Gravityforms but if submit the information are not delivered. I believe i forget something inside the formcode.
I attached the code below
I, <input type="text" name="" value="NAME" size="40">(for myself and my heirs and legal representatives) of<br>
<input type="text" name="" value="STREET ADDRESS" size="40"><input type="text" name="" value="CITY" size="20" maxlength="20"><input type="text" name="a78" value="ST" size="2" maxlength="2"><input type="text" name="" value="ZIP" size="10" maxlength="10"><br>
hereby release Blanca's house Corp., its agents, representatives, directors, employees, contractors, insurers, and members from any and all responsibility and liability involving arising out of, or related to the planned medical mission scheduled to <span class=""><input type="text" name=" " value="" size="20" maxlength="20">starting on <input type="text" name="" value="" size="20" maxlength="20"> through <input type="text" name="" value="" size="20" maxlength="20"> 20<input type="text" name="" value="" size="2" maxlength="2">, including (without limitation) liability regarding my health or safety or my personal property.
Would be great if anybody could help me, because i never did something like this.
Here is also a screenshot of how it looks inside the browser http://awesomescreenshot.com/01e2la0ibc
Thanks a lot for any help
Inputs inside the content of the HTML field will not be captured by Gravity Forms. They aren't "registered" by Gravity Forms so it doesn't know they exist.
There are two alternatives for what you are trying to accomplish.
You can add the fields via Gravity Forms and then style them to be inline. Here is a great example of how this can be accomplished:
http://www.rocketgenius.com/gravity-forms-mad-lib-style-form-demo/
You can add the fields via Gravity Forms and then output the submitted values in an HTML field on a second page. Here is a example of this using my product GP Preview Submission: http://demos.gravitywiz.com/gp-preview-submission/

Wordpress search form not passing get variables

I have an issue where I am creating a simple custom search form in Wordpress 3.4 sitting in a template file.
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>">
<input type="text" value="" name="s" id="s" />
<input type="hidden" name="search-type" value="vacancies" />
<input name="submit" type="submit" value="Go" />
</form>
Upon submitting it hits a search.php file where further processing takes place.
<?php print_r($_GET); ?>
The problem is that I cannot access the get variables in search.php. I can echo here so I know I'm definitely hitting search.php but my get array is empty every time.
Any ideas would be a big help. I feel I may be making a rookie mistake...
I was having this problem too. The theme I am using (Roots) does some fancy rewriting of the search page URLs. So, searching for "french holiday" will be site.com/search/french+holiday instead of site.com/?s=french+holiday.
If you can't see the variable in the URL, you won't be able to access it using $_GET.
I changed back to the standard URLs and can now access my $_GET values.
Hope that helps.

Resources