• Resolved MaDGLaZ

    (@madglaz)


    Hi guys! I really really enjoy this plugin, very very handy.

    I have a form with very simple calculations. Fill in with how many people you are and you can see the price of 10 different music bands (for rent). Here is my question;

    Is it possible to somehow sort the results on highest/cheapest price?

    Love to hear from you! Kind regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @madglaz,

    I’m sorry, but I cannot respond to your question without additional details, and the link to your webpage for checking the form in action.

    How are loaded the music bands and from where?

    Best regards.

    Thread Starter MaDGLaZ

    (@madglaz)

    Oh that’s easy. You can find the price check here. Its a very simple form. You just fill in a couple of things on the top and below the prices are calculated. Love to hear from you!

    Plugin Author codepeople

    (@codepeople)

    Hello @madglaz,

    If you want change the form’s structure based on the calculated prices, I recommend you a different implementation, that I will try to describe with an example. Assuming there are three bands:

    Band 1, whose logo is: http://www.yourwebsite.com/band-1.jpg, and the equation to calculate its price: fieldname1*2+fieldname2*3

    Band 2, with logo: http://www.yourwebsite.com/band-2.jpg, and the equation: fieldname1*4+fieldname2*2

    and Band 3, with logo: http://www.yourwebsite.com/band-3.jpg, and the equation: fieldname1*3+fieldname2

    First, insert a “HTML Content” field in the form (where will be displayed the result) with the following piece of code as its content:

    
    <div class="result-container"></div>
    

    Second, insert an unique calculated field with an equation similar to:

    
    (function(){
    var result = '', list = [], tmp;
    tmp = fieldname1*2+fieldname2*3;
    list[ROUND(tmp)] = '<tr><td><img src="http://www.yourwebsite.com/band-1.jpg"></td><td>€ '+tmp+'</td>';
    tmp = fieldname1*4+fieldname2*2;
    list[ROUND(tmp)] = '<tr><td><img src="http://www.yourwebsite.com/band-2.jpg"></td><td>€ '+tmp+'</td>';
    tmp = fieldname1*3+fieldname2;
    list[ROUND(tmp)] = '<tr><td><img src="http://www.yourwebsite.com/band-3.jpg"></td><td>€ '+tmp+'</td>';
    result = '<table>'+list.join('')+'</table>';
    jQuery('.result-container').html(result);
    })()
    

    and that’s all.

    If you need additional help implementing your project, I can offer you a custom coding service from my private website:

    https://cff.dwbooster.com/customization

    Best regards.

    Thread Starter MaDGLaZ

    (@madglaz)

    Oh Wauw that is exactly what I wanted. It works like a charm! You are great thank you so much!!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Sort results’ is closed to new replies.