+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Calculate the average price of each category

  1. #1
    Member
    Join Date
    Jul 2016
    Location
    Iran
    Posts
    74

    Question Calculate the average price of each category

    Hello,

    I use auto script. I want to display the average price of each car based on its build year filed on the listing page.
    Please help me which file to edit and how?
    Car sell in: BanBan.ir

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    Hello,

    Do you mean some formula by which the average price should be calculated?

    Go to includes > controllers > listing_details.inc.php

    and after:
    PHP Code:
    Only registered members can view the code
    assign a new price using your formula:

    PHP Code:
    Only registered members can view the code
    Last edited by Rudi; May 14, 2018 at 04:35 AM.

  3. #3
    Hi Rudi,

    I think it is not true because the variable: $listing_data['price'] has format: 100|dollar and this variable cannot be used in a formula.
    Mousa, how do you want to calculate the average price by build year? Send us formula and we will create code for it.
    Also, Do you want it on details page or category browse page?
    Viktor,
    Flynax technical department,
    Best wishes.

  4. #4
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    my mistake,

    it can be done like that:

    PHP Code:
    Only registered members can view the code
    Last edited by Rudi; May 14, 2018 at 04:33 AM.

  5. #5
    Member
    Join Date
    Jul 2016
    Location
    Iran
    Posts
    74
    Quote Originally Posted by Viktor View Post
    Hi Rudi,

    I think it is not true because the variable: $listing_data['price'] has format: 100|dollar and this variable cannot be used in a formula.
    Mousa, how do you want to calculate the average price by build year? Send us formula and we will create code for it.
    Also, Do you want it on details page or category browse page?
    Hello,

    Thanks Viktor and Rudi for yours response.
    I want calculate conditional average price by build year filed (Same AVERAGEIF Function in Ms Excel).
    Please check Attached image
    Average_Price.jpg
    Car sell in: BanBan.ir

  6. #6
    I don't see any formula, only list of prices by categories and years. But how do you want to calculate it?
    Or maybe you want middle price between your cars? For example:
    car1: 21000
    car2: 22000
    car3: 25000
    formula will be: (car1+car2+car3)/3 = 22.666USD
    Viktor,
    Flynax technical department,
    Best wishes.

  7. #7
    Member
    Join Date
    Jul 2016
    Location
    Iran
    Posts
    74
    I want to calculate the average price of each car based on its make year and to put it in the listing and tell the user that the price of this car is cheaper than the average of similar cars made in the same year or it's cheaper.
    So I want to calculate the average price of each car based on its make year. For example, the car1 that was built in 2016 and has 5 ads, its average price. Only the average car1, the year of construction of which is 2016, is not included in the formula if the year of construction of the car1, in 2017 or any year except 2016.
    Please see the attached image

    banban.jpg
    Last edited by Mousa Lotfi; May 14, 2018 at 12:12 PM.
    Car sell in: BanBan.ir

  8. #8
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    so you need that the average price to be calculated based on the listings number with the same model and year ?
    and this average price to be displayed on each listing of the group ?

    if so, it can be done as a customization



    your attached image is broken

  9. #9
    Member
    Join Date
    Jul 2016
    Location
    Iran
    Posts
    74
    Exactly. Average prices for similar cars built each year (based on the price of car ads that users have entered)
    I want to insert a button "Price Analysis" in the box for each auto listing in listing page by clicking on it to show this message:
    The average price for this car in 2016 is $1,000, and therefore the car's price is Suitable (cheap)
    or
    The average price of this car with the year 2016 is $700, so the price of this car is Unsuitable (expensive)
    Last edited by Mousa Lotfi; May 14, 2018 at 12:40 PM. Reason: Completion
    Car sell in: BanBan.ir

  10. #10
    But prices for the same cars can be different. Many many criteria and conditions should be included for calculation final Average price.
    For example, 2 cars with the same model and same year can be with different transmissions: automatic and manual and price should be different also.
    That's why I don't know how do you want to calculate average price without formula. I know "Price Analysis" it will take all cars with the same model and year from your site and show users average price.
    Like: your car cheaper for 5% than other cars on this site. OR your car expensive for 9% than other cars on this site.
    Viktor,
    Flynax technical department,
    Best wishes.

+ Reply to Thread