Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Ade / Birthdays advanced searcg behaviour

11 years 10 months ago
  • Sergey's Avatar
    Topic Author
  • Sergey
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Licenses:
JomSocial Expired

Hello,

I am creating a dating site and I want my users to use Advanced Search by age. I know there is possibility to click "age" field to search by age, but actually this is not user friendly. (Even myself I could not distinguish this great feature when I was seraching for the first times).
As the site is for dating, there is no sense to search by birth date.

QUESTIONS
Is there any possibility to disable search by birth date?
If not, is there possibility to have search by age as default option? (at the moment, search by date is default and you need to click "age" to switch it, which is not friendly).

//I am also aware about dating search plugin, but that one has lack of functionality as for Advanced Search.

Thank you.

11 years 10 months ago
Licenses:

Hi Sergey,

1) Is there any possibility to disable search by birth date?
- yes you can do it from jomsocial backend > profiles > customize profile > and set Searchable to any fields you want

2) If not, is there possibility to have search by age as default option? (at the moment, search by date is default and you need to click "age" to switch it, which is not friendly).
- you can do it by using template override ( documentation.jomsocial.com/wiki/Customizing_Template )
copy search.advancesearch.php from /components/com_community/templates/default/ to /templates/youractivetemplate/html/com_community/ and put this code

if (value == 'FIELD_BIRTHDATE') joms.jQuery('#valueinput'+id+' a').click();
after line 306 under
changeField: function ( id ) 

if you dont know how to do it. you can provide me FTP access detail by editing your first post at this topic. put it under site info form.

Regards,
Albert

11 years 10 months ago
  • Sergey's Avatar
    Topic Author
  • Sergey
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Licenses:
JomSocial Expired

Hi Albertus,
Thanks for quick reply!
I have found the file search.advancesearch.php in the folder /components/com_community/templates/default/
The folder /templates/youractivetemplate/html/ did not contain folder /com_community/, so I created it and copied above file here.

The above file did not contain the mentioned string at line 306. But I could find this string at line #235.
So, I put your code at line 236:

if (value == 'FIELD_BIRTHDATE') joms.jQuery('#valueinput'+id+' a').click();

Attachment 2014-12-0410.45.17.png not found



I have cleared my browser's cache and tried to checkit. However it does not work. It still shows date of birth as default fields, not age.

I have edited my original message to enter FTP details. Can you kindly check it?

ADDITIONAL REQUEST
Also, I will need to change language in the search field from BIRTHDATE to AGE. Because my site is multilingual, I am currently using an own constant LNG_JS_BIRTH and language overrides to make output of "Date of Birth". But if I override this constant with age, it will be also showing age at the time of registration (while I still need to keep "Date of Birth" at registration.

This means I will ask you to kindly replace output from contents of FIELD_BIRTHDATE to some constant like LNG_JS_AGE. This constant must be only in Advanced Search section (not in Registration section).
Is it possible?

Best regards,
Sergey

Attachments:
11 years 10 months ago
Licenses:

Hi Sergey,

you must put that code at the end of changeField function, before

},

about additional request, you can follow this doc:
documentation.jomsocial.com/wiki/Translate_Elements

Regards,
Albert

11 years 10 months ago
  • Sergey's Avatar
    Topic Author
  • Sergey
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Licenses:
JomSocial Expired

Hi Albertus,

Thanks for your help. Now, the Advance Search works as desired: age is set by default.

However, I still have an issue with translation. If I follow your link regarding elements translation, I can change name from "Date of Birth" to "Age" successfully. However, in this case, at the time of new user registration he is also requested to input his AGE instead of BIRTH DATE.

I believe, these two fields shall be separately distinguished somehow.. Is there any simple possibility to print out some constant like LNG_JS_AGE at the time of birthdate field print in the Advanced Search?

Thank you.

11 years 10 months ago
Licenses:

Hi Sergey,

for using LNG_JS_AGE, please follow this steps:
1. copy search.advancesearch.php from /components/com_community/templates/default/ to /templates/rt_tachyon/html/com_community/
2. edit it, and find this code

criteria +='<option value="<?php echo addslashes($field->fieldcode); ?>" <?php echo $selected; ?>><?php echo JText::_(addslashes(JString::trim($field->name)));?></option>';
replace it with
<?php if ($field->fieldcode == 'FIELD_BIRTHDATE') { ?>
	criteria +='<option value="<?php echo addslashes($field->fieldcode); ?>" <?php echo $selected; ?>><?php echo JText::_('LNG_JS_AGE');?></option>';
<?php } else { ?>
	criteria +='<option value="<?php echo addslashes($field->fieldcode); ?>" <?php echo $selected; ?>><?php echo JText::_(addslashes(JString::trim($field->name)));?></option>';
<?php } ?>

Regards,
Albert

The following user(s) said Thank You: Sergey
11 years 10 months ago
  • Sergey's Avatar
    Topic Author
  • Sergey
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Licenses:
JomSocial Expired

That works perfectly!
I guess your support might have gone beyound the standard limits. Appreciate that.

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW