Jump to content

Recommended Posts

Hi,  I am stuck and need direction. Can anybody tell me what to do or push me in the right direction.

I am trying to alter an extension that has a search feature that can search in only one category at a time with a dropdown box. I would like to change this to allows for multiple category searching with checkboxes or the easiest alternative. I have tried at their forum with limited results, even an overall direction of what should be changed would be helpful.

The extension is sobi2 using php and mysql on joomla.

If more info is needed please let me know, I am just looking for an outline maybe or guesses even on what would need to be changed in a general situation like this.

Thank you

 

Hi thank you for the reply. I have made the form how I want it pretty much but I am having trouble changing the mysql query to allow for multiple cid's

heres the code  Ithink has to be changed. There is more but I just have this, if you need more please let me know.

<form id="sobiSearchFormContainer" accept-charset="<?php echo $iso[1];?>" action="<?php echo $config->liveSite; ?>/<?php echo $index;?>" method="get" name="sobiSearchFormContainer">
	<table class="sobi2eSearchForm">
       
        <tr>
			<td><?php if( $config->key("search", "search_box", true )) { echo _SOBI2_SEARCH_FOR; } ?></td>
			<td>
				<?php if( $config->key("search", "search_box", true )) { ?>
					<input name="sobi2Search" id="sobi2Search" class="inputbox" value="<?php echo $String; ?>" onclick="if (this.value == '<?php echo _SOBI2_SEARCH_INPUTBOX; ?>') this.value = '';" onblur="if (this.value == '') this.value = '<?php echo _SOBI2_SEARCH_INPUTBOX; ?>';"/>
				<?php } ?>
			</td>
			<td>
				<?php if( $config->key("search", "search_box", true )) { ?>
					<input type="submit" id="sobiSearchSubmitBt" name="search"  onmousedown="$('SobiSearchPage').value = 0" onkeydown="$('SobiSearchPage').value = 0" class="button" value="<?php echo _SOBI2_SEARCH_H; ?>"/>
				<?php } ?>
			</td>
			<td id="sobi2eSearchEmptyCell">
			<?php
	    		if( ($f = $config->key( "search", "empty_cell_calback_function", false )) && function_exists( $f )) {
	    			$ecell = call_user_func( $f );
	    		}
	    		else {
	    			$ecell = " ";
	    		}
	    		echo $ecell;
			?>
			</td>
		</tr>
		<tr>
			<td colspan="4">
			<?php if( $config->key("search", "phrase_any", true )) { ?>
				<input type="radio" <?php if($phrase == 'any' || $phrase != 'all' || $phrase != 'exact' ) echo "checked=\"checked\"" ?> name="searchphrase" id="searchphraseany" value="any"   />
				<label for="searchphraseany"><?php echo _SOBI2_SEARCH_ANY ?></label>
			<?php } ?>
			<?php if( $config->key("search", "phrase_all", true )) { ?>
				<input type="radio" <?php if($phrase == 'all') echo "checked=\"checked\"" ?> name="searchphrase" id="searchphraseall" value="all"  />
				<label for="searchphraseall"><?php echo _SOBI2_SEARCH_ALL ?></label>
			<?php } ?>
			<?php if( $config->key("search", "phrase_exact", true )) { ?>
				<input type="radio" <?php if($phrase == 'exact') echo "checked=\"checked\"" ?> name="searchphrase" id="searchphraseexact" value="exact"  />
				<label for="searchphraseexact"><?php echo _SOBI2_SEARCH_EXACT ?></label>
			<?php } ?>
			</td>
		</tr>
		<tr>
			<td colspan="4">
			<?php if( !$config->key("search", "search_box", true )) { ?>
				<input type="submit" id="sobiSearchSubmitBt" name="search"  onmousedown="$('SobiSearchPage').value = 0" onkeydown="$('SobiSearchPage').value = 0" class="button" value="<?php echo _SOBI2_SEARCH_H; ?>"/>
			<?php } ?>
			<?php if($config->ajaxSearchUseSlider) { ?>
				<input type="button" id="sobiSearchFormExtOptToggle" class="button" name="sobiSearchFormExtOptToggle" value="<?php echo _SOBI2_SEARCH_TOOGLE_EXTENDED; ?>"/>
			<?php } ?>
				<input type="button" id="sobiSearchFormReset" class="button" name="sobiSearchFormReset" title="<?php echo _SOBI2_SEARCH_RESET_FORM_TITLE;?>" value="<?php echo _SOBI2_SEARCH_RESET_FORM; ?>" onclick="resetSobi2SearchForm()"/>
				<br/><br/>
			</td>
		</tr>
		</table>
		<div id="sobiSearchFormExtOpt">
		<table class="sobi2eSearchForm">
            
              <div>
            <input type="checkbox" name="Search[]" value="6" > Additions & Remodels&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="21" > Appliances&nbsp&nbsp&nbsp
        
        <input type="checkbox" name="Search[]" value="24" > Builders (New Homes), Architects & Designers&nbsp&nbsp&nbsp<br />

        <input type="checkbox" name="Search[]" value="26" > Carpentry & Cabinets&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="27" > Cleaning Services&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="28" > Concrete, Brick & Stone&nbsp&nbsp&nbsp<br />
        
         <input type="checkbox" name="Search[]" value="4" > Electrical, Telephone & Computers&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="7" > Flooring&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="3" > General Contractors&nbsp&nbsp&nbsp<br />

        <input type="checkbox" name="Search[]" value="10" > Handyman Services&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="13" > Heating & Cooling&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="16" > Home Construction&nbsp&nbsp&nbsp<br />
        
         <input type="checkbox" name="Search[]" value="9" > Home Exterior&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="25" > Home Theater&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="18" > Interior Living&nbsp&nbsp&nbsp<br />

        <input type="checkbox" name="Search[]" value="12" > Kitchens and Baths&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="19" > Landscape, Decks & Fences&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="22" > Moving & Storage&nbsp&nbsp&nbsp<br />
        
         <input type="checkbox" name="Search[]" value="23" > Other Services&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="5" > Painting & Staining&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="8" > Plumbing&nbsp&nbsp&nbsp<br />

        <input type="checkbox" name="Search[]" value="11" > Pools, Spas, Hot Tubs & Saunas&nbsp&nbsp&nbsp
        
         <input type="checkbox" name="Search[]" value="14" > Roofing, Siding & Gutters&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="17" > Walls & Ceilings&nbsp&nbsp&nbsp<br />

        <input type="checkbox" name="Search[]" value="20" > Windows & Doors&nbsp&nbsp&nbsp

        <input type="checkbox" name="Search[]" value="15" > Yard & Garden&nbsp&nbsp&nbsp
        
       
</div>

		<?php
			if(!$config->ajaxSearchCatsForFields) {
				if(count($dropListsArray)) {
					foreach($dropListsArray as $label => $dropList) {
						echo "<tr><td>{$label}</td><td colspan='2'>{$dropList}</td></tr>";
					}
				}
			}
		?>
		<?php if( $config->key("search", "cats", true )) { ?>
		<tr>
			<td style="vertical-align:top;"><?php echo _SOBI2_SEARCH_TOOGLE_CATS; ?></td>
			<td colspan='2'>
			<?php if($config->ajaxSearchUseSlider) { ?>
				<div id="sobiSearchFormCatsSelection" <?php if($config->ajaxSearchUseSlider) { ?> style="height:<?php echo $config->ajaxSearchCatsContHeight;?>px;" <?php } ?>>
			<?php } ?>
					<?php echo sobiAxSearch::axSearchCatChooser( $selectedCats, $cid ); ?>
			<?php if($config->ajaxSearchUseSlider) { ?>
				</div>
			<?php } ?>
			</td>
		</tr>
		<?php } ?>
		<?php
			if($config->ajaxSearchCatsForFields) {
				if(count($dropListsArray)) {
					foreach($dropListsArray as $label => $dropList) {
						echo "<tr><td>{$label}</td><td colspan='2'>{$dropList}</td></tr>";
					}
				}
			}
		?>
		</table>
		</div>
		<input type="hidden" name="option" value="com_sobi2"/>
		<input type="hidden" name="no_html" value="1"/>
		<input type="hidden" name="sobi2Task" value="axSearch"/>
		<input type="hidden" name="sobiCid" id="sobiCid" value="<?php echo $cid; ?>"/>
		<input type="hidden" id="SobiSearchPage" name="SobiSearchPage" value="<?php echo $page;?>"/>
</form>
<div id="sobiSearchResponseContainer"></div>

Sorry, I forgot about something there. There is alot of queries in the php file(it is 65 KB)

I think this is the one to work with, if I am mistaken please let me know. Thank you for your patience.

/* searching in categories */
	$cid = (int) sobi2Config::request($_REQUEST, "sobiCid", 0);
	setcookie("sobi2SearchCookie[cid]", $cid, 0, "/", $cookieDomain);

	if(!empty($sIDs) || !$searching) {
		if($cid && $cid !=0) {
			if(!is_array($sIDs) || empty($sIDs)) {
				$itids = null;
			}
			else {
				$ids = implode(" , ", $sIDs);
				$itids = "AND itemid IN ({$ids})";
			}
			$cids = array();
			$config->getChildCats($cid, $cids);
			$cids = implode(" , ", $cids);
			$query = "SELECT itemid FROM #__sobi2_cat_items_relations WHERE catid IN({$cids}) {$itids} ;";
			$database->setQuery($query);
			$sIDs = $database->loadResultArray();
			if ($database->getErrorNum()) {
				trigger_error("DB reports: ".$database->stderr(), E_USER_WARNING);
			}
		}
	}

 

If you need something else I will find it and post it. I am not very good at mysql, not too great at php for that matter.

Again thank you for taking time to help me.

So what ya think?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.