Ads per page

This topic contains 7 replies, has 2 voices, and was last updated by  Za Kene 1 year, 8 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2584 Reply

    Za Kene
    Participant

    Hi support,

    why this area is not working? http://gyazo.com/9bc78607b6d513d6f7e2eda9c80968c6
    how to make it according to the value (0)? which code should be changed?

    Thanks

    #2587 Reply

    Za Kene
    Participant

    I mean, only appear ads that match the search on custom fields.
    for example;
    #1 custom field type = dropdown
    #2 custom field type = text

    If the value of the #1 custom field is correct, but the #2 custom fields doesn’t correct, ads is not visible
    If both values in the custom fields is correct, then the ad will visible (only match with the value)

    Thanks 🙂

    #2590 Reply

    ClassiBase
    Keymaster

    If you want #2 custom field type = text to be exact match then you have to edit source code. Edit /sys/app/models/Ad.php file inside buildCustomQuery model find lines

    case AdField::TYPE_TEXT:
    						case AdField::TYPE_ADDRESS:
    						case AdField::TYPE_URL:
    						case AdField::TYPE_EMAIL:
    						default:
    							// regular text, use like statement
    							$val = trim($ids[$af->id]);
    							if(strlen($val))
    							{
    								$from[] = AdFieldRelation::tableNameFromClassName('AdFieldRelation') . ' afr' . $i;
    								$whereA[] = "ad.id=afr{$i}.ad_id AND afr{$i}.field_id=? AND afr{$i}.val LIKE ?";
    								$whereB[] = $af->id;
    								$whereB[] = '%' . $val . '%';
    								$str_val = $val;
    								$search_desc_arr[] = View::escape(AdField::getName($af) . ':' . $str_val)
    										. Language::thisUrlRemoveLink(array('cf' => array($af->id => '')), true);
    								$search_title_arr['cf'][$af->id] = Ad::makeCustomValueMeaningfull($str_val, AdField::getName($af));
    							}
    							break;

    change to

    case AdField::TYPE_TEXT:
    						case AdField::TYPE_ADDRESS:
    						case AdField::TYPE_URL:
    						case AdField::TYPE_EMAIL:
    						default:
    							// regular text, use like statement
    							$val = trim($ids[$af->id]);
    							if(strlen($val))
    							{
    								$from[] = AdFieldRelation::tableNameFromClassName('AdFieldRelation') . ' afr' . $i;
    								$whereA[] = "ad.id=afr{$i}.ad_id AND afr{$i}.field_id=? AND afr{$i}.val = ?";
    								$whereB[] = $af->id;
    								$whereB[] = $val;
    								$str_val = $val;
    								$search_desc_arr[] = View::escape(AdField::getName($af) . ':' . $str_val)
    										. Language::thisUrlRemoveLink(array('cf' => array($af->id => '')), true);
    								$search_title_arr['cf'][$af->id] = Ad::makeCustomValueMeaningfull($str_val, AdField::getName($af));
    							}
    							break;
    #2593 Reply

    ClassiBase
    Keymaster

    Regarding 0 value for ads per page you can have 0 for featured ads but regular ads if set to 0 it will use default value 30. Because ads should be listed on category page.

    If you want to hide ads on homepage or location page then navigate to “Appearance” -> “Widgets” in admin panel and on right top switch from “Sidebars” to “Pages”. There you will see widgets for homepage. You can add or remove any widget to fit your needs.

    #2595 Reply

    Za Kene
    Participant

    Thanks Support,

    I use your code and its work.
    Last question, if the search doesn’t match, how to remove / disable the button ‘View all’ and ‘View all listings in this category’? http://gyazo.com/1fd963ee1a0bdd1770c2729110561134
    I want users can not see the other ads in the category, and ads in all categories. Which code should be changed ?

    Regards,

    #2598 Reply

    ClassiBase
    Keymaster

    To remove view all edit /user-content/themes/YOURTHEME/views/index/category.php file and remove following lines:

    $search_desc .= ' <a href="' . Location::url($selected_location, $selected_category) . '">' . __('View all') . '</a>';

    and

    echo '<p><a href="' . Location::url($selected_location, $selected_category) . '">' . __('View all listings in this category.') . '</a></p>';

    Also you can remove all lines inside that else statement and display your own message if no ads found.
    Something like this:

    echo '<p>'.View::escape(__('No ads found')).'</p>';

    #2600 Reply

    Za Kene
    Participant

    Thanks for your advise,

    I try following the code, but the ads are match with the custom field is not visible.
    I use the theme odnocved. what is wrong with that code?

    Thank ‘n regards.

    #2603 Reply

    Za Kene
    Participant

    Hi Support,

    There is some code that not completely remove, now my problem has been resolved and i get what i want 🙂

    Thanks for your support.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Ads per page
Your information:




This entry was posted on by .