Search Field

21 posts by 3 authors in: Forums > CMS Builder
Last Post: July 6, 2011   (RSS)

By robin - June 30, 2011

Hey,

Line 14 looks like the right place to add the new WHERE condition from Jason.

What does debugSql output now when you search for dia 1x1?

Thanks,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Search Field

By dccreatives - July 4, 2011

SELECT SQL_CALC_FOUND_ROWS `items`.*FROM `cms_items` as `items` WHERE (REPLACE(name, ' ', '') LIKE '%%' AND (`name` LIKE '%ray8%')) AND items.hidden = 0 ORDER BY dragSortOrder DESC LIMIT 45SELECT * FROM `cms_uploads` WHERE tableName = 'items' AND fieldName IN ('logo','small_logo','tab1','tab2','tab3','tab4','tab5','main_image','project_images','mounting_options','luminaire_dimensions','light_distribution','row_configuration','tab_top1_beam','tab_top2_beam','asymmetric','tab6') AND recordNum IN (110,109,108,98) ORDER BY `order`, numSELECT SQL_CALC_FOUND_ROWS `accounts`.*FROM `cms_accounts` as `accounts` WHERE (`num` IN (2)) ORDER BY fullname, usernameNow it is only searching if there is white space. Ray8 or Ray 8 work. But Dia 1x1 or Dia1x1 do not work. It is called Dia 1x4 in the backend. So ignoring the whitespace should allow me to search either way, but it does not.

By robin - July 4, 2011

Hey,

I found a problem from the sql output. I think your variable is named wrong and is showing up blank in the query.

@$_REQUEST['name_keywords']

should be:

@$_REQUEST['name_keyword']

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Search Field

By dccreatives - July 4, 2011

ok, I corrected it. Now I am not getting errors, but I am not getting my results.

When I search Ray 8 or Ray8. I am getting the correct results.

When I search Dia1x1 or Dia 1x1, Day 1x1, twin beam2, twinbeam2. I get no results.

By robin - July 4, 2011

Hey,

Please post the new sql debug information, maybe there will be another clue.

Thanks!
Robin
Programmer
interactivetools.com

Re: [robin] Search Field

By dccreatives - July 5, 2011

When I search dia 1x1 this is the results:SELECT SQL_CALC_FOUND_ROWS `items`.*FROM `cms_items` as `items` WHERE (REPLACE(name, ' ', '') LIKE '%dia1x4%' AND (`name` LIKE '%dia1x4%')) AND items.hidden = 0 ORDER BY dragSortOrder DESC LIMIT 45When I search for Ray8 this is the results:SELECT SQL_CALC_FOUND_ROWS `items`.*FROM `cms_items` as `items` WHERE (REPLACE(name, ' ', '') LIKE '%ray8%' AND (`name` LIKE '%ray8%')) AND items.hidden = 0 ORDER BY dragSortOrder DESC LIMIT 45SELECT * FROM `cms_uploads` WHERE tableName = 'items' AND fieldName IN ('logo','small_logo','tab1','tab2','tab3','tab4','tab5','main_image','project_images','mounting_options','luminaire_dimensions','light_distribution','row_configuration','tab_top1_beam','tab_top2_beam','asymmetric','tab6') AND recordNum IN (110,109,108,98) ORDER BY `order`, numSELECT SQL_CALC_FOUND_ROWS `accounts`.*FROM `cms_accounts` as `accounts` WHERE (`num` IN (2)) ORDER BY fullname, usernameWhen I search dia this is the results:SELECT SQL_CALC_FOUND_ROWS `items`.*FROM `cms_items` as `items` WHERE (REPLACE(name, ' ', '') LIKE '%dia%' AND (`name` LIKE '%dia%')) AND items.hidden = 0 ORDER BY dragSortOrder DESC LIMIT 45SELECT * FROM `cms_uploads` WHERE tableName = 'items' AND fieldName IN ('logo','small_logo','tab1','tab2','tab3','tab4','tab5','main_image','project_images','mounting_options','luminaire_dimensions','light_distribution','row_configuration','tab_top1_beam','tab_top2_beam','asymmetric','tab6') AND recordNum IN (1,17,2,18,3,19,4,20) ORDER BY `order`, numSELECT SQL_CALC_FOUND_ROWS `accounts`.*FROM `cms_accounts` as `accounts` WHERE (`num` IN (1)) ORDER BY fullname, usernameALL 3 searches should give me results and the only one not returning the correct results is dia 1x1 when in fact that is exactly how it is called in the database.Thank You.

By robin - July 5, 2011 - edited: July 5, 2011

Ah, I see in the SQL output that it is searching both the custom where and also automatically searching the name field. Here:
(REPLACE(name, ' ', '') LIKE '%dia1x4%' AND (`name` LIKE '%dia1x4%'))
It is the automatic search that is throwing off the query. We can prevent that by adding this line to your getRecords Code:
'allowSearch' => false,

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

By robin - July 5, 2011

Nice, I'm glad we got that settled.

Thanks,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Search Field

By dccreatives - July 5, 2011

It might interest you guys to see our finished product that we have created with CMS Builder.

www.axislighting.com/cms

The site is going to launch soon and we believe it came out really nice.

Let us know what you think.

The catalog is found under the Products Link.