本文整理汇总了PHP中vmPSPlugin::setCartPrices方法的典型用法代码示例。如果您正苦于以下问题:PHP vmPSPlugin::setCartPrices方法的具体用法?PHP vmPSPlugin::setCartPrices怎么用?PHP vmPSPlugin::setCartPrices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vmPSPlugin
的用法示例。
在下文中一共展示了vmPSPlugin::setCartPrices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCartPrices
function setCartPrices(VirtueMartCart $cart, &$cart_prices, $method, $progressive = true)
{
if ($method->modo_calculo_desconto == '2') {
return parent::setCartPrices($cart, $cart_prices, $method, false);
} else {
return parent::setCartPrices($cart, $cart_prices, $method, true);
}
}
示例2: setCartPrices
function setCartPrices(VirtueMartCart $cart, &$cart_prices, $method)
{
if ($method->modo_calculo_desconto == '2') {
return parent::setCartPrices($cart, $cart_prices, $method);
} else {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
$_psType = ucfirst($this->_psType);
$calculator = calculationHelper::getInstance();
$cart_prices[$this->_psType . 'Value'] = $calculator->roundInternal($this->getCosts($cart, $method, $cart_prices), 'salesPrice');
/*
if($this->_psType=='payment'){
$cartTotalAmountOrig=$this->getCartAmount($cart_prices);
$cartTotalAmount=($cartTotalAmountOrig + $method->cost_per_transaction) / (1 -($method->cost_percent_total * 0.01));
$cart_prices[$this->_psType . 'Value'] = $cartTotalAmount - $cartTotalAmountOrig;
}
*/
$taxrules = array();
if (isset($method->tax_id) and (int) $method->tax_id === -1) {
} else {
if (!empty($method->tax_id)) {
$cart_prices[$this->_psType . '_calc_id'] = $method->tax_id;
$db = JFactory::getDBO();
$q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $method->tax_id . '" ';
$db->setQuery($q);
$taxrules = $db->loadAssocList();
if (!empty($taxrules)) {
foreach ($taxrules as &$rule) {
if (!isset($rule['subTotal'])) {
$rule['subTotal'] = 0;
}
if (!isset($rule['taxAmount'])) {
$rule['taxAmount'] = 0;
}
$rule['subTotalOld'] = $rule['subTotal'];
$rule['taxAmountOld'] = $rule['taxAmount'];
$rule['taxAmount'] = 0;
$rule['subTotal'] = $cart_prices[$this->_psType . 'Value'];
}
}
} else {
$taxrules = array_merge($calculator->_cartData['VatTax'], $calculator->_cartData['taxRulesBill']);
if (!empty($taxrules)) {
$denominator = 0.0;
foreach ($taxrules as &$rule) {
//$rule['numerator'] = $rule['calc_value']/100.0 * $rule['subTotal'];
if (!isset($rule['subTotal'])) {
$rule['subTotal'] = 0;
}
if (!isset($rule['taxAmount'])) {
$rule['taxAmount'] = 0;
}
$denominator += $rule['subTotal'] - $rule['taxAmount'];
$rule['subTotalOld'] = $rule['subTotal'];
$rule['subTotal'] = 0;
$rule['taxAmountOld'] = $rule['taxAmount'];
$rule['taxAmount'] = 0;
//$rule['subTotal'] = $cart_prices[$this->_psType . 'Value'];
}
if (empty($denominator)) {
$denominator = 1;
}
foreach ($taxrules as &$rule) {
$frac = ($rule['subTotalOld'] - $rule['taxAmountOld']) / $denominator;
$rule['subTotal'] = $cart_prices[$this->_psType . 'Value'] * $frac;
vmdebug('Part $denominator ' . $denominator . ' $frac ' . $frac, $rule['subTotal']);
}
}
}
}
if (empty($method->cost_per_transaction)) {
$method->cost_per_transaction = 0.0;
}
if (empty($method->cost_percent_total)) {
$method->cost_percent_total = 0.0;
}
if (count($taxrules) > 0) {
$cart_prices['salesPrice' . $_psType] = $calculator->roundInternal($calculator->executeCalculation($taxrules, $cart_prices[$this->_psType . 'Value'], true, false), 'salesPrice');
//vmdebug('I am in '.get_class($this).' and have this rules now',$taxrules,$cart_prices[$this->_psType . 'Value'],$cart_prices['salesPrice' . $_psType]);
$cart_prices[$this->_psType . 'Tax'] = $calculator->roundInternal($cart_prices['salesPrice' . $_psType] - $cart_prices[$this->_psType . 'Value'], 'salesPrice');
reset($taxrules);
$taxrule = current($taxrules);
$cart_prices[$this->_psType . '_calc_id'] = $taxrule['virtuemart_calc_id'];
foreach ($taxrules as &$rule) {
if (isset($rule['subTotalOld'])) {
$rule['subTotal'] += $rule['subTotalOld'];
}
if (isset($rule['taxAmountOld'])) {
$rule['taxAmount'] += $rule['taxAmountOld'];
}
}
} else {
$cart_prices['salesPrice' . $_psType] = $cart_prices[$this->_psType . 'Value'];
$cart_prices[$this->_psType . 'Tax'] = 0;
$cart_prices[$this->_psType . '_calc_id'] = 0;
}
return $cart_prices['salesPrice' . $_psType];
}
}