bilusunny Posted February 13, 2016 Share Posted February 13, 2016 Hello All, Currently in my theme, i have a search box which displays results below while you type the keyword. Currently this is the format in which the search box displays results Image -> Category Name -> Product Name I wanted to add the manufacturer name before the product name, the price after the product name and add to cart button after the price. Is this possible and if so could you guys help me on this please, thank you. Link to comment Share on other sites More sharing options...
NemoPS Posted February 15, 2016 Share Posted February 15, 2016 Are you using a custom search box? Custom theme? Link to comment Share on other sites More sharing options...
bilusunny Posted February 18, 2016 Author Share Posted February 18, 2016 I think its a theme one. Link to comment Share on other sites More sharing options...
NemoPS Posted February 19, 2016 Share Posted February 19, 2016 Hard to tell then, you might want to find blocksearch.js in the theme folder and locate thismytab[mytab.length] = { data: data, value: data.cname + ' > ' + data.pname };Then try to add data.manufacturer However, you also need to add it to the search class if ($ajax) { $sql = 'SELECT DISTINCT p.id_product, pl.name pname, cl.name cname, cl.link_rewrite crewrite, pl.link_rewrite prewrite '.$score.' FROM '._DB_PREFIX_.'product p INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' ) '.Shop::addSqlAssociation('product', 'p').' INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON ( product_shop.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').' ) WHERE p.`id_product` '.$product_pool.' ORDER BY position DESC LIMIT 10'; return $db->executeS($sql, true, false); }Here, find() method Link to comment Share on other sites More sharing options...
bilusunny Posted February 19, 2016 Author Share Posted February 19, 2016 i found the blocksearch.js and added the manufacturer thing, but where can i find the search class.Newbie to prestashop, sorry. BTW i took prestashop after checking out your videos in youtude. Those were very good. Link to comment Share on other sites More sharing options...
NemoPS Posted February 20, 2016 Share Posted February 20, 2016 Thanks it's in the classes/ folder. You could use an override, but a core modification is ok in this case I guess (it will be gone if you upgrade though) Link to comment Share on other sites More sharing options...
bilusunny Posted February 25, 2016 Author Share Posted February 25, 2016 (edited) Hey Nemo, where exactly under search class should i put this code? Anywhere would do? Does this add the price after the product name and add to cart also? I tried to put that under the find function, but it didnt work. It wasnt even showing the results below when you put the keyword in? AM i missing something, please help me on this , thank you? Edited February 25, 2016 by bilusunny (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted February 26, 2016 Share Posted February 26, 2016 locate the method above, you need to modify and add a join and another select in the select part after "as cname" add ', m.name'Then as joinLEFT JOIN '._DB_PREFIX_.'manufacturer m ON p.id_manufacturer = m.id_manufacturer' Link to comment Share on other sites More sharing options...
bilusunny Posted February 26, 2016 Author Share Posted February 26, 2016 I tried that, didnt work. Can you have a look at my search.php file. if ($ajax) { $sql = 'SELECT DISTINCT p.id_product, pl.name pname, cl.name cname, m.name, cl.link_rewrite crewrite, pl.link_rewrite prewrite '.$score.' FROM '._DB_PREFIX_.'product p INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' ) '.Shop::addSqlAssociation('product', 'p').' INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON ( product_shop.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').' ) WHERE p.`id_product` '.$product_pool.' ORDER BY position DESC LIMIT 10'; return $db->executeS($sql, true, false); } I've added mname and after that when i search theres nothing that comes below. And also the left join is already there so didnt bother to edit it. '.(Combination::isFeatureActive() ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').' '.Product::sqlStock('p', 0).' LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.') LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.') WHERE p.`id_product` '.$product_pool.' GROUP BY product_shop.id_product '.($order_by ? 'ORDER BY '.$alias.$order_by : '').($order_way ? ' '.$order_way : '').' LIMIT '.(int)(($page_number - 1) * $page_size).','.(int)$page_size; . Please have it looked for me. Thank you. Link to comment Share on other sites More sharing options...
NemoPS Posted February 29, 2016 Share Posted February 29, 2016 You forgot the join on the first query Link to comment Share on other sites More sharing options...
bilusunny Posted March 2, 2016 Author Share Posted March 2, 2016 How do i join, please and thank you! Link to comment Share on other sites More sharing options...
NemoPS Posted March 2, 2016 Share Posted March 2, 2016 LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` 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