Methods, Shipment and Payment

Written by Max Milbers. Posted in Concepts


Methods are a general pattern to use a plugin with different configurations. So you can use a plugin multiple times with different settings.

Methods can generally be restricted by shoppergroups and any plugin can add its own restrictions. The second tab shows the parameters of the the selected plugin. Any method belongs to a vendor and can be set to shared.

Customfields and userfield plugins are also a kind of methods.

Default Shipment plugin

The default shipment plugin has some features so that it is useable as generic method.

Categories and blocking categories are mainly used with control categories and enable or disable a shipment when a certain product is set in the cart.

The country and zip restriction are usefull to create different shipments for different areas. This can also be used smaller delivery services (Food delivery services).

The weight restriction is most used to reflect different prices by weight.

Any plugin can be configured by multiple methods, and different mods of the cart can directly set the correct shipment or offer the choice for fitting shipments.

Notes to calculation of fees

Assume you need $100 and they want 5% as fee. Then you must actually borrow $105 and you have to pay fee for the $5 again => 100 +5 + 0.25 + 0.0125 + 0.00625 + 0.0003125 + ... = ~ 105,2690625....
We use a bit simplified formular and get 105.2631

It sounds first quite reasonable that a fee of 5% and a payment of 100 results in 105. But the The fee is not just x + % of x. Because x + % of x does not consider that the amount to pay increased by 5 and that you have to pay for this 5 again a fee of 5%. The calculation looks like this then => 100 +5 + 0.25 + 0.0125 + 0.000625 + 0.00003125 + ... = ~ 105,26315625.....

This is a geometric progression We use the direct formula

$cartTotalAmount = ($cartTotalAmountOrig + $method->cost_per_transaction) / (1 -($method->cost_percent_total * 0.01));

and get (100 + 0.0) / (1 - (5 * 0.01)) = 105.263157894737