nandelbosc Posted June 16, 2014 Share Posted June 16, 2014 (edited) Hi, Anybody can explain me what makes searchcron.php? As you can see in other post, I have problems with indexation on multistore installation. After a few days searching other ways and waiting for an answer (with no luck), I have an idea (bad idea???): fill manually the search tables when I import our products. To do this, I need to understand what tasks does the searchcron.php file, what tables are involved, how to fulfill it correctly, ... Can you help me? Thank's! Edited June 20, 2014 by nandelbosc (see edit history) Link to comment Share on other sites More sharing options...
pets11 Posted June 17, 2014 Share Posted June 17, 2014 Wouldn't it be easier to just import and then run a cron job? Link to comment Share on other sites More sharing options...
nandelbosc Posted June 17, 2014 Author Share Posted June 17, 2014 Thanks for your answer pets11, but as I said in the cited post, running the cron don't work because stops after a few minutes without errors, but with a lot of products pending indexing... Link to comment Share on other sites More sharing options...
pets11 Posted June 19, 2014 Share Posted June 19, 2014 Sorry about my answer...I need to stay off the forums when Im sleep deprived. Are you timing out? Try changing your php.ini maximum execution time to a longer setting and see if more of the search gets indexed. Link to comment Share on other sites More sharing options...
El Patron Posted June 19, 2014 Share Posted June 19, 2014 Thanks for your answer pets11, but as I said in the cited post, running the cron don't work because stops after a few minutes without errors, but with a lot of products pending indexing... at the top of .php file add this: @ini_set('display_errors', 'on'); then if error, you can then check your hosting error log. Link to comment Share on other sites More sharing options...
nandelbosc Posted June 20, 2014 Author Share Posted June 20, 2014 Sorry about my answer...I need to stay off the forums when Im sleep deprived. Are you timing out? Try changing your php.ini maximum execution time to a longer setting and see if more of the search gets indexed. Thank's again pets11, and no, i'm not out of time... I tried to change this values... php_value memory_limit 1024M php_value max_execution_time 44000 php_value max_input_time -1 php_value upload_max_filesize 25M php_value post_max_size 20M php_value max_input_vars 10000 But didn't work! at the top of .php file add this: @ini_set('display_errors', 'on'); then if error, you can then check your hosting error log. Thank's El Patron, I try it later. By now I solved the problem with a bash script wich imports the info in my csv products file and fill the corresponent prestashop tables. Now the search work's well. Thank's to every body. 1 Link to comment Share on other sites More sharing options...
nandelbosc Posted June 20, 2014 Author Share Posted June 20, 2014 #!/bin/bash FITXER_ACTUAL_ORIGINAL=/PATH/TO/CSV/FILE/products.csv FITXER_ACTUAL=./products_temps.csv \cp $FITXER_ACTUAL_ORIGINAL $FITXER_ACTUAL dos2unix $FITXER_ACTUAL BDD=database_name U_BDD=database_user P_BDD=database_password altes="0" modificacions="0" baixes_actuals="0" baixes_anterior="0" sense_canvis="0" comptador_actuals="0" comptador_anteriors="0" totals=`cat $FITXER_ACTUAL | wc -l` id_shop="1" # or other id while read linia_actual do id_product=$(echo $linia_actual|cut -d ';' -f11) comptador_actuals=`expr $comptador_actuals + 1` stock=$(echo $linia_actual|cut -d ';' -f33) tipus=$(echo $linia_actual|cut -d ';' -f22) ### canviem totes les ' per " http://wiki.bash-hackers.org/syntax/quoting#ansi_c_like_strings http://www.asciitable.com/ line=$linia_actual line=$(echo $line|sed 's/\x27/"/g') ### id_product id_product=$(echo $line|cut -d ';' -f11) id_product_permanent=$(echo $line|cut -d ';' -f11) id_material_proveidor=$(echo $line|cut -d ';' -f38) ### description description=$(echo $line|cut -d ';' -f14) pare=$(echo $line|cut -d ';' -f31) if [[ -n "$pare" ]]; then pare=$(mysql -u $U_BDD -h localhost -p$P_BDD -se 'SELECT id_product from ps_product WHERE reference="'$id_product'"' $BDD) description=$(echo $line|cut -d ';' -f34) id_product=$pare fi frase="$description $id_product_permanent $id_material_proveidor" for paraula in $frase do paraula_existent=$(mysql -u $U_BDD -h localhost -p$P_BDD -se 'SELECT id_word from ps_search_word WHERE id_shop='$id_shop' AND id_lang='2' AND word='"'$paraula'"'' $BDD) if [[ -n "$paraula_existent" ]] ### IF MATERIAL EXISTENT then id_paraula=$paraula_existent else mysql -u $U_BDD -h localhost -p$P_BDD -se 'INSERT INTO `ps_search_word` (`id_shop`,`id_lang`,`word`) VALUES ('$id_shop','2','"'$paraula'"')' $BDD id_paraula=$(mysql -u $U_BDD -h localhost -p$P_BDD -se 'SELECT id_word from ps_search_word WHERE id_shop='$id_shop' AND id_lang='2' AND word='"'$paraula'"'' $BDD) fi mysql -u $U_BDD -h localhost -p$P_BDD -se 'INSERT INTO `ps_search_index` (`id_product`,`id_word`,`weight`) VALUES ('"'$id_product'"','"'$id_paraula'"','2')' $BDD done mysql -u $U_BDD -h localhost -p$P_BDD -se 'UPDATE `ps_product` SET `indexed`='1' WHERE `id_product`='"'$id_product'"'' $BDD mysql -u $U_BDD -h localhost -p$P_BDD -se 'UPDATE `ps_product_shop` SET `indexed`='1' WHERE `id_product`='"'$id_product'"' AND id_shop='"'$id_shop'"'' $BDD ########### POST ALTES echo -ne "$id_product - alta \n" altes=`expr $altes + 1` echo -ne "$altes altes, $modificacions modificacions i $baixes_actuals baixes de $comptador_actuals \r" done < $FITXER_ACTUAL \rm $FITXER_ACTUAL Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now