jcoletta Posted September 11, 2013 Share Posted September 11, 2013 Hi,I have a problem with my prestashop store. My store is: http://recambioprofesionalbarato.comI have loaded about a thousand products, with reference codes to vehicles which account for each exchange.But my problem comes here: I want these codes are found in the search, even if placed with or without spaces.For example, when I do the search:0 986 013 850The search engine will find it perfectly.However, if we look no spaces:0986013850The search finds nothing.Is there an automatic way? Can you help me?Looking forward for your answer. Link to comment Share on other sites More sharing options...
NemoPS Posted September 11, 2013 Share Posted September 11, 2013 Hi, as far as I know, the only 'simple' way to do it is adding 'aliases' one by one, so that the spaceless version returns the spaced version in preferences->search. The problem is, you have to add them all manually Link to comment Share on other sites More sharing options...
jcoletta Posted September 12, 2013 Author Share Posted September 12, 2013 Thanks Nemo1! but, is there any code modification that I can do in order to solve this problem? thanks again! Link to comment Share on other sites More sharing options...
jgullstr Posted September 12, 2013 Share Posted September 12, 2013 You could autogenerate aliases by doing something like this: $sql = 'SELECT `reference` FROM `'._DB_PREFIX_.'product`'; $refs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($q); foreach($refs as $ref){ $alias = new Alias(); $alias->search = preg_replace('/\s+/', '', $ref['reference']); $alias->alias = $ref['reference']; $alias->save(); } I have not tested this, use at your own risk. 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