Login or create new account.

By registering on joomprod.com, you will have immediate access to all our free products and to the public side of our support forum.

Enjoy our subscriptions.

Each of our subscriptions allow you to enjoy the private side of the support forum and all the update of our products for a period ranging from 3 months to 1 year.

Payment And immediate download.

After subscribing to one of our subscription, the products are immediately downloadable.

Login

Or Register
Accueil / forum / Public Forum / Main Forum / Presales / [RESOLVED] Search only work on certain fields

Support Availability Because we must sleep sometimes

Working days: Monday to Friday.
Reply time: Depending on the complexity of your support issue it's usually between a few hours to 48 hours.

Support is only guaranteed to paid subscribers

AdsManager - End of life

It is with great regrets that we have chosen to end the developpement of Adsmanager and its other associated components.

AdsManager is born 10 years ago and, as of today, the number of new subscriptions and downloads have fallen and we cannot maintain the component anymore.

All active subscribers will be able to continue enjoying support until the end of their subscription.

The components will be free and no support will be provided anymore for the other users.

×

Notice

The forum is in read only mode.

[RESOLVED] Search only work on certain fields

  • Santiago33
  • Topic Author
  • Offline
  • User is blocked
  • User is blocked
More
11 years 8 months ago - 11 years 7 months ago #537 by Santiago33
Searching for my problem, I found this in the old forum:

forum.joomprod.com/viewtopic.php?f=2&t=16

I have deployed both 2.2.2, and 2.5 of Adsmanager on different websites, and believe adsmanager is a great extension to Joomla. ( I am currently running these on Joomla 1.5.10)

On both versions though I have the same little "search problem", and are sure someone has come across and sorted this before.

When using the standard adsmanager search (mod_adsmanager_search) I found that this only perform a search and display results from 2 of the fields (ad_headline and ad_text) All other fields seem to be ignored.

The advanced search works fine, but I would like my visitors to search and find corresponding ads already from the adsmanager frontpage.....

Anyone know how I can amend this "standard search" to search all fields?

I have spent a bit of time looking at this myself without getting anywhere, so would really appreciate some input here :)

Reg.
Goran


I'm working with Adsmanager 2.8.2.

How can I solve this?

Regards
Santi
Last edit: 11 years 7 months ago by tompap.
More
11 years 8 months ago #539 by Ads4ever
Replied by Ads4ever on topic Search only work on certain fields
Hello,

If you want for example that Adsmanager take on consideration the field ad_carmodel you should then edit the file :

ROOT_JOOMLA_DIR/administrator/components/com_adsmanager/models/content.php

Line 265 , 267, 272, 274

replace this code from this :

$search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text)
LIKE '%".$this->_db->getEscaped($filter,true)."%')";

to this :
$search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text)
LIKE '%".$this->_db->getEscaped($filter,true)."%'  
 OR LOWER(a.ad_carmodel) LIKE '%".$this->_db->getEscaped($filter,true)."%'  )";


notice the added code :

OR  LOWER(a.ad_carmodel) LIKE '%".$this->_db->getEscaped($filter,true)."%'


repeat this code for your fields that you want that Adsmanager take on consideration while searching


PS: Please don't forget to make a backup before modifying the file, and you should be aware that this modification will be lost when you update Adsmanger, I didn't test the code, but it should works

Founder of ITechnoDev
More
11 years 8 months ago #547 by santiago34
Replied by santiago34 on topic Search only work on certain fields
Well, the forum detected me as spamer and block my account. And lost what I wrote

Anyway, thanks for the reply.

I tried but doesn't seems to work.

Replaced this:
case 'search':
	    				if (intval($filter) != 0) {
	    					$filter = JString::strtolower($filter);
	    					$id = intval($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }
	    				} else {
	    					$filter = JString::strtolower($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }
	    				}


With this:

case 'search':
	    				if (intval($filter) != 0) {
	    					$filter = JString::strtolower($filter);
	    					$id = intval($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_materia) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_materia) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }
	    				} else {
	    					$filter = JString::strtolower($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_materia) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_materia) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }
	    				}


I'm doing something wrong?

Obviously, the field that I want to search for is 'ad_materia'
More
11 years 8 months ago - 11 years 8 months ago #548 by Ads4ever
Replied by Ads4ever on topic Search only work on certain fields
Hello,

what kind of error you got ? and what is the type of that field ?

Edit:

I tested the code :


 
	    			case 'search':
	    				if (intval($filter) != 0) {
	    					$filter = JString::strtolower($filter);
	    					$id = intval($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_carmodel) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_carmodel) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }
	    				} else {
	    					$filter = JString::strtolower($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_carmodel) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_carmodel) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }
	    				}
	    				break;
 


and it works for me, ad_carmodel is a text field


Edit 2 :

if it's not a text field, a drop down single select for example, and you selected the value as integers, so "ad_materia" will have an integer value and the search module will not show it, so you need to get the text value of that field ..

Founder of ITechnoDev
Last edit: 11 years 8 months ago by Ads4ever.
  • Santiago33
  • Topic Author
  • Offline
  • User is blocked
  • User is blocked
More
11 years 8 months ago #565 by Santiago33
Replied by Santiago33 on topic Search only work on certain fields
Thanks for the reply.
I tried but doesn't seems to work :(

This is the code:

case 'search':
	    				if (intval($filter) != 0) {
	    					$filter = JString::strtolower($filter);
	    					$id = intval($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }
	    				} else {
	    					$filter = JString::strtolower($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%')";
                            }else{
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%')";
                            }

And replaced with:

case 'search':
	    				if (intval($filter) != 0) {
	    					$filter = JString::strtolower($filter);
	    					$id = intval($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%' [color=#bb0000]OR LOWER(a.ad_materia) LIKE '%".$this->_db->getEscaped($filter,true)."%'[/color])";
                            }else{
                                $search .= $temp."(a.id = $id OR LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%' [color=#bb0000]OR LOWER(a.ad_materia) LIKE '%".$this->_db->escape($filter,true)."%[/color]')";
                            }
	    				} else {
	    					$filter = JString::strtolower($filter);
                            if (version_compare(JVERSION,'1.7.0','<')) {
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->getEscaped($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->getEscaped($filter,true)."%' [color=#bb0000]OR LOWER(a.ad_materia) LIKE '%".$this->_db->getEscaped($filter,true)."%'[/color])";
                            }else{
                                $search .= $temp."(LOWER(a.ad_headline) LIKE '%".$this->_db->escape($filter,true)."%' OR LOWER(a.ad_text) LIKE '%".$this->_db->escape($filter,true)."%' [color=#bb0000]OR LOWER(a.ad_materia) LIKE '%".$this->_db->escape($filter,true)."%'[/color])";
                            }
	    				}


Obviously, the field that I want search for is 'ad_materia'
More
11 years 8 months ago #571 by santiago34
Replied by santiago34 on topic Search only work on certain fields

Ads4ever wrote: Edit 2 :

if it's not a text field, a drop down single select for example, and you selected the value as integers, so "ad_materia" will have an integer value and the search module will not show it, so you need to get the text value of that field ..



Ahhhh, that's the problem. The field is a drop down single select.

Seems to be more complicated because you must make a cross reference between "__adsmanager_filed_values". Even, can this makes the search go slowler?

Sincerely, I've no idea how to make it, it could be something looking like this:

SELECT fieldvalue.* as value FROM #__adsmanager_field_values WHERE fieldtitle.* is like "something search"

SELECT "__adsmanager_ads" WHERE value = ad_materia


Can you help me?
Time to create page: 0.208 seconds
Powered by Kunena Forum