daYmo Posted March 30, 2012 Share Posted March 30, 2012 Hello, on the product page on the accessories part, when you start typing a name you've got all the products corresponding that are displayed. However it makes more sense if you only display the list of ACTIVE products... I think This is how to process : File admin/ajax_products_list.php add the following parameter : (line 46 for instance) $onlyActive = Tools::getValue('onlyActive', false); et dans modifier le requête pour qu'il n'y ait plus que les produits actifs si ce paramètre est renseigné : modifiy the query so as to take into account this parameter and therefore restrict to active products $items = Db::getInstance()->ExecuteS(' SELECT p.`id_product`, `reference`, pl.name FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product) WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\') AND pl.id_lang = '.(int)($cookie->id_lang). (!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' '). (!empty($onlyActive) ? ' AND p.active=1 ' : ' '). ($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '')); Dans le fichier admin/tab/AdminProducts.php add the parameter active=1 into the javascript call to autocomplete : $(\'#product_autocomplete_input\').setOptions({ extraParams: {excludeIds : getAccessorieIds(), onlyActive: 1} }); That's it ! Ciao Link to comment Share on other sites More sharing options...
Cari Posted August 21, 2013 Share Posted August 21, 2013 (edited) Great post! I wish i could try it, but i can't get the product to autocomplete, i.e. i begin typing product names, nothing shows. I just started a post just now, (http://www.prestasho...ccessories-etc/), i'm still trying to find information though and came across this. Do you know why this is happening? Thanks! Edited August 21, 2013 by Cari (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts