Questions about custom fields in WSN Links
Posted Aug 08, 2013 - 2:34 PM:
I have two questions regarding custom fields in WSN Links. I would like to do two things, and I am wondering if they are possible without modification of the script.
First, I would like to search a range, but use two variables in the same field ie. search by Mb and Gb in the same field, possibly by dropdown menu. For example, 200 Mb - 2 Gb. The conversion of megabyte to gigabyte should be fairly simple, I am just not sure how to implement it.
Second, I would like a field for how long the site has been operational based on the starting date. For example, if the site was founded in 2010 you could search for sites operational for 3+ years.
I am also open to ideas on how to implement these in an alternative way. Thank you for your consideration.
1. What unit does the database contain? My approach would probably be to use a visible dummy fields with onchange javascript events that set the value of a hidden field containing the appropriate database value. I could write that javascript for you as a $40 project if you'd like. If you need me to write submit and edit page javascript to convert the formats there as well, $60.
2. This is also going to depend on how the field is stored in the database. Does it contain simply a year number integer, a mysql datetime, or a unix timestamp? If it's an integer year number (simplest case), I'd again use a visible dummy field for the number of years ago and javascript to subtract that value from the current year into a hidden field (and do a less than or equal to search on that). I could do this one for you for $35 if integer year number.
1. It is a size unit, Megabyte and Gigabyte would be the units used. I will need this for two separate search fields. I will not need the code for the submit and edit pages.
2. I have not created this field yet, so I can use an integer for the year.
I have also thought of another request which may be more involved. I will be listing services with free and premium options, and they will have different values offered. Would it be easier to create two separate entries for each service, or would be able to consolidate both into a single entry and differentiate between the free and premium service?
1. I guess you haven't created the field so you don't know which it's stored as yet? Then best to store it in the database as megabytes. How will you determine whether to display the result in megabytes or gigabytes though? Are you adding another field where the submitter decides which to show it as, or do they just input their submission in megabytes and have it displayed in megabytes but potentially searched in gigabytes? Or is it input in megabytes but if it's larger than 1024 MB it should display in GB? That last one could be done with a plugin or some template PHP like <?php $size = {LINKMEGABYTES}; $unit = 'MB'; if ($size > 1024) { $size = round($size/1024, 2); $unit = 'GB'; } echo "$size $unit"; ?>
I have also thought of another request which may be more involved. I will be listing services with free and premium options, and they will have different values offered. Would it be easier to create two separate entries for each service, or would be able to consolidate both into a single entry and differentiate between the free and premium service?
By different values do you mean different fields are visible? Do you mean free vs. premium is a viewer thing not a submitter thing, so the submitter always submits the same full data but people who haven't paid view less of that when they're on the details page than people who have paid? In that case you'll be doing member usergroup sponsorship, and you'll use template conditionals to control who sees what. If your premium usergroup is named Premium, for example, you'd enclose premium information in <IF {THISMEMBERGROUPTITLE} is Premium> put all your premium stuff here </IF>
Or is it input in megabytes but if it's larger than 1024 MB it should display in GB?
Basically this. I would like to be able to search by GB as well. Searching a range of 500mb - 2GB instead of 500mb - 2048GB. As opposed to having separate fields for MB and GB. I was thinking about a drop down menu to select one or the other.
As far as free vs premium, I guess I wasn't very straightforward. I would like to combine two different plans provided by a service into one listing, rather than multiple listings for each plan. Searches would bring up features offered by the higher tier plans, but would differentiate between the them on the listing.
I'd need to see the submission form/site to understand it well, but in general it would seem like handling multiple plans would be a matter of adding other-plan versions of relevant fields on the Add Fields page. And then in the search form you'll use the highest-plan fields to search on, while the listing details shows the template variables for all the differnent plan fields.
0/5
1
2
3
4
5
Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.
Comments on Questions about custom fields in WSN Links
Beginner
Usergroup: Customer
Joined: Aug 08, 2013
Total Topics: 4
Total Comments: 6
Posted Aug 08, 2013 - 2:34 PM:
I have two questions regarding custom fields in WSN Links. I would like to do two things, and I am wondering if they are possible without modification of the script.
First, I would like to search a range, but use two variables in the same field ie. search by Mb and Gb in the same field, possibly by dropdown menu. For example, 200 Mb - 2 Gb. The conversion of megabyte to gigabyte should be fairly simple, I am just not sure how to implement it.
Second, I would like a field for how long the site has been operational based on the starting date. For example, if the site was founded in 2010 you could search for sites operational for 3+ years.
I am also open to ideas on how to implement these in an alternative way. Thank you for your consideration.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
1. What unit does the database contain? My approach would probably be to use a visible dummy fields with onchange javascript events that set the value of a hidden field containing the appropriate database value. I could write that javascript for you as a $40 project if you'd like. If you need me to write submit and edit page javascript to convert the formats there as well, $60.
2. This is also going to depend on how the field is stored in the database. Does it contain simply a year number integer, a mysql datetime, or a unix timestamp? If it's an integer year number (simplest case), I'd again use a visible dummy field for the number of years ago and javascript to subtract that value from the current year into a hidden field (and do a less than or equal to search on that). I could do this one for you for $35 if integer year number.
Beginner
Usergroup: Customer
Joined: Aug 08, 2013
Total Topics: 4
Total Comments: 6
1. It is a size unit, Megabyte and Gigabyte would be the units used. I will need this for two separate search fields. I will not need the code for the submit and edit pages.
2. I have not created this field yet, so I can use an integer for the year.
I have also thought of another request which may be more involved. I will be listing services with free and premium options, and they will have different values offered. Would it be easier to create two separate entries for each service, or would be able to consolidate both into a single entry and differentiate between the free and premium service?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
1. I guess you haven't created the field so you don't know which it's stored as yet? Then best to store it in the database as megabytes. How will you determine whether to display the result in megabytes or gigabytes though? Are you adding another field where the submitter decides which to show it as, or do they just input their submission in megabytes and have it displayed in megabytes but potentially searched in gigabytes? Or is it input in megabytes but if it's larger than 1024 MB it should display in GB? That last one could be done with a plugin or some template PHP like <?php $size = {LINKMEGABYTES}; $unit = 'MB'; if ($size > 1024) { $size = round($size/1024, 2); $unit = 'GB'; } echo "$size $unit"; ?>
I have also thought of another request which may be more involved. I will be listing services with free and premium options, and they will have different values offered. Would it be easier to create two separate entries for each service, or would be able to consolidate both into a single entry and differentiate between the free and premium service?
By different values do you mean different fields are visible? Do you mean free vs. premium is a viewer thing not a submitter thing, so the submitter always submits the same full data but people who haven't paid view less of that when they're on the details page than people who have paid? In that case you'll be doing member usergroup sponsorship, and you'll use template conditionals to control who sees what. If your premium usergroup is named Premium, for example, you'd enclose premium information in <IF {THISMEMBERGROUPTITLE} is Premium> put all your premium stuff here </IF>
Beginner
Usergroup: Customer
Joined: Aug 08, 2013
Total Topics: 4
Total Comments: 6
Basically this. I would like to be able to search by GB as well. Searching a range of 500mb - 2GB instead of 500mb - 2048GB. As opposed to having separate fields for MB and GB. I was thinking about a drop down menu to select one or the other.
As far as free vs premium, I guess I wasn't very straightforward. I would like to combine two different plans provided by a service into one listing, rather than multiple listings for each plan. Searches would bring up features offered by the higher tier plans, but would differentiate between the them on the listing.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I'd need to see the submission form/site to understand it well, but in general it would seem like handling multiple plans would be a matter of adding other-plan versions of relevant fields on the Add Fields page. And then in the search form you'll use the highest-plan fields to search on, while the listing details shows the template variables for all the differnent plan fields.