Bienvenido, Invitado
Recordarme

TEMA:

Dynamic Pricing 9 meses 2 semanas antes #243684

  • Autor del tema
  • debraj_saha
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 23
  • Gracias recibidas: 0
Hi..

I have a form based product where in based on the amount of Project, the pricing would take place. Also, there are 2 groups of pricing. Group A & Group B.

I have attached the Pricing range for both A & B. (Both these A & B is being used as checkboxgroup)
Please help in devising the pricing as per the attached file for both A&B.

Adjuntos:

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Dynamic Pricing 9 meses 2 semanas antes #243688

  • Autor del tema
  • debraj_saha
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 23
  • Gracias recibidas: 0
I am using the below code in pricePlugin. The pricing strategy is for the field &loan_amount.

$loan_amount = 0;
switch ($loan_amount){
case($loan_amount<=999999):
$price=3799;
break;
case($loan_amount>1000000 && $loan_amount<= 2499999):
$price = 4999;
break;
case ( $loan_amount > 2500000 && $loan_amount <= 4999999):
$price = 6999;
break;
case ( $loan_amount > 5000000 && $loan_amount <= 9999999):
$price = 9499;
break;
case ( $loan_amount > 10000000 && $loan_amount <= 49999999):
$price = 13569;
break;
case ( $loan_amount > 50000000 && $loan_amount <= 999999999):
$price = 19999;
break;
default:
break;
}

If I am putting loan_amount as say 3000000, the $price should be 6999. But I am getting 4999. Please advise where I am making wrong.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Dynamic Pricing 9 meses 1 semana antes #243702

  • Avatar de TheMuffinMan
  • TheMuffinMan
  • Fuera de línea
  • Developer
  • Developer
  • Mensajes: 10064
  • Karma: 167
  • Gracias recibidas: 808
Hi,

I am not really fond of using switch with calculations but first thing I would try is making sure the values are comparable as numbers.

Can you please wrap every amount using floatval(), like this:
case ( floatval($loan_amount) > 2500000 && floatval($loan_amount) <= 4999999):

and so on...

Also make sure that the number format of $loan_format is actually valid for math operations.
It shouldn't include commas and decimal point should be an actual point (if any).

Regards,
Markus
El siguiente usuario dijo gracias: debraj_saha

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Dynamic Pricing 9 meses 1 semana antes #243708

  • Autor del tema
  • debraj_saha
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 23
  • Gracias recibidas: 0
Hi markus..

Presently, I am able to get the $price as per the column A. Now if I want to change for B, is it possible to get the value in B as B: 1.30 * $price
i.e 30% increase over and above group A.
Please advise.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Dynamic Pricing 9 meses 1 semana antes #243716

  • Avatar de TheMuffinMan
  • TheMuffinMan
  • Fuera de línea
  • Developer
  • Developer
  • Mensajes: 10064
  • Karma: 167
  • Gracias recibidas: 808
Hi,

yes, you can access all elements within a rule using the $fields variable.

Being used like
$fields->FIELDNAME->value

You can also have a look what $fields contains by executing this in your rule
print_r($fields);
exit;

Then add something to the cart and checkout and you should see a white page with everything that is contained and you might find useful.

Regards,
Markus

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
Tiempo de carga de la página: 0.143 segundos