msin147 Posted April 10, 2008 Share Posted April 10, 2008 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 Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted April 13, 2008 Share Posted April 13, 2008 You will have to change your form and your mysql_query so it searches the multiple values. If you post some code it might be easier to explain. Quote Link to comment Share on other sites More sharing options...
msin147 Posted April 14, 2008 Author Share Posted April 14, 2008 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    <input type="checkbox" name="Search[]" value="21" > Appliances    <input type="checkbox" name="Search[]" value="24" > Builders (New Homes), Architects & Designers   <br /> <input type="checkbox" name="Search[]" value="26" > Carpentry & Cabinets    <input type="checkbox" name="Search[]" value="27" > Cleaning Services    <input type="checkbox" name="Search[]" value="28" > Concrete, Brick & Stone   <br /> <input type="checkbox" name="Search[]" value="4" > Electrical, Telephone & Computers    <input type="checkbox" name="Search[]" value="7" > Flooring    <input type="checkbox" name="Search[]" value="3" > General Contractors   <br /> <input type="checkbox" name="Search[]" value="10" > Handyman Services    <input type="checkbox" name="Search[]" value="13" > Heating & Cooling    <input type="checkbox" name="Search[]" value="16" > Home Construction   <br /> <input type="checkbox" name="Search[]" value="9" > Home Exterior    <input type="checkbox" name="Search[]" value="25" > Home Theater    <input type="checkbox" name="Search[]" value="18" > Interior Living   <br /> <input type="checkbox" name="Search[]" value="12" > Kitchens and Baths    <input type="checkbox" name="Search[]" value="19" > Landscape, Decks & Fences    <input type="checkbox" name="Search[]" value="22" > Moving & Storage   <br /> <input type="checkbox" name="Search[]" value="23" > Other Services    <input type="checkbox" name="Search[]" value="5" > Painting & Staining    <input type="checkbox" name="Search[]" value="8" > Plumbing   <br /> <input type="checkbox" name="Search[]" value="11" > Pools, Spas, Hot Tubs & Saunas    <input type="checkbox" name="Search[]" value="14" > Roofing, Siding & Gutters    <input type="checkbox" name="Search[]" value="17" > Walls & Ceilings   <br /> <input type="checkbox" name="Search[]" value="20" > Windows & Doors    <input type="checkbox" name="Search[]" value="15" > Yard & Garden    </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> Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted April 14, 2008 Share Posted April 14, 2008 You need to show is the part that contains the mysql_query. Quote Link to comment Share on other sites More sharing options...
msin147 Posted April 14, 2008 Author Share Posted April 14, 2008 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? Quote Link to comment Share on other sites More sharing options...
msin147 Posted April 16, 2008 Author Share Posted April 16, 2008 Tippy you out there? Do you have any thoughts on this? thank you mathew Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted April 17, 2008 Share Posted April 17, 2008 This is beyond my abilities (or lack thereof), so hopefully someone else will jump in and show us how to attack this problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.