2006-10-02 08:08
I was able to make the search box search in the full description instead of the short but the problem is when it displays the result the Title of the product is replaced by the description... Any ideas how I can make it search the name of the product and the full description instead of the short description?? This is what I got so far replaced [code] <?php function dbListProductsSearch( $iStatus, $sWord, $iList ){ $aFile = file( DB_PRODUCTS ); $iCount = count( $aFile ); $iFindPage = 0; $iFindAll = 0; $aCategories = dbThrowProductCategories( ); $sWord = preg_quote( $sWord ); for( $i = 1; $i < $iCount; $i++ ){ $aExp = explode( '$', $aFile[$i] ); if( isset( $aCategories[$aExp[0]] ) && $aExp[4] >= $iStatus && eregi( $sWord, $aFile[$i] ) ){ //......?>[/code] with [code] <?php function dbListProductsSearch( $iStatus, $sWord, $iList ){ $aFile = file( DB_PRODUCTS_EXT ); $iCount = count( $aFile ); $iFindPage = 0; $iFindAll = 0; $aCategories = dbThrowProductCategories( ); $sWord = preg_quote( $sWord ); for( $i = 1; $i < $iCount; $i++ ){ $aExp = explode( '$', $aFile[$i] ); if( $aExp[0] >= $iStatus && eregi( $sWord, $aFile[$i] ) ){ //... ?>[/code] Now I just need it to display the results correctly... any help would be greatly appreciated
2006-10-02 09:05
sergeh - searching in full description was solved on this forum. use searchengine to find this solution
2006-10-02 16:42
Hi treewood that's the first thing I did but wasn't able to find the soluttion, all I found was a hint to change something in dbListProductsSearch that's all... anyway you can give me a link? I can't seem to find the solution here
2006-10-02 21:50
sergeh - if i will find time i will check but for last few days we don't have time for this :/ please try search
2006-10-02 23:20
hey treewood, that's what I did, I search this forum and all I found was a few posts about that but nothing helpful. I was just asking if you or someone had a direct link to that specific post
2006-10-03 08:29
sergeh - i can't find this topic :/
2006-10-03 09:36
sergeh - if You want we can do it for You or maybe our new plugin will be good: http://opensolution.org/sklep/?p=productsMore&iProduct=50 it give 1 field more to add keywords to find them after search?
2006-10-03 09:42
sergeh - if You know PHP well then i give You some advice but not step by step how to do it (no time for this): 1. edit core/products-ff.php, function: dbListProductsSearch() 2. before for add $aFile2 and open using file function DB_PRODUCTS_EXT 3. in for You need to create another "for" to check content of EXT file. My advice is to check first that in normal products is no find product. When You can't find it then after find using EXT. This will be faster. Here You have db structure: http://opensolution.org/download/Quick.Cart/other/v1.x_db.png
2006-10-03 20:22
thanks treewood, yes I do know php pretty well and with what you gave me I should be able to do it once I'm done I'll post my findings here thanks
2006-10-05 17:41
hey again treewood, I'm now using v1.4 loaded and it doesn't seem that there's a dbListProductSearch() function anymore. the only place where I found $aFile = DB_PRODUCTS was in dbThrowProduct and this is what I did function dbThrowProduct( $iProduct, $iStatus ){ $aFile = file( DB_PRODUCTS ); $iCount = count( $aFile ); $aFile2 = file( DB_PRODUCTS_EXT ); $iCount2 = count( $aFile2 ); for( $i = 1; $i < $iCount; $i++ ){ $aExp = explode( '$', $aFile[$i] ); if( $aExp[0] == $iProduct && $aExp[4] >= $iStatus ){ return $aExp; } if ($i <= $iCount) { for( $i2 = 1; $i2 < $iCount2; $i2++ ){ $aExp = explode( '$', $aFile2[$i2] ); if( $aExp[0] == $iProduct){ return $aExp; } } // end for } } // end for return null; } // end function dbThrowProduct but nothing happens obviously... So I tried changing the name of the file in dbListProducts to this return $oFF->throwFileArrayFunctionPages( DB_PRODUCTS_EXT, null, $GLOBALS['iPage'], $iList, 'dbListProductsCheck', Array( $iStatus, $aCategories ) ); and by changing a few things in the Check it should work but I'll have the same problem as before, it won't be able to get all of this product's info and won't search in the name of the product as well.. Do you have any suggestions?
2006-10-06 11:13
sergeh - look in http://opensolution.org/Quick.Cart/forum/?p=readTopic&nr=2667 for something called szukanie.rar. Maybe it is what you need or you can study the code and find solutions. If you download archive it has some english in descriptions.
2006-10-06 17:10
hi claps, I'm getting this error when i install the plugin Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /cart/plugins/szukanie/szukanie.php:156) in /cart/plugins/basketSummary/basketSummary.php on line 15 any ideas?
2006-10-06 17:36
ok the only headers that could be sent out from that file should be the ShowSearchExtendedForm function, so I removed it and put the contents of extend_form.tpl in page.tpl but I'm still getting the header error.... with a little modification the search works perfectly so thanks! Just need to find where that error is coming from though
2006-10-06 22:49
hmm that header thing is messing up the entire checkout process and the basketSummary... I still haven't found a solution..
2006-10-07 18:54
here's the content of szukanie.php, something in there is causing the problem. I can't find the part that's outputing to the browser <? if( !function_exists( 'listProductsSearch' ) ){ /** * List products and return content * @return string * @param string $sFile * @param string $sOption * @param mixed $mValue * @param int $iList */ function listProductsSearch( $sFile = 'products_list.tpl', $sOption = 'list', $mValue = null, $iList = null ){ if( !isset( $_GET['iPage'] ) || !is_numeric( $_GET['iPage'] ) || $_GET['iPage'] < 1 ) $_GET['iPage'] = 1; $iStatus = throwStatus( ); if( !isset( $iList ) ) { if( $iStatus == 1 ) $iList = PRODUCTS_LIST; else $iList = ADMIN_LIST; } if( $sOption == 'search' ){ if (isset($mValue[1])) $aData = dbListProductsSearchExtended ( $iStatus, array(trim( $mValue[0] ), $mValue[1], $mValue[2], $mValue[3]), $iList ); if (isset($mValue[1])) $sPage = $_GET['p'].'&sSearchWord='.$_GET['sSearchWord'].'&Category='.$mValue[1].'&fPriceFr om='.$mValue[2].'&fPriceTo='.$mValue[3]; } if( isset( $aData ) && is_array( $aData ) ) $content = throwProductsData( $sFile, $aData, $sPage, $iList ); else $content = $_GET['tpl']->tbHtml( $sFile, 'NOT_FOUND' ); return $content; } // end function listProductsSearch } function show_categories ($iStatus) { $aFile = file( DB_CATEGORIES ); $iCount = count( $aFile ); $kategorie = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); if( $aExp[3] >= $iStatus ) { $kategorie[$aExp[0]] = $aExp[1]; if( is_numeric( $aExp[2] ) && $aExp[2] > 0 ) {$kategorie[$aExp[0]] = $kategorie[$aExp[2]].' '.$kategorie[$aExp[0]]; } } } return $kategorie; } function show_products_ex () { $aFile = file(DB_PRODUCTS_EXT); $iCount = count( $aFile ); $produkty_ex = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); if (isset($aExp[1])) {$produkty_ex[$aExp[0]] = $aExp[1];} if (!isset($aExp[1])) {$produkty_ex[$aExp[0]] = "";} } return $produkty_ex; } function show_products_categories () { $aFile = file(DB_PRODUCTS_CATEGORIES); $iCount = count( $aFile ); $produkty_kategorie = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); $produkty_kategorie[$aExp[1]] = $aExp[0]; } return $produkty_kategorie; } function show_prices_promo () { $aFile = file(DB_PRODUCT_ATTRIBUTES); $iCount = count( $aFile ); $produkty_ceny_promo = null; for( $i = 1; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i]); $produkty_ceny_promo[$aExp[0]] = $aExp[2]; } return $produkty_ceny_promo; } if( !function_exists( 'dbListProductsSearchExtended' ) ){ /** * Return array of products list, search by word * @return array * @param int $iStatus * @param string $sWord * @param int $iList */ function dbListProductsSearchExtended( $iStatus, $sWord, $iList ){ global $oFF; $aCategories = dbThrowProductsCategories( ); $kategorie = show_categories (0); $produkty_ex = show_products_ex (); $produkty_kategorie = show_products_categories (); $produkty_ceny_promo = show_prices_promo (); return $oFF->throwFileArrayFunctionPages( DB_PRODUCTS, null, $_GET['iPage'], $iList, 'dbListProductsSearchCheckExtended', Array( $iStatus, $aCategories, $sWord[0], $kategorie, $produkty_ex, $produkty_kategorie, $sWord[1], $produkty_ceny_promo, $sWord[2], $sWord[3]) ); } // end function dbListProductsSearchExtended } if( !function_exists( 'dbListProductsSearchCheckExtended' ) ){ /** * Checking data of products * @return bool * @param array $aData * @param array $aCheck */ function dbListProductsSearchCheckExtended( $aData, $aCheck ){ $fPrice = $aData[2]; if (isset($aCheck[7][$aData[0]]) && is_numeric($aCheck[7][$aData[0]])) $fPrice = $aCheck[7][$aData[0]]; if (isset($aCheck[8]) && is_numeric($aCheck[8])) {$fPriceFrom = $aCheck[8];} else {$fPriceFrom = '0';} if (isset($aCheck[9]) && is_numeric($aCheck[9])) {$fPriceTo = $aCheck[9];} else {$fPriceTo = '';} if( is_array( $aData ) && isset( $aCheck[1][$aData[0]] ) && $aData[4] >= $aCheck[0] ) { if (($aCheck[2] == '') || ($aCheck[2] != '' && stristr( implode( ' ', $aData ).' '.$aCheck[3][$aCheck[1][$aData[0]][0]].' '.$aCheck[4][$aData[0]], $aCheck[2] ))) { if (($aCheck[6] == '') || (($aCheck[6] != '') && ($aCheck[5][$aData[0]] == $aCheck[6]))) { if ((($fPriceTo == '') || (($fPriceTo != '') && ($fPrice <= $fPriceTo))) && ($fPrice >= $fPriceFrom)) { return true; } else return null; } else return null; } else return null; } else return null; } // end function dbListProductsSearchCheckExtended } function ShowSearchExtendedForm ( $sFile = 'extended_search.tpl' ) { global $tpl; return $tpl->tbHtml( $sFile, 'EXTENDED_SEARCH_FORM' ); } ?>
2006-10-07 20:03
found the error session_start(); has to be at the very begining of a file and it wasn't in basketSummary.tpl so it was causing problems. Also there's no need to call session_start() twice... it was called in basketSummary and in action_clients/orders.php I also had to add ob_start(); in basketSummary
2007-01-20 03:15
serge can you tel me when do you put ob_start(); in baskerSummary and what changes do you make to run szukanie.rar plugin Please help me i realy need this plugin Thanks!
trzykas