Search options checked by default

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi,
In the Search page, I want the two options (check boxes):
"Advanced search" and "Search In product descriptions" are checked by default.
How can I do that?
12 years ago
Follow the next steps:
1. Open \Presentation\Nop.Web\Controllers\CatalogController.cs file
2. Find 'Search'Search method
3. Replace
if (model == null)
   model = new SearchModel();

with
if (model == null)
                model = new SearchModel();
            if (Request.Params["As"] != null)
                model.As = true;
            if (Request.Params["Sid"] != null)
                model.Sid = true;

4. Recompile the solution
12 years ago
Hi a.m.
I have nopcommerce 2.20. I don't have that path
12 years ago
Liz this is the code change for 2.20. You can find the file in Visual Studio under Presentation>>Nop.Web>>Controlers>>CatalogController.cs

Andrei I have one question regarding the search functionality, sorry its a bit off topic. When I search lets say ASUS in computers I don't get any results.
I have to select Computers>>Notebooks to get the right results. Shouldn't it search in all sub categories of Computer and show the results?
This limits the search capabilities I think.
12 years ago
sorry my ignorance, but I don't even have a folder call presentation or controler. where exactly is that. i opened the web site in Visual web Develper 2010 express or Webmatrix.
12 years ago
Andrei I tried the code that you mentioned but the advanced search and product description check boxes were not checked by default the I made a small change and changed the != to ==:


if (model == null)                model = new SearchModel();            
if (Request.Params["As"] == null)                model.As = true;            
if (Request.Params["Sid"] == null)                model.Sid = true;


and now both are checked by default. Kindly guide if I am doing anything wrong...
12 years ago
Liz wrote:
sorry my ignorance, but I don't even have a folder call presentation or controler. where exactly is that. i opened the web site in Visual web Develper 2010 express or Webmatrix.


No problem...actually in VWD or Exoress editions you can't open the folders of the solution so therefore you can't see it. You can either install Visual Studio pro version or just go to :

 (the folder where you extracted nopCommerce source)\Presentation\Nop.Web\Controllers


There you will find CatalogController.cs open this file in VWD oe Webmatrix and you will see different regions.
Open the region named "Searching" and its the first line of code. I just posted a correction to the code kindly check and confirm.
12 years ago
Actually the nopcommerce 2.20 was installed with the WPI(Web platform installer) from nopcommerce page. Then, I opened Webmatrix and chose "Site from Web Gallery" and I selected nopcommerce to create the webpage. I don't know where that folder is :S
12 years ago
Can somebody  guide me with this please. . .
12 years ago
Liz wrote:
Actually the nopcommerce 2.20 was installed with the WPI(Web platform installer) from nopcommerce page. Then, I opened Webmatrix and chose "Site from Web Gallery" and I selected nopcommerce to create the webpage. I don't know where that folder is :S

You need source code version in order to apply the changes
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.