Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Product Search

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 04-07-2016, 06:45 AM
  razorblade's Avatar 
razorblade razorblade is offline
 

Advanced Member
  
Join Date: Oct 2005
Posts: 39
 

Default Product Search

I think this should be a pretty straight forward modification...

I would like to know if there is a way to change the default product search from "any words" to "all words"

I'm using X-Cart Business 5.2.13
__________________
/razorblade pro/
v 5.2.21
linux 2.2.29
Reply With Quote
  #2  
Old 04-07-2016, 11:45 AM
 
xim xim is offline
 

X-Cart team
  
Join Date: Nov 2004
Posts: 677
 

Default Re: Product Search

cloud search will be the best solution for you: http://www.x-cart.com/extensions/addons/cloudsearch.html

it uses intelligent search
__________________
Sincerely yours, Max Vydrin
Reply With Quote
  #3  
Old 04-07-2016, 12:13 PM
  razorblade's Avatar 
razorblade razorblade is offline
 

Advanced Member
  
Join Date: Oct 2005
Posts: 39
 

Default Re: Product Search

Quote:
Originally Posted by xim
cloud search will be the best solution for you: http://www.x-cart.com/extensions/addons/cloudsearch.html

it uses intelligent search

Thank you but we had Cloud Search enabled until we hit the "free" limit. And even then the results weren't all that great.
I would much rather not pay an exorbitant monthly fee for something that should be easily tweaked out of the box.

Can you tell me how to change the default search from "any words" to "all words" ?
__________________
/razorblade pro/
v 5.2.21
linux 2.2.29
Reply With Quote
  #4  
Old 04-08-2016, 01:33 PM
  razortw's Avatar 
razortw razortw is offline
 

X-Cart team
  
Join Date: Feb 2015
Posts: 807
 

Default Re: Product Search

Hi there.
Open /classes/XLite/View/Form/Product/Search/Customer/SimpleForm.php, find this code
Code:
protected function getDefaultParams() { return parent::getDefaultParams() + array( \XLite\View\ItemsList\Product\Customer\Search::PARAM_INCLUDING => \XLite\Model\Repo\Product::INCLUDING_ANY, ); }
and replace it with
Code:
protected function getDefaultParams() { return parent::getDefaultParams() + array( \XLite\View\ItemsList\Product\Customer\Search::PARAM_INCLUDING => \XLite\Model\Repo\Product::INCLUDING_ALL, ); }
Should do the trick.
Of course, any code changes should be implemented as a module in order to keep them intact during upgrades
__________________
Best regards,
Igor Pudovkin
X-Cart hosting team
Reply With Quote

The following user thanks razortw for this useful post:
razorblade (04-09-2016)
  #5  
Old 04-09-2016, 09:17 AM
  razorblade's Avatar 
razorblade razorblade is offline
 

Advanced Member
  
Join Date: Oct 2005
Posts: 39
 

Default Re: Product Search

Quote:
Originally Posted by razortw
Hi there.
Open /classes/XLite/View/Form/Product/Search/Customer/SimpleForm.php, find this code
Code:
protected function getDefaultParams() { return parent::getDefaultParams() + array( \XLite\View\ItemsList\Product\Customer\Search::PARAM_INCLUDING => \XLite\Model\Repo\Product::INCLUDING_ANY, ); }
and replace it with
Code:
protected function getDefaultParams() { return parent::getDefaultParams() + array( \XLite\View\ItemsList\Product\Customer\Search::PARAM_INCLUDING => \XLite\Model\Repo\Product::INCLUDING_ALL, ); }
Should do the trick.
Of course, any code changes should be implemented as a module in order to keep them intact during upgrades

That actually reminds me; I have a question about creating modules.
I have seen the instructions for creating empty modules.
Can one empty module contain any and all specific mods I make to our xcart?
Like, in one module - I have some CSS changes as well as this particular search customization?
Or do I have to create new modules for everything?
Also, how does this ensure they will be maintained during upgrades?
__________________
/razorblade pro/
v 5.2.21
linux 2.2.29
Reply With Quote
  #6  
Old 04-12-2016, 09:05 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Product Search

You may put as many features into a single module as you want.

However, the more complex your module is, the harder it will be for you to keep it compatible with newer X-Cart versions.
When adapting a module having a lot of features mixed in to a new X-Cart version, fixing one thing may break another one.

If you think the change that you are working on can be useful for other users/stores, it makes sense to wrap it up into its own module. You can even submit the module to our marketplace later.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #7  
Old 04-26-2016, 08:49 AM
 
BrandonLR BrandonLR is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 161
 

Default Re: Product Search

So how would I create a module for this specific search change function?
__________________
X-Cart Business 5.4.1.29
Reply With Quote
  #8  
Old 04-26-2016, 11:49 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Product Search

Please refer to the documentation for developers - it explains how you can create your custom modules:
http://kb.x-cart.com/

What you are to do is create a custom module that decorates the \XLite\View\Form\Product\Search\Customer\SimpleFor m class and tweaks the getDefaultParams() method as Igor advised:
https://forum.x-cart.com/showpost.php?p=395690&postcount=4
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #9  
Old 04-27-2016, 04:39 AM
 
BrandonLR BrandonLR is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 161
 

Default Re: Product Search

Quote:
Originally Posted by qualiteam
Please refer to the documentation for developers - it explains how you can create your custom modules:
http://kb.x-cart.com/

What you are to do is create a custom module that decorates the \XLite\View\Form\Product\Search\Customer\SimpleFor m class and tweaks the getDefaultParams() method as Igor advised:
https://forum.x-cart.com/showpost.php?p=395690&postcount=4


I saw his post above, but thank you for linking it here.
So, I just "decorate" it? Awesome. Whatever that means.

Thanks for your help Alex
__________________
X-Cart Business 5.4.1.29
Reply With Quote
  #10  
Old 04-27-2016, 05:14 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Product Search

Did you check the http://kb.x-cart.com/ link that I posted too?
This documentation for developers explains a lot of things including what "decorate" means.
For instance, check this article:
http://kb.x-cart.com/display/XDD/Adding+CSS+and+JS+files+for+Mobile+Skin
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:02 PM.

   

 
X-Cart forums © 2001-2020