WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Search form code (2 posts)

  1. Helpful Guy Uk
    Member
    Posted 7 months ago #

    Hi,

    Im trying to make a Combo box search for Woocommerce but i cant figure out how to make get the results from the combo to generate a product search:

    Basically I want to get the item to search for the chosen selection, for example if "coke" was the chosen i then want to search for "coke" as a woocommerce product. i need to know how to code it where the stars are.

    Code example:

    <script type="text/javascript">
    function populate(s1,s2){
    	var s1 = document.getElementById(s1);
    	var s2 = document.getElementById(s2);
    	s2.innerHTML = "";
    	if(s1.value == "drink"){
    		var optionArray = ["|","coke|Coke","orange|Orange"];
    	} else if(s1.value == "food"){
    		var optionArray = ["|","pie|Pie"];
    	}
    	for(var option in optionArray){
    		var pair = optionArray[option].split("|");
    		var newOption = document.createElement("option");
    		newOption.value = pair[0];
    		newOption.innerHTML = pair[1];
    		s2.options.add(newOption);
    	}
    
    <script type="text/javascript">
    function results(s1,s2){
    	var s1 = document.getElementById(s1);
    	var s2 = document.getElementById(s2);

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    **********************************

    http://wordpress.org/plugins/woocommerce/

  2. Helpful Guy Uk
    Member
    Posted 7 months ago #

    Dont now why i ask this question as the search form information should be sent client side.

Reply

You must log in to post.

About this Plugin

About this Topic