|
| setVendorCurrency ($id) |
|
| setVendorId ($id) |
|
| getCartPrices () |
|
| setCartPrices ($cartPrices) |
|
| setCartPricesMerge ($cartPrices) |
|
| getCartData () |
|
| getProductPrices (&$product, $variant=0.0, $amount=0) |
|
| calculateCostprice ($productId, $data) |
|
| setRevert ($revert) |
|
| fillVoidPrices (&$prices) |
|
| getCheckoutPrices (&$cart) |
|
| cartRuleCalculation ($rules, $baseprice, $TaxID=0, $DBTax=false) |
|
| executeCalculation ($rules, $baseprice, $relateToBaseAmount=false, $setCartPrices=true) |
|
| gatherEffectingRulesForProductPrice ($entrypoint, $id) |
|
| gatherEffectingRulesForBill ($entrypoint, $cartVendorId=1) |
|
| calculateDisplayedPlugins ($type) |
|
| calculateShipmentPrice () |
|
| calculatePaymentPrice () |
|
| calculateCustomPriceWithTax ($price) |
|
| writeRulePartEffectingQuery ($data, $field, $setAnd=0) |
|
| interpreteMathOp ($rule, $price) |
|
| roundInternal ($value, $name=0) |
|
| testRulePartEffecting ($rule, $data) |
|
| record_sort ($records, $field, $reverse=false) |
|
calculationHelper::__construct |
( |
| ) |
|
|
private |
Constructor,... sets the actual date and current currency
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
-
Geraint
calculationHelper::calculateCostprice |
( |
|
$productId, |
|
|
|
$data |
|
) |
| |
calculationHelper::calculateCustomPriceWithTax |
( |
|
$price | ) |
|
calculationHelper::calculateDisplayedPlugins |
( |
|
$type | ) |
|
New idea, we load for the display all plugins
- Parameters
-
calculationHelper::calculatePaymentPrice |
( |
| ) |
|
Calculates the effecting Payment prices for the calculation
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
-
Valerie Isaksen
- Parameters
-
$code | The Id of the paymentmethod |
$value | amount of the money to transfere |
$value | $cartVendorId |
- Returns
- $paymentCosts The amount of money the customer has to pay. Calculated in shop currency
calculationHelper::calculateShipmentPrice |
( |
| ) |
|
Calculates the effecting Shipment prices for the calculation
- Copyright
- (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
-
Valerie Isaksen
- Parameters
-
$code | The Id of the coupon |
- Returns
- $rules ids of the coupons
calculationHelper::cartRuleCalculation |
( |
|
$rules, |
|
|
|
$baseprice, |
|
|
|
$TaxID = 0 , |
|
|
|
$DBTax = false |
|
) |
| |
Function to calculate discount/tax of cart rules.
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers, Maik Künnemann
- Returns
- int $price the discount/tax
calculationHelper::couponHandler |
( |
|
$_code | ) |
|
|
protected |
Get coupon details and calculate the value
- Author
- Oscar van Eijk
- Parameters
-
calculationHelper::executeCalculation |
( |
|
$rules, |
|
|
|
$baseprice, |
|
|
|
$relateToBaseAmount = false , |
|
|
|
$setCartPrices = true |
|
) |
| |
Function to execute the calculation of the gathered rules Ids.
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
- Parameters
-
$rules | The Ids of the products |
$price | The input price, if no rule is affecting, 0 gets returned |
- Returns
- int $price the endprice
calculationHelper::fillVoidPrices |
( |
& |
$prices | ) |
|
calculationHelper::gatherEffectingRulesForBill |
( |
|
$entrypoint, |
|
|
|
$cartVendorId = 1 |
|
) |
| |
Gathers the effecting rules for the calculation of the bill
- Copyright
- Copyright (c) 2009-2014 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
- Parameters
-
$entrypoint | |
$cartVendorId | |
- Returns
- $rules The rules that effects the Bill as Ids
calculationHelper::gatherEffectingRulesForProductPrice |
( |
|
$entrypoint, |
|
|
|
$id |
|
) |
| |
Gatheres the rules which affects the product.
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
- Parameters
-
$entrypoint | The entrypoint how it should behave. Valid values should be Profit (Commission is a profit rule that is shared, maybe we remove shared and make a new entrypoint called profit) DBTax (Discount for wares, coupons) Tax DATax (Discount on money) Duty |
- Returns
- $rules The rules that effects the product as Ids
calculationHelper::getCalcRuleData |
( |
|
$calcRuleID | ) |
|
|
protected |
Get the data of the CalcRule ID if it is not there
- Author
- Maik Kuennemann
- Parameters
-
$VatTaxID | ID of the taxe rule |
calculationHelper::getCartData |
( |
| ) |
|
calculationHelper::getCartPrices |
( |
| ) |
|
calculationHelper::getCheckoutPrices |
( |
& |
$cart | ) |
|
function to start the calculation, here it is for the invoice in the checkout This function is partly implemented !
The function calls getProductPrices for every product except it is already known (maybe changed and adjusted with product amount value The single prices gets added in an array and already summed up.
Then simular to getProductPrices first the effecting rules are determined and calculated. Ah function to determine the coupon that effects the calculation is already implemented. But not completly in the calculation.
Subtotal + Tax + Discount = Total
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
- Parameters
-
int | $productIds | The Ids of the products |
int | $cartVendorId | The Owner of the cart, this can be ignored in vm1.5 |
- Returns
- int $prices An array of the prices 'resultWithOutTax' The summed up baseprice of all products 'resultWithTax' The final price of all products with their tax, discount and so on 'discountBeforeTax' discounted price without tax which affects only the checkout (the tax of the products is in it) 'discountWithTax' discounted price taxed 'discountAfterTax' final result
static calculationHelper::getInstance |
( |
| ) |
|
|
static |
calculationHelper::getProductPrices |
( |
& |
$product, |
|
|
|
$variant = 0.0 , |
|
|
|
$amount = 0 |
|
) |
| |
function to start the calculation, here it is for the product
The function first gathers the information of the product (maybe better done with using the model) After that the function gatherEffectingRulesForProductPrice writes the queries and gets the ids of the rules which affect the product The function executeCalculation makes the actual calculation according to the rules
- Copyright
- Copyright (c) 2009 - 2015 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
- Parameters
-
int | $product | The product |
int | $catIds | When the category is already determined, then it makes sense to pass it, if not the function does it for you |
- Returns
- int $prices An array of the prices 'basePrice' basePrice calculated in the shopcurrency 'basePriceWithTax' basePrice with Tax 'discountedPrice' before Tax 'priceWithoutTax' price Without Tax but with calculated discounts AFTER Tax. So it just shows how much the shopper saves, regardless which kind of tax 'discountAmount' the "you save X money" 'salesPrice' The final price, with all kind of discounts and Tax, except stuff that is only in the checkout
calculationHelper::interpreteMathOp |
( |
|
$rule, |
|
|
|
$price |
|
) |
| |
This functions interprets the String that is entered in the calc_value_mathop field The first char is the signum of the function. The more this function can be enhanced maybe with function that works like operators, the easier it will be to make more complex disount/commission/profit formulas progressive, nonprogressive and so on.
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
- Parameters
-
$mathop | String reprasentation of the mathematical operation, valid ('+','-','+','-') |
$value | float The value that affects the price |
$currency | int the currency which should be used |
$price | float The price to calculate |
calculationHelper::record_sort |
( |
|
$records, |
|
|
|
$field, |
|
|
|
$reverse = false |
|
) |
| |
Sorts indexed 2D array by a specified sub array key
Copyright richard at happymango dot me dot uk
- Author
- Max Milbers
calculationHelper::roundInternal |
( |
|
$value, |
|
|
|
$name = 0 |
|
) |
| |
Standard round function, we round every number with 6 fractionnumbers We need at least 4 to calculate something like 9.25% => 0.0925 2 digits Should be setable via config (just for the crazy case)
calculationHelper::setCartPrices |
( |
|
$cartPrices | ) |
|
calculationHelper::setCartPricesMerge |
( |
|
$cartPrices | ) |
|
calculationHelper::setCountryState |
( |
| ) |
|
|
protected |
calculationHelper::setRevert |
( |
|
$revert | ) |
|
calculationHelper::setShopperGroupIds |
( |
|
$shopperGroupIds = 0 , |
|
|
|
$vendorId = 1 |
|
) |
| |
|
protected |
calculationHelper::setVendorCurrency |
( |
|
$id | ) |
|
calculationHelper::setVendorId |
( |
|
$id | ) |
|
calculationHelper::testRulePartEffecting |
( |
|
$rule, |
|
|
|
$data |
|
) |
| |
Can test the tablefields Category, Country, State If the the data is 0 false is returned
calculationHelper::writeRulePartEffectingQuery |
( |
|
$data, |
|
|
|
$field, |
|
|
|
$setAnd = 0 |
|
) |
| |
This function just writes the query for gatherEffectingRulesForProductPrice When a condition is not set, it is handled like a set condition that affects it. So the users have only to add a value for the conditions they want to (You dont need to enter a start or end date when the rule should count everytime).
- Copyright
- Copyright (c) 2009 VirtueMart Team. All rights reserved.
- Author
- Max Milbers
- Parameters
-
$data | the ids of the rule, for exampel the ids of the categories that affect the rule |
$field | the name of the field in the db, for exampel calc_categories to write a rule that asks for the field calc_categories |
- Returns
- $q The query
calculationHelper::$_amount = 1 |
calculationHelper::$_amountCart = 0.0 |
calculationHelper::$_cart = null |
calculationHelper::$_cats |
calculationHelper::$_currencyDisplay |
calculationHelper::$_debug |
|
protected |
calculationHelper::$_deliveryCountry |
calculationHelper::$_deliveryState |
calculationHelper::$_instance |
|
static |
calculationHelper::$_internalDigits = 9 |
|
protected |
calculationHelper::$_manufacturerId |
|
protected |
calculationHelper::$_nullDate |
|
protected |
calculationHelper::$_revert = false |
|
protected |
calculationHelper::$_shopperGroupId |
|
protected |
calculationHelper::$allrules = array() |
calculationHelper::$checkAutomaticSelected = false |
|
private |
calculationHelper::$exchangeRateShopper = 0 |
|
protected |
calculationHelper::$exchangeRateVendor = 0 |
|
protected |
calculationHelper::$inCart = FALSE |
calculationHelper::$product_discount_id = 0 |
calculationHelper::$product_marge_id = 0 |
calculationHelper::$product_tax_id = 0 |
calculationHelper::$productCurrency |
calculationHelper::$productPrices |
calculationHelper::$productVendorId |
calculationHelper::$vendorCurrency = 0 |
The documentation for this class was generated from the following file: