skulaluks Posted September 12, 2010 Share Posted September 12, 2010 Hi, Prestashop searches normally trough product.reference, but once a product has multiple attributes and each attribute has its own reference code, search engine of prestashop cannot find it. What should i change to make prestashop find a product whose attribute has reference code that i search?The File to be modified is probably \classes\Search.php Thank you for your help Link to comment Share on other sites More sharing options...
skulaluks Posted September 14, 2010 Author Share Posted September 14, 2010 I found it! The file to be edited is: \classes\Search.php The lines from linenumber289 should look like thisonly 2rows and 1 attribute to the query have to be added : $weightArray = array( 'pname' => Configuration::get('PS_SEARCH_WEIGHT_PNAME'), 'reference' => Configuration::get('PS_SEARCH_WEIGHT_REF'), 'pareference' => Configuration::get('PS_SEARCH_WEIGHT_REF'), // add just this line here 'ean13' => Configuration::get('PS_SEARCH_WEIGHT_REF'), 'description_short' => Configuration::get('PS_SEARCH_WEIGHT_SHORTDESC'), 'description' => Configuration::get('PS_SEARCH_WEIGHT_DESC'), 'cname' => Configuration::get('PS_SEARCH_WEIGHT_CNAME'), 'mname' => Configuration::get('PS_SEARCH_WEIGHT_MNAME'), 'tags' => Configuration::get('PS_SEARCH_WEIGHT_TAG'), 'attributes' => Configuration::get('PS_SEARCH_WEIGHT_ATTRIBUTE'), 'features' => Configuration::get('PS_SEARCH_WEIGHT_FEATURE') ); $products = $db->ExecuteS(' SELECT p.id_product, pl.id_lang, pl.name as pname, p.reference, p.ean13, pl.description_short, pl.description, cl.name as cname, m.name as mname, pa.reference as pareference FROM '._DB_PREFIX_.'product p LEFT JOIN '._DB_PREFIX_.'product_lang pl ON p.id_product = pl.id_product LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default AND pl.id_lang = cl.id_lang) LEFT JOIN '._DB_PREFIX_.'manufacturer m ON m.id_manufacturer = p.id_manufacturer left join '._DB_PREFIX_.'product_attribute pa ON pa.id_product = p.id_product WHERE p.indexed = 0', false); // add just this line above this comment Than you have to go to your backend admin>preferences>search> and run complete indexation of all products. Link to comment Share on other sites More sharing options...
renamed_account_45578 Posted July 25, 2011 Share Posted July 25, 2011 This works great! Is there any way to automatically show as selected the searched attribute in the dropdown for the individual product page? Once the search has found the reference and you click on the product found, how to come up with its associated attribute as selected? Link to comment Share on other sites More sharing options...
renamed_account_45578 Posted July 25, 2011 Share Posted July 25, 2011 Any direction will help, thanks in advance Link to comment Share on other sites More sharing options...
renamed_account_45578 Posted December 5, 2011 Share Posted December 5, 2011 Has anyone found this solution? I need this to come up similar to the "default" selected attribute, but based on the search results. 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