Wordpress Search Function With Mutiple Text Inputs - wordpress

I need to create a wordpress search function with multiple text inputs
This is the code I have right now, which works fine. It searches for the keyword in the custom post type of "project_posts"
<form role="search" action="/" method="get" id="searchform">
<input type="text" name="s" placeholder="Search Projects"/>
<input type="hidden" name="post_type" value="project_posts" />
<input type="submit" alt="Search" value="Search" />
</form>
But what I want is something like this, with multiple text inputs.
<form role="search" action="/" method="get" id="searchform">
<input type="text" name="s" placeholder="Keyword"/>
<input type="text" name="s" placeholder="Location"/>
<input type="text" name="s" placeholder="Category"/>
<input type="text" name="s" placeholder="Material"/>
<input type="hidden" name="post_type" value="project_posts" />
<input type="submit" alt="Search" value="Search" />
</form>
This is how the client wants it, so that's what I need to provide.
Unfortunately, this code doesn't quite work. It generates this URL
example.com/?s=&s=&s=&s=&post_type=project_posts
And it only uses whatever is in the last search box for the actual search.
I'm a bit stuck with this one, any help is greatly appreciated.

Related

Obtain data from a form in wordpress

I'm building a wordpress website using Avada tamplate. I use the Avada login form in which the users insert their username and password. I would like to get the username of the user when he click on the form button and he's redirect to login.php page. I don't understand why I can't do that.
The code of the form (i removed "class" and "style" in order to reduce it) is:
<form name="loginform" id="loginform" method="post" action="http://www.mywebsite.com/es/wp-login.php">
<div>
<div>
<label for="user_login">Username</label>
<input type="text" name="log" placeholder="Username" value="" size="20" id="user_login" />
</div>
<div>
<label for="user_pass">Password</label>
<input type="password" name="pwd" placeholder="Password" value="" id="user_pass" />
</div>
</div>
<div>
<div>
<button type="submit" name="wp-submit">Log in</button>
<input type="hidden" name="user-cookie" value="1" />
<input type="hidden" name="redirect_to" value="login.php" />
<input type="hidden" name="fusion_login_box" value="true" />
<input type="hidden" name="_wp_http_referer" value="/es/area-privada/" /><span></span></div>
<div></div>
</div>
</form>
The login.php code is very simple:
<?php
$username = $_POST['log'];
echo $username;
?>
however the variable $username is blank and doesn't capture the username. Someone can help me please? thanks!

SAP OCI integration without SAP

Our supplier requires us to use SAP Open Catalog Interface to order goods.
However we do not have SAP, so I should implement it from scratch.
Has anyone done this and is willing to share his experience / hints on where to start etc.?
This is the OCI doc I follow.
I can't help you in implementing your system (too broad and not enough information - and off topic for this site :))
But I can give a process description to give you a start point.
Your supplier has to give you a link to the OCI-Shop (including login credentials).
You attach a parameter hookurl with your landing page to this URL.
So you get something like:
https://www.mysupplier.com/OCI/ocilogin?user=yourname&password=yourpassword&hookurl=https://example.net/oci_receive_from_supplier_X
When you call this URL, it directs you to the shop of the supplier, where you can select materials.
When you finished, you don't order, but you request the order data and the supplier sends a formula to your hookurl https://example.net/oci_receive_from_supplier_X
The formula data may look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<form name="SUBMITFORM" action="https://example.net/oci_receive_from_supplier_X" method="post" id="SUBMITFORM">
<input type="hidden" name="NEW_ITEM-MATNR[1]" value="">
<input type="hidden" name="NEW_ITEM-QUANTITY[1]" value="0000000000001">
<input type="hidden" name="NEW_ITEM-DESCRIPTION[1]" value="article description">
<input type="hidden" name="NEW_ITEM-VENDORMAT[1]" value="4711">
<input type="hidden" name="NEW_ITEM-PRICE[1]" value="56.95">
<input type="hidden" name="NEW_ITEM-CURRENCY[1]" value="EUR">
<input type="hidden" name="NEW_ITEM-UNIT[1]" value="PCE">
<input type="hidden" name="NEW_ITEM-LEADTIME[1]" value="5">
<input type="hidden" name="NEW_ITEM-LONGTEXT_1:132[]" value="article description">
<input type="hidden" name="NEW_ITEM-VENDOR[1]" value="987654">
<input type="hidden" name="NEW_ITEM-CONTRACT[1]" value="">
<input type="hidden" name="NEW_ITEM-CONTRACT_ITEM[1]" value="">
<input type="hidden" name="NEW_ITEM-MATGROUP[1]" value="12345678">
<input type="hidden" name="NEW_ITEM-EXT_CATEGORY_ID[1]" value="12345678">
<input type="hidden" name="NEW_ITEM-EXT_SCHEMA_TYPE[1]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD1[1]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD2[1]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD3[1]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD4[1]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD5[1]" value="">
<input type="hidden" name="NEW_ITEM-MATNR[2]" value="">
<input type="hidden" name="NEW_ITEM-QUANTITY[2]" value="0000000000001">
<input type="hidden" name="NEW_ITEM-DESCRIPTION[2]" value="other article description">
<input type="hidden" name="NEW_ITEM-VENDORMAT[2]" value="4712">
<input type="hidden" name="NEW_ITEM-PRICE[2]" value="65.07">
<input type="hidden" name="NEW_ITEM-CURRENCY[2]" value="EUR">
<input type="hidden" name="NEW_ITEM-UNIT[2]" value="PCE">
<input type="hidden" name="NEW_ITEM-LEADTIME[2]" value="5">
<input type="hidden" name="NEW_ITEM-LONGTEXT_2:132[]" value="other article description">
<input type="hidden" name="NEW_ITEM-VENDOR[2]" value="987654">
<input type="hidden" name="NEW_ITEM-CONTRACT[2]" value="">
<input type="hidden" name="NEW_ITEM-CONTRACT_ITEM[2]" value="">
<input type="hidden" name="NEW_ITEM-MATGROUP[2]" value="12345678">
<input type="hidden" name="NEW_ITEM-EXT_CATEGORY_ID[2]" value="12345678">
<input type="hidden" name="NEW_ITEM-EXT_SCHEMA_TYPE[2]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD1[2]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD2[2]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD3[2]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD4[2]" value="">
<input type="hidden" name="NEW_ITEM-CUST_FIELD5[2]" value="">
</form>
<script language="JavaScript" type="text/javascript">
document.SUBMITFORM.submit();
</script>
</body>
</html>
Now your script has to extract the order data and you can do with it whatever you want (start an approval workflow, ...) and in the end you can order
(however you want. You can start an EDI process, or you send an order fax...) But this order process is outside the OCI itself.

WP e-commerce remove button

For adding a product to cart by id I've got this code:
<form class="product_form" enctype="multipart/form-data" action="<?php bloginfo('url');?>" method="post" name="1" id="product_143">
<input type="hidden" value="add_to_cart" name="wpsc_ajax_action">
<input type="hidden" value="143" name="product_id">
<button>+</button>
Is there a code to remove a item by id?
I've tried this:
<form action="<?php bloginfo('url');?>" method="post" class="adjustform remove">
<input type="hidden" name="quantity" value="0">
<input type="hidden" name="key" value="0">
<input type="hidden" name="wpsc_update_quantity" value="true">
<input type="submit" value="-">
</form>
But this removes the first item in the cart.

WordPress Search on pluign page

I have an plugin to didsplay list of coupon code in WordPress. I would like to place search box for searching coupon code in coupon page.
<form method="get" id="searchform" action="">
<input type="text" value="Search" name="s" id="s" />
<input type="hidden" name="cat" value="5" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
When I click on search button it redirect me to wordpress post page instead of plugin default page.
Suggest me working solution for implement searching in plugin page.
We have to redirect it manually using this form:
<form method="get" action="<?php echo "edit.php?";?>" id="coupon">
<label class="screen-reader-text" for="tag-search-input">Search Coupon Code:</label>
<input type="hidden" name="post_type" value="wpsc-product" /> //required to redirect it coupon page
<input type="hidden" name="page" value="wpsc-edit-coupons" />//required to redirect it coupon page
<input type="search" id="search-input" name="s" value="">
<input type="submit" name="" id="submit" class="button" value="Search Coupon Code">
</form>
After this you will have to grape the result from $_GET['s'] and apply manual search on that file.

how to post and response to post

I have asp.net button, I want when click to post to the following link
https://www.cashu.com/cgi-bin/pcashu.cgi
with something parameters like the below form do
<form action="https://www.cashu.com/cgi-bin/pcashu.cgi" method="post">
<input type="hidden" name="merchant_id" value="XYZ">
<input type="hidden" name="token" value="66a31cd699d8d9cb454df1f6cec30c2c">
<input type="hidden" name="display_text" value="Baseball Hat">
<input type="hidden" name="currency" value="CSH">
<input type="hidden" name="amount" value="125">
<input type="hidden" name="language" value="en">
<input type="hidden" name="session_id" value="asdasd-234-asdasd">
<input type="hidden" name="txt1" value="item27">
<input type="submit" value="Pay with cashU!">
</form>
I want to do that programatically and catach the return response , and write it on text
any idea how to do that

Resources