Jump to content

Create a listing field that calculates average spent from the reviews


bryan choo

Recommended Posts

Basically I want to display the "Average spent" for each listings, based on the number entered by people in their reviews.

 

So I need a function that takes the values from that specific field in all the reviews. It adds them up and calculates it producing the "average spent".

 

So something like this

 

<?php echo round(((Sanitize::getVar($listing['review'],'sum_avg_spent') / $review_count)),1);?>

 

 

Willing to pay whatever is a fair amount. There is also a few other stuff im looking forward to coding so there are more opportunities.

 

 

To help get it started, this is what Alejandaro said

 

The information is in the database, so performing the calculation is possible, but you'll need to get someone to help you do it because it's not simply adding a line of code in the theme file. You have to modify the afterFind method in the listing.php model to add the information to the $listings var so it becomes available in the theme file. My recommendation is that you post this in the freelancer board because this sort of request is outside the scope of support.

Link to comment
×
×
  • Create New...