*

mwindey

  • *****
  • 420 posts
How to change formula?
« on: September 13, 2022, 04:02:49 PM »
First time i am trying to setup the plugin since i have it so forgive me if this is asked before.
In settings i can set default fee per 24 hours and it calculates using a formula. If i set 2 euro per 24 hours it sets 5.29 euro for 1 week.
Is there a way to set formula to count the same price per 24 hours so 1 week will be 14 euro, 2 weeks 28 euro ...instead of 5.29?
Thanks


« Last Edit: September 13, 2022, 04:32:46 PM by mwindey »

*

MB Themes

Re: How to change formula?
« Reply #1 on: September 13, 2022, 04:44:17 PM »
Click on box and edit price  :)
Editing parent will update children as well.
Formula is somewhere in functions.php, just default values here
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 420 posts
Re: How to change formula?
« Reply #2 on: September 13, 2022, 05:00:20 PM »
@MB Themes

if i set 24 hours to 1 euro my expectation is that it multiplies the amount 7 times  if i set it to 1 day and 1 week but that's not the case....
Like i said it's only the first day i am playing with this but i have to since sms payments is not supported anymore with fortumo/boku
« Last Edit: September 13, 2022, 05:04:04 PM by mwindey »

*

MB Themes

Re: How to change formula?
« Reply #3 on: September 13, 2022, 05:40:33 PM »
Such formula would not make sense. You want users to pay more than they originslly wanted  ;D
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Tango

  • ****
  • 212 posts
Re: How to change formula?
« Reply #4 on: September 13, 2022, 05:45:35 PM »
@MB Themes
I can confirm the issue.
If you set the price for 1 day to $2, then for 1 week the total is $5.29.
In this case, the correct multiplier would be $2*7= $14

What's the logic behind this? Discount for longer duration?

If so, then it would be nice for us to be able to set the discount based on a percentage setting.
For me, the way it is right now is a bit too much.
1 day - $10
1 week - $26.46
It's like you're ripping yourself off! :))
« Last Edit: September 13, 2022, 05:58:38 PM by Tango »

*

mwindey

  • *****
  • 420 posts
Re: How to change formula?
« Reply #5 on: September 13, 2022, 06:24:20 PM »
@MB Themes

It's not about ripping of someone it is only correct that if you have to pay €2 every 24 hours that the logic would be they have to pay 7 times the same amount every 24 hours so one week would be €14.
In situation it is now who's ripping who?  ;D

Thanks @Tango to confirm the issue  ;)
« Last Edit: September 13, 2022, 06:26:36 PM by mwindey »

*

Tango

  • ****
  • 212 posts
Re: How to change formula?
« Reply #6 on: September 13, 2022, 06:46:33 PM »
It's a bit like you're ripping yourself off, as the discount for 7 days vs 1 day is huge!
If you set 1 day to $10, then for 1 week it's $26.46  :o
You, as the site owner, are at a loss.

I understand to do a bit of upselling, and make the customer spend more money, but not with 62% discount :))

I would say a 15-20% discount would be okish, but still the best way would be for us to be able to set the upsell discount amount in the settings.
« Last Edit: September 14, 2022, 08:20:25 AM by Tango »

*

mwindey

  • *****
  • 420 posts
Re: How to change formula?
« Reply #7 on: September 14, 2022, 10:52:57 AM »
Correct! It would be nice to have the option for a discount in settings but i understand that maybe this is to difficult to create short term.
If it's working the correct way so €2/24h would become €14/1week then it would be nice for now  :D :)

*

mwindey

  • *****
  • 420 posts
Re: How to change formula?
« Reply #8 on: September 14, 2022, 02:56:11 PM »
I think it is solved but needs some testing. In functions.php from plugin starting in line 2064
Code: [Select]
// HOURS UPLIFT FOR CALCULATION OF DEFAULT 24H FEE TO DIFFERENT HOURS
function osp_hours_uplift($fee, $hours = NULL) {
  $price = $fee;

  if($hours <> '' && $hours > 0) {
    $days = $hours / 24;

    if($days < 1) {
      $price = $fee * pow($days, 1/4);
    } else if($days > 1) {
      $price = $fee * pow($days, 1/2);
    } else {
      $price = $fee;
    }
  }

  return $price;
}
Change 1/4 and 1/2 to 1 delete the delimiter and it seems like that is solving the problem...
Code: [Select]
// HOURS UPLIFT FOR CALCULATION OF DEFAULT 24H FEE TO DIFFERENT HOURS
function osp_hours_uplift($fee, $hours = NULL) {
  $price = $fee;

  if($hours <> '' && $hours > 0) {
    $days = $hours / 24;

    if($days < 1) {
      $price = $fee * pow($days, 1);
    } else if($days > 1) {
      $price = $fee * pow($days, 1);
    } else {
      $price = $fee;
    }
  }

  return $price;
}

Discount ( Full price per 6hrs / 12hrs/ ... ) can be set in plugin itself per category and per period.
If you don't want a discount it counts the normal fee per day...

To be continued :-)
« Last Edit: September 14, 2022, 03:58:11 PM by mwindey »