namelesshachi Posted June 26, 2012 Share Posted June 26, 2012 (edited) Hello againnnn! I have some products with combinations, and each combinations has it's own reference number. When i try searching those reference numbers, it says "not found" the easiest way was putting all the reference numbers on the main product. product: reference1,reference2,reference3 and it worked fine for a few products, but when i add new products and use that same way for the reference numbers, it only finds search results with the 1st one.... So, my question is: IS there a way for the search engine to search the combinations reference numbers? Or, why is not working with , comas ? Appreciate the help and the ideas! n.n ty Edited June 26, 2012 by namelesshachi (see edit history) Link to comment Share on other sites More sharing options...
namelesshachi Posted June 26, 2012 Author Share Posted June 26, 2012 (edited) ... lol i swear i had posted the solution o...... oh well (me, using ps 1.4.7.0) file to edit: classes/search.php find: getAttributes function (around line 300) replace with this: public static function getAttributes($db, $id_product, $id_lang) { $attributes = ''; $attributesArray = $db->ExecuteS(' SELECT al.name, pa.reference FROM '._DB_PREFIX_.'product_attribute pa INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (pac.id_attribute = al.id_attribute AND al.id_lang = '.(int)$id_lang.') WHERE pa.id_product = '.(int)$id_product); foreach ($attributesArray AS $attribute) $attributes .= $attribute['reference'].' '; $attributes .= $attribute['reference'].' '; return $attributes; } n.n there u go! Edited June 28, 2012 by namelesshachi (see edit history) Link to comment Share on other sites More sharing options...
namelesshachi Posted June 26, 2012 Author Share Posted June 26, 2012 (edited) ... Edited June 26, 2012 by namelesshachi (see edit history) Link to comment Share on other sites More sharing options...
jrgene Posted June 28, 2012 Share Posted June 28, 2012 Did you find a solution for this... Have the same problem on 1.4.7 Link to comment Share on other sites More sharing options...
namelesshachi Posted June 28, 2012 Author Share Posted June 28, 2012 Did you find a solution for this... Have the same problem on 1.4.7 updated with the solution n.n 1 Link to comment Share on other sites More sharing options...
need4speed Posted June 29, 2012 Share Posted June 29, 2012 It could be nice if the same feature was possible in the back office. Link to comment Share on other sites More sharing options...
CoooL Posted July 22, 2012 Share Posted July 22, 2012 Thankyou very much.. Works in 1.4.8.2 also Link to comment Share on other sites More sharing options...
faDdy Posted March 21, 2013 Share Posted March 21, 2013 Thankss ! working perfect in Prestashop 1.4.8.2 Link to comment Share on other sites More sharing options...
lovemyseo Posted March 6, 2017 Share Posted March 6, 2017 Is there any slution for prestashop 1.6.1.11 able to search product wth combination reference on front site but not working in admin ? prestashop gurus please Link to comment Share on other sites More sharing options...
MortenH Posted December 6, 2019 Share Posted December 6, 2019 Any solution to search on the reference number for combinations in prestashop 1.7.6+ ? Link to comment Share on other sites More sharing options...
Ezequielb Posted April 14, 2020 Share Posted April 14, 2020 On 12/6/2019 at 9:20 AM, MortenH said: Any solution to search on the reference number for combinations in prestashop 1.7.6+ ? nothing yet? Link to comment Share on other sites More sharing options...
Jorkoo Posted May 7, 2020 Share Posted May 7, 2020 I want to share my solution for 1.7.4+ It is not the best, but it is working. step 1) make an module. You can generate a simple module here: https://validator.prestashop.com/generator . Don't rush to install it. It is the last step. step 2) write a hook in the module. public function hookActionAdminProductsListingFieldsModifier($list){ if(isset($_POST['filter_column_reference']) && !empty($_POST['filter_column_reference'])){ $query=$_POST['filter_column_reference']; $list['sql_where']=array(' ( EXISTS(SELECT * FROM `' . _DB_PREFIX_ . 'product_attribute` `pa` WHERE pa.`id_product` = p.`id_product` AND (pa.`reference` LIKE \'%' . pSQL($query) . '%\' OR pa.`supplier_reference` LIKE \'%' . pSQL($query) . '%\' OR pa.`ean13` LIKE \'%' . pSQL($query) . '%\' OR pa.`isbn` LIKE \'%' . pSQL($query) . '%\' OR pa.`upc` LIKE \'%' . pSQL($query) . '%\')) ) OR p.`reference` LIKE \'%' . pSQL($query) . '%\' ' ); } } step 3) register the hook. Maybe the best way is to do it during install of the module. public function install() { if (!parent::install() || $this->registerHook('actionAdminProductsListingFieldsModifier') ) { return false; } $installer = InstallerFactory::create(); return $installer->install($this); } step 4) Install the module. The idea to install the module you've just created and modified last is to register the hook. If everything went OK you'll be able to search by reference all combinations in the back office /administration/ . NB! Make sure the hook is registered. Check out the DB tables: ps_hook , ps_hook_module ps_hook should contain row with name = actionAdminProductsListingFieldsModifier ps_hook_module should contain the ID of the hook from ps_hook, and the ID of the module you've created (it should appear in ps_hook_module). 1 Link to comment Share on other sites More sharing options...
Ezequielb Posted May 9, 2020 Share Posted May 9, 2020 (edited) I have Prestashop 1.7.6 and this featured is alredy working with no modules at front and back office( am using a custom theme). The thing nobody have solved yet is: A Product was created with reference C7285-M (main product before combinations). Then combinations were created: -C7825-M01 (Default combination) -C7825-M02 -C7825-M03 -C7825-M04 etc... When customer searchs the shop for C7285-M03 combination which is not the default one, the results always take the customer to the default combination view which is C7285-M01. I have tried many options with the same result. This creates many issues with customers purchasing the wrong products. Is there a way to get the result linked to the correct product search?? See attached pictures Edited May 9, 2020 by Ezequielb (see edit history) Link to comment Share on other sites More sharing options...
PGS_BB Posted March 16, 2022 Share Posted March 16, 2022 Hi On 5/9/2020 at 6:48 PM, Ezequielb said: I have Prestashop 1.7.6 and this featured is alredy working with no modules at front and back office( am using a custom theme). The thing nobody have solved yet is: A Product was created with reference C7285-M (main product before combinations). Then combinations were created: -C7825-M01 (Default combination) -C7825-M02 -C7825-M03 -C7825-M04 etc... When customer searchs the shop for C7285-M03 combination which is not the default one, the results always take the customer to the default combination view which is C7285-M01. I have tried many options with the same result. This creates many issues with customers purchasing the wrong products. Is there a way to get the result linked to the correct product search?? See attached pictures Hi Did you solve this? Having the same issue. 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