Jump to content

FO Search by supplier reference of attribute combination


cilo

Recommended Posts

I figured out how to change the Search.php class to be able to search in FO by supplier reference, but i am not able to do the same with supplier reference of product combinations.
Is there a solution for this? I searched the forum...unsuccesfull

Thanks

Link to comment
Share on other sites

Okay, a product has a supplier...

...I fail to understand how the presence, or absence, of attributes
(ummm, you wrote 'combinations'. Combinations, as in, 'packs'?)
would cause a product to become unsearchable.

Using the sample database, I just tested this:

add new product, titled 'supergood'
it is a PACK
item1 is an ipod
item2 is a MacbookAir
supplier is SHURE
price is 20

goto frontend, use the native searchbox, type 'shure'
and 'supergood' is among the products returned in the search results

I edited the product, added features and created a 'Combination' for the product, saved
and again searched the frontend.
Still, no problem. Same (expected) result.

Link to comment
Share on other sites

The product has a supplier, but also has a "supplier reference"...it is the unique identifier of the product.
If I have a product named PRODUCT1 available in black, white, green, my supplier has a unique identifier of the three colours(product supplier reference).
I just vant to search by these unique IDs.

37817_84Qsn8z5CSpt4buV4vDb_t

Link to comment
Share on other sites

  • 1 month later...

I'm trying to do same thing, but on back end as well.

Similar scenario, say there are two items, a green one and red one. My and supplier reference is GOSU-R and GOSU-G, customer called on the phone and says they have a question about partnumber GOSU-R because they want to get a deal on 100 of them.

Right now I have a excel sheet with all the Part numbers so will put me in the right ballpark for what they are talking about.

Be nice to seach backend, so can get an idea what I'm paying for them, see pic and all that.

Link to comment
Share on other sites

  • 1 month later...
I figured out how to change the Search.php class to be able to search in FO by supplier reference, but i am not able to do the same with supplier reference of product combinations.
Is there a solution for this? I searched the forum...unsuccesfull

Thanks


Can you tell me, how did you manage to add search by supplier_reference?

Answering myself:
Hi I managed to get search by supplier_reference sorted (Prestashop 1.3.1).
For anyone else:

add below (around line 311)
reference' => Configuration::get('PS_SEARCH_WEIGHT_REF'),
'supplier_reference' => 10,

change line 324 to
SELECT p.id_product, pl.id_lang, pl.name as pname, p.reference, p.supplier_reference, p.ean13, pl.description_short, pl.description, cl.name as cname, m.name as mname
Link to comment
Share on other sites

  • 1 year later...

To search by supplier reference:

 

it occurs to me that one easy way to get the attribute product references to be searchable would be to create a new Feature called something like "related product references" for each product with attributes and then list the attribute references e.g. ref 123456, ref 234567, ref 567890 etc..

 

As features are searchable this should work.

 

If you wish to use a more pure solution, then you will need to create an override of the Search.php class.

To do this create a file something like (depending on the version of PS you are using, below is for PS 1.4.6.2).

 

<?php

class Search extends SearchCore

{

 

public static function getAttributes($db, $id_product, $id_lang)

{

$attributes = '';

$attributesArray = $db->ExecuteS('

SELECT al.name 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['name'].' ';

 

$AdditionalAttributesArray = $db->ExecuteS('

SELECT supplier_reference FROM '._DB_PREFIX_.'product_attribute

WHERE id_product = '.(int)$id_product);

foreach ($AdditionalAttributesArray AS $attribute)

$attributes .= $attribute['supplier_reference'].' ';

 

return $attributes;

}

 

}

 

call it Search.php and save it in your overrides/classes folder. Then update your index by going to

Back Office > Preferences > Search and rebuild entire index.

Edited by markb (see edit history)
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...