i'm building online bookstore prestashop 1.6.1.6. since field "author" not on database, i've created custom product field, unable perform searches author's name.
following blog have written piece of code in "search.php" blog directions older version , have least clue re-write class.
public static function getauthors ($db, $id_product) { $authors =''; $authorsarray = $db->executes(' select a.name '._db_prefix_. 'author sp left join '._db_prefix_. 'author on (a.id_product = sp.id_product) sp.id_product = '. (int)$id_product. ' group a.id_product' ); foreach ($authorsarray $author){ $authors. = $authors['name'] .''; } return $authors; } / every fields weighted according configuration in backend $weight_array = array( 'pname' => configuration::get('ps_search_weight_pname'), //add author index search 'author' => configuration::get('ps_search_weight_pname'), 'reference' => configuration::get('ps_search_weight_ref'), 'pa_reference' => configuration::get('ps_search_weight_ref'), 'supplier_reference' => configuration::get('ps_search_weight_ref'), 'pa_supplier_reference' => configuration::get('ps_search_weight_ref'), 'ean13' => configuration::get('ps_search_weight_ref'), 'pa_ean13' => configuration::get('ps_search_weight_ref'), 'upc' => configuration::get('ps_search_weight_ref'), 'pa_upc' => 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') );
thanks reading.
Comments
Post a Comment