coziosco Posted September 6, 2017 Share Posted September 6, 2017 Hi I've been trying to dial out an issue I'm having with a search by reference code for products with combinations. e.g. if I have 3 colour combinations of a product each with it's own reference: ORT10 ORT11 ORT12 Searching for any of the reference codes returns the overview of the product correctly which can then be clicked to view details and then select the combination but I'd expect the functionality of this to take you straight to the actual combination you searched for. Far better for end users. Any thoughts? Cheers C Link to comment Share on other sites More sharing options...
Scully Posted September 6, 2017 Share Posted September 6, 2017 The search returns a list of products. If it is a precise key, the result might contain only one product. However only when clicking on the product the product detail page opens. At the time you click on the product your server doesn't know much about the previous search. To avoid that you had to override the search class in order to skip the product list if the result contains only one record and open the product witth the corresponding combination. 1 Link to comment Share on other sites More sharing options...
coziosco Posted September 6, 2017 Author Share Posted September 6, 2017 Thanks Scully. It look slike I'll need to look at overriding the search class. For me this should be basic functionality to help the end user find their product. Can you give any pointers on what I need to change? Cheers C Link to comment Share on other sites More sharing options...
Scully Posted September 6, 2017 Share Posted September 6, 2017 Counter question: Do I know your prestashop version? Link to comment Share on other sites More sharing options...
coziosco Posted September 6, 2017 Author Share Posted September 6, 2017 1.6.1.3 Link to comment Share on other sites More sharing options...
Scully Posted September 6, 2017 Share Posted September 6, 2017 I think is rather to be applied on the SearchController.php and not the Search class. Somewhere after this Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total'])); You need to check the number products, grab all needed data for product and attribute and pass this to product.tpl. if ( $search['total'] == 1 ) { // fetch product and attribute (if exists) // assingn tpl variables $this->context->smarty->assign(array(.... needed array data)) // display product.tpl instead of search tpl $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); return; } It's just a rough guide not a complete code. Link to comment Share on other sites More sharing options...
PGS_BB Posted March 16, 2022 Share Posted March 16, 2022 Hi. Did you happen to work this around? Having this issue too. When a person searches for a reference, it should go straight to the combination. Link to comment Share on other sites More sharing options...
Rafael Posted September 8, 2022 Share Posted September 8, 2022 Hi. I have the same issue. There is any solution to this problem? Regards 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