Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP Help needed


milfy

Recommended Posts

Posted

Can anyone help with their knowledge of php scripting, i am trying to adjust a contrib to suit, it goes like this

 

$table_cost = split(":" , MODULE_SHIPPING_TABLE_COST);

$shipping = 0;

  $baseSO = $table_cost[0];

$incrSO = $table_cost[1];

$costincSO = $table_cost[2];

$shipping = $baseSO + ($order_total * ($costincSO / $incrSO)- ($costincSO / $incrSO));

 

E.g.Base cost for first kg = $5.00,

Weight increment = 1kg (normally easier to work it out per kg, but the formula calculates it down via a divide to a cost per 1 unit)

Cost per increment = $1.5

Enter the values in table as [baseprice]:[weightincrement]:[costforincrement] e.g 5.00:1.00:1.50

 

Now this works fine for calculating the shipping costs, but my problem is it works in as much that $5.00 is equal to 1kg, but i want it to be $5.00 is equal to 20kg....

 

....so is there a way of adding into this calculation a string so i can add a value like $baseweight is equal to 20 or even doing 2 calculations, the first would be set to use like a standard table eg: 20:5.00 with a stop at 20 then a second calculation to work out the the increments from 21kg eg: 1.00:1.50

 

I really need some help on this...so has anyone got any spare time to give me any suggestions please.

Posted

Is this remotely possible or not?

A simple yes or no would be nice :blink:

 

Yup the pinch test worked :lol:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...