当前位置: 首页>>代码示例>>PHP>>正文


PHP calculationHelper::getInstance方法代码示例

本文整理汇总了PHP中calculationHelper::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP calculationHelper::getInstance方法的具体用法?PHP calculationHelper::getInstance怎么用?PHP calculationHelper::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在calculationHelper的用法示例。


在下文中一共展示了calculationHelper::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPrices

 public function getPrices()
 {
     $tmpcart = $this->cart;
     foreach ($tmpcart->products as $key1 => $product) {
         foreach ($product->allPrices as $key2 => $pricearr) {
             $tmpcart->products[$key1]->allPrices[$key2]['product_tax_id'] = "";
         }
     }
     if (!class_exists('calculationHelper')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $calculator->getCheckoutPrices($tmpcart, true);
     $price = $this->cart->pricesUnformatted;
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
     $cdisp = CurrencyDisplay::getInstance();
     //echo json_encode($this->cart);exit;
     foreach ($price as $id => $value) {
         if (!is_array($value)) {
             continue;
         }
         $nprice["products"][$id]["subtotal_tax_amount"] = !empty($price[$id]["taxAmount"]) ? $cdisp->priceDisplay($price[$id]["taxAmount"]) : "";
         $nprice["products"][$id]["subtotal_discount"] = !empty($price[$id]["subtotal_discount"]) ? $cdisp->priceDisplay($price[$id]["discountAmount"]) : "";
         if (VmConfig::get('checkout_show_origprice', 1) && !empty($this->cart->pricesUnformatted[$id]['basePriceWithTax']) && $this->cart->pricesUnformatted[$id]['basePriceWithTax'] != $this->cart->pricesUnformatted[$id]['salesPrice']) {
             $nprice["products"][$id]["subtotal_with_tax"] = '<span class="line-through">' . $cdisp->createPriceDiv('basePriceWithTax', '', $this->cart->pricesUnformatted[$id], true, false, $this->cart->products[$id]->quantity) . '</span><br />';
         }
         $nprice["products"][$id]["subtotal_with_tax"] .= $cdisp->createPriceDiv('salesPrice', '', $this->cart->pricesUnformatted[$id], false, false, $this->cart->products[$id]->quantity);
     }
     $nprice["taxAmount"] = !empty($this->cart->pricesUnformatted["taxAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["taxAmount"]) : "";
     $nprice["discountAmount"] = !empty($this->cart->pricesUnformatted["discountAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["discountAmount"]) : "";
     $nprice["salesPrice"] = !empty($this->cart->pricesUnformatted["salesPrice"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["salesPrice"]) : "";
     $nprice["shipmentTax"] = !empty($this->cart->pricesUnformatted["shipmentTax"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["shipmentTax"]) : "";
     $nprice["salesPriceShipment"] = !empty($this->cart->pricesUnformatted["salesPriceShipment"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["salesPriceShipment"]) : "";
     $nprice["paymentTax"] = !empty($this->cart->pricesUnformatted["paymentTax"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["paymentTax"]) : "";
     $nprice["salesPricePayment"] = !empty($this->cart->pricesUnformatted["salesPricePayment"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["salesPricePayment"]) : "";
     $nprice["billTaxAmount"] = !empty($this->cart->pricesUnformatted["billTaxAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["billTaxAmount"]) : "";
     $nprice["billDiscountAmount"] = !empty($this->cart->pricesUnformatted["billDiscountAmount"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["billDiscountAmount"]) : "";
     $nprice["billTotal"] = !empty($this->cart->pricesUnformatted["billTotal"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["billTotal"]) : "";
     $nprice["couponTax"] = !empty($this->cart->pricesUnformatted["couponTax"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["couponTax"]) : "";
     $nprice["salesPriceCoupon"] = !empty($this->cart->pricesUnformatted["salesPriceCoupon"]) ? $cdisp->priceDisplay($this->cart->pricesUnformatted["salesPriceCoupon"]) : "";
     //print_r($this->cart);
     $nprice["couponCode"] = !empty($this->cart->couponCode) ? $this->cart->couponCode : "";
     $nprice["couponCode"] = empty($nprice["couponCode"]) && !empty($this->cart->cartData["couponCode"]) ? $this->cart->cartData["couponCode"] : $nprice["couponCode"];
     $nprice["couponDescr"] = !empty($this->cart->cartData["couponDescr"]) ? $this->cart->cartData["couponDescr"] : "";
     $nprice["billTotalunformat"] = $this->cart->pricesUnformatted["billTotal"];
     /*$nprice["taxAmount"]=!empty($price["taxAmount"])?$cdisp->priceDisplay($price["taxAmount"]):"";
     		$nprice["discountAmount"]=!empty($price["discountAmount"])?$cdisp->priceDisplay($price["discountAmount"]):"";
     		$nprice["salesPrice"]=!empty($price["salesPrice"])?$cdisp->priceDisplay($price["salesPrice"]):"";
     		$nprice["shipmentTax"]=!empty($price["shipmentTax"])?$cdisp->priceDisplay($price["shipmentTax"]):"";
     		$nprice["salesPriceShipment"]=!empty($price["salesPriceShipment"])?$cdisp->priceDisplay($price["salesPriceShipment"]):"";
     		$nprice["paymentTax"]=!empty($price["paymentTax"])?$cdisp->priceDisplay($price["paymentTax"]):"";
     		$nprice["salesPricePayment"]=!empty($price["salesPricePayment"])?$cdisp->priceDisplay($price["salesPricePayment"]):"";
     		$nprice["billTaxAmount"]=!empty($price["billTaxAmount"])?$cdisp->priceDisplay($price["billTaxAmount"]):"";
     		$nprice["billDiscountAmount"]=!empty($price["billDiscountAmount"])?$cdisp->priceDisplay($price["billDiscountAmount"]):"";	
     		$nprice["billTotal"]=!empty($price["billTotal"])?$cdisp->priceDisplay($price["billTotal"]):"";*/
     //echo "<pre>";print_r($nprice);exit;
     return $nprice;
 }
开发者ID:bram96,项目名称:vmonepage,代码行数:58,代码来源:helper.php

示例2: getList

 public static function getList($params)
 {
     if (class_exists('VirtueMartCart')) {
         $productModel = VmModel::getModel('product');
         $calculator = calculationHelper::getInstance();
         $customfields = VmModel::getModel('Customfields');
         $cart = VirtueMartCart::getCart(false);
         $cart->pricesUnformatted = $calculator->getCheckoutPrices($cart, true);
         $viewName = vRequest::getString('view', 0);
         if ($viewName == 'cart') {
             $checkAutomaticPS = true;
         } else {
             $checkAutomaticPS = false;
         }
         $cart->prepareAjaxData($checkAutomaticPS);
         $productModel->addImages($cart->products);
         ini_set('xdebug.var_display_max_depth', 10);
         return $cart;
     }
 }
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:20,代码来源:helper.php

示例3: getPrice

 public function getPrice($product, $customVariant, $quantity)
 {
     $this->_db = JFactory::getDBO();
     // 		vmdebug('strange',$product);
     // Loads the product price details
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . '/helpers/calculationh.php';
     }
     $model = new VirtueMartModelProduct();
     $model->getRawProductPrices($product, 1, array(), true);
     $calculator = calculationHelper::getInstance();
     // Calculate the modificator
     $prices = $calculator->getProductPrices($product);
     $currency = CurrencyDisplay::getInstance();
     $oldPrice = 'basePrice';
     if ($prices['taxAmount']) {
         $oldPrice = 'basePriceWithTax';
     }
     $product->old_price = $currency->createPriceDiv($oldPrice, '', $prices, true, true);
     $product->sales_price = $currency->createPriceDiv('salesPrice', '', $prices, true, true);
     return $product;
 }
开发者ID:thumbs-up-sign,项目名称:TuVanDuAn,代码行数:22,代码来源:virtuemart.php

示例4: setCartPrices

 function setCartPrices(VirtueMartCart $cart, &$cart_prices, $method)
 {
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $_psType = ucfirst($this->_psType);
     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();
         } else {
             //This construction makes trouble, if there are products with different vats in the cart
             //on the other side, it is very unlikely to have different vats in the cart and simultaneous it is not possible to use a fixed tax rule for the shipment
             if (!empty($calculator->_cartData['VatTax']) and count($calculator->_cartData['VatTax']) == 1) {
                 $taxrules = $calculator->_cartData['VatTax'];
                 foreach ($taxrules as &$rule) {
                     $rule['subTotal'] = $cart_prices[$this->_psType . 'Value'];
                 }
             } else {
                 $taxrules = $calculator->_cartData['taxRulesBill'];
                 foreach ($taxrules as &$rule) {
                     unset($rule['subTotal']);
                 }
             }
         }
     }
     $cartTotalAmount = $cart_prices['salesPrice'] + $cart_prices['salesPriceShipment'] - $cart_prices['salesPriceCoupon'];
     if (isset($method->cost_percent_total)) {
         if (preg_match('/%$/', $method->cost_percent_total)) {
             $cost_percent_total = substr($method->cost_percent_total, 0, -1) * 0.01;
         } else {
             $cost_percent_total = $method->cost_percent_total * 0.01;
         }
     } else {
         $cost_percent_total = 0;
     }
     if (isset($method->cost_per_transaction)) {
         $cost_per_transaction = $method->cost_per_transaction;
     } else {
         $cost_per_transaction = 0;
     }
     if (count($taxrules) > 0) {
         $cost_percent_total_vat = $calculator->executeCalculation($taxrules, $cost_percent_total, true);
         $cost_per_transaction_vat = $calculator->executeCalculation($taxrules, $cost_per_transaction, true);
         $NewTotalAmount = ($cartTotalAmount + $cost_per_transaction_vat) / (1 - $cost_percent_total_vat);
         $feeWithVat = $NewTotalAmount - $cartTotalAmount;
         $calculator->setRevert(true);
         $feeNoVat = $calculator->roundInternal($calculator->executeCalculation($taxrules, $feeWithVat, true), 'salesPrice');
         $calculator->setRevert(false);
         $cart_prices[$this->_psType . 'Tax'] = $feeWithVat - $feeNoVat;
         $cart_prices['salesPrice' . $_psType] = $feeWithVat;
         $cart_prices[$_psType . 'Value'] = $feeNoVat;
         reset($taxrules);
         $taxrule = current($taxrules);
         $cart_prices[$this->_psType . '_calc_id'] = $taxrule['virtuemart_calc_id'];
     } else {
         $NewTotalAmount = ($cartTotalAmount + $method->cost_per_transaction) / (1 - $cost_percent_total);
         $fee = $NewTotalAmount - $cartTotalAmount;
         $cart_prices['salesPrice' . $_psType] = $fee;
         $cart_prices[$this->_psType . 'Tax'] = 0;
         $cart_prices[$this->_psType . '_calc_id'] = 0;
     }
     return $cart_prices['salesPrice' . $_psType];
 }
开发者ID:SeventF,项目名称:ikea.com,代码行数:72,代码来源:paypal.php

示例5: CustomsFieldCartDisplay

 /**
  *  TODO This is html and view stuff and MUST NOT be in the model, notice by Max
  * render custom fields display cart FE
  */
 public function CustomsFieldCartDisplay($priceKey, $product)
 {
     static $calculator;
     if (empty($calculator)) {
         JLoader::register('calculationHelper', JPATH_VM_ADMINISTRATOR . '/helpers/calculationh.php');
         $calculator = calculationHelper::getInstance();
     }
     vmdebug('CustomsFieldCartDisplay ', $priceKey);
     $variantmods = $calculator->parseModifier($priceKey);
     return self::customFieldDisplay($product, $variantmods, '<div class="vm-customfield-cart">', 'plgVmOnViewCart');
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:15,代码来源:customfields.php

示例6: getCartPrices

 public function getCartPrices($checkAutomaticSelected = true)
 {
     JLoader::register('calculationHelper', JPATH_VM_ADMINISTRATOR . '/helpers/calculationh.php');
     $calculator = calculationHelper::getInstance();
     $this->pricesUnformatted = $calculator->getCheckoutPrices($this, $checkAutomaticSelected);
     return $this->pricesUnformatted;
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:7,代码来源:cart.php

示例7: CustomsFieldCartDisplay

 /**
  *  TODO This is html and view stuff and MUST NOT be in the model, notice by Max
  * render custom fields display cart FE
  */
 public static function CustomsFieldCartDisplay($priceKey, $product)
 {
     if (empty($calculator)) {
         if (!class_exists('calculationHelper')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
         }
         $calculator = calculationHelper::getInstance();
     }
     $variantmods = $calculator->parseModifier($priceKey);
     return self::customFieldDisplay($product, $variantmods, '<div class="vm-customfield-cart">', 'plgVmOnViewCart');
 }
开发者ID:arkane0906,项目名称:lasercut-bootstrap,代码行数:15,代码来源:customfields.php

示例8: setCartPrices

 /**
  * update the plugin cart_prices
  *
  * @author Valérie Isaksen
  *
  * @param $cart_prices: $cart_prices['salesPricePayment'] and $cart_prices['paymentTax'] updated. Displayed in the cart.
  * @param $value :   fee
  * @param $tax_id :  tax id
  */
 function setCartPrices(VirtueMartCart $cart, &$cart_prices, $method, $progressive = true)
 {
     if (!class_exists('calculationHelper')) {
         require VMPATH_ADMIN . 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 (!isset($cart_prices[$this->_psType . 'Value'])) {
         $cart_prices[$this->_psType . 'Value'] = 0.0;
     }
     if (!isset($cart_prices[$this->_psType . 'Tax'])) {
         $cart_prices[$this->_psType . 'Tax'] = 0.0;
     }
     if ($this->_psType == 'payment') {
         $cartTotalAmountOrig = $this->getCartAmount($cart_prices);
         if (!$progressive) {
             //Simple
             $cartTotalAmount = ($cartTotalAmountOrig + $method->cost_per_transaction) * (1 + $method->cost_percent_total * 0.01);
             //vmdebug('Simple $cartTotalAmount = ('.$cartTotalAmountOrig.' + '.$method->cost_per_transaction.') * (1 + ('.$method->cost_percent_total.' * 0.01)) = '.$cartTotalAmount );
             //vmdebug('Simple $cartTotalAmount = '.($cartTotalAmountOrig + $method->cost_per_transaction).' * '. (1 + $method->cost_percent_total * 0.01) .' = '.$cartTotalAmount );
         } else {
             //progressive
             $cartTotalAmount = ($cartTotalAmountOrig + $method->cost_per_transaction) / (1 - $method->cost_percent_total * 0.01);
             //vmdebug('Progressive $cartTotalAmount = ('.$cartTotalAmountOrig.' + '.$method->cost_per_transaction.') / (1 - ('.$method->cost_percent_total.' * 0.01)) = '.$cartTotalAmount );
             //vmdebug('Progressive $cartTotalAmount = '.($cartTotalAmountOrig + $method->cost_per_transaction) .' / '. (1 - $method->cost_percent_total * 0.01) .' = '.$cartTotalAmount );
         }
         $cart_prices[$this->_psType . 'Value'] = $cartTotalAmount - $cartTotalAmountOrig;
     }
     if (!isset($cart_prices['salesPrice' . $_psType])) {
         $cart_prices['salesPrice' . $_psType] = $cart_prices[$this->_psType . 'Value'];
     }
     $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'];
                     $cart_prices[$this->_psType . 'TaxPerID'][$rule['virtuemart_calc_id']] = $calculator->roundInternal($calculator->roundInternal($calculator->interpreteMathOp($rule, $rule['subTotal'])) - $rule['subTotal'], 'salesPrice');
                     $cart_prices[$this->_psType . 'Tax'] += $cart_prices[$this->_psType . 'TaxPerID'][$rule['virtuemart_calc_id']];
                 }
             }
         } else {
             $taxrules = array_merge($cart->cartData['VatTax'], $cart->cartData['taxRulesBill']);
             if (!empty($taxrules)) {
                 $denominator = 0.0;
                 foreach ($taxrules as &$rule) {
                     //Quickn dirty
                     if (!isset($rule['calc_kind'])) {
                         $rule = (array) VmModel::getModel('calc')->getCalc($rule['virtuemart_calc_id']);
                     }
                     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;
                 }
                 if (empty($denominator)) {
                     $denominator = 1;
                 }
                 foreach ($taxrules as &$rule) {
                     $frac = ($rule['subTotalOld'] - $rule['taxAmountOld']) / $denominator;
                     $rule['subTotal'] = $cart_prices[$this->_psType . 'Value'] * $frac;
                     if (!isset($cart_prices[$this->_psType . 'Tax'])) {
                         $cart_prices[$this->_psType . 'Tax'] = 0.0;
                     }
                     $cart_prices[$this->_psType . 'TaxPerID'][$rule['virtuemart_calc_id']] = $calculator->roundInternal($calculator->roundInternal($calculator->interpreteMathOp($rule, $rule['subTotal'])) - $rule['subTotal'], 'salesPrice');
                     $cart_prices[$this->_psType . 'Tax'] += $cart_prices[$this->_psType . 'TaxPerID'][$rule['virtuemart_calc_id']];
                 }
             }
//.........这里部分代码省略.........
开发者ID:naka211,项目名称:studiekorrektur,代码行数:101,代码来源:vmpsplugin.php

示例9: _getProductPrice

 /**
  * Get product prices
  * 
  * @copyright 
  * @author 		RolandD
  * @todo 
  * @see 
  * @access 		public
  * @param		int	$product_id	the ID of the product 
  * @return 
  * @since 		4.0
  */
 private function _getProductPrice($product_id)
 {
     if (!isset($this->_prices[$product_id])) {
         // Define VM constant to make the classes work
         if (!defined('JPATH_VM_ADMINISTRATOR')) {
             define('JPATH_VM_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_virtuemart/');
         }
         // Load the configuration for the currency formatting
         require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php';
         // Include the calculation helper
         require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/calculationh.php';
         $calc = calculationHelper::getInstance();
         // Include the version class to compare
         require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/version.php';
         // Do a version check due to changed core code
         if (vmVersion::$RELEASE > '2.0.6') {
             require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/models/product.php';
             $product = $this->getInstance('Product', 'VirtueMartModel');
             $prices = $calc->getProductPrices($product->getProductSingle($product_id));
         } else {
             $prices = $calc->getProductPrices($product_id);
         }
         if (is_array($prices)) {
             $this->_prices[$product_id] = array_change_key_case($prices, CASE_LOWER);
         } else {
             $this->_prices[$product_id] = array();
         }
     }
     return $this->_prices[$product_id];
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:42,代码来源:productexport.php

示例10: display

 function display($tpl = null)
 {
     // Get the task
     $task = JRequest::getWord('task');
     // Load helpers
     $this->loadHelper('currencydisplay');
     $this->loadHelper('html');
     $this->loadHelper('image');
     //$category_model = VmModel::getModel('category');
     $model = VmModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             //this was in the controller for the edit tasks, I dont know if it is still needed,
             $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'product' . DS . 'tmpl');
             $virtuemart_product_id = JRequest::getVar('virtuemart_product_id', array());
             if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
                 $virtuemart_product_id = (int) $virtuemart_product_id[0];
             } else {
                 $virtuemart_product_id = (int) $virtuemart_product_id;
             }
             $product = $model->getProductSingle($virtuemart_product_id, false);
             $product_parent = $model->getProductParent($product->product_parent_id);
             $mf_model = VmModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown($product->virtuemart_manufacturer_id);
             $this->assignRef('manufacturers', $manufacturers);
             // Get the category tree
             if (isset($product->categories)) {
                 $category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $category_tree = ShopFunctions::categoryListTree();
             }
             $this->assignRef('category_tree', $category_tree);
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (isset($product->shoppergroups)) {
                 $shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups, true);
             }
             $this->assignRef('shoppergroupList', $shoppergroupList);
             // Load the product price
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
             $calculator = calculationHelper::getInstance();
             $product->prices = $calculator->getProductPrices($product);
             $product_childIds = $model->getProductChildIds($virtuemart_product_id);
             $product_childs = array();
             foreach ($product_childIds as $id) {
                 $product_childs[] = $model->getProductSingle($id, false);
             }
             $this->assignRef('product_childs', $product_childs);
             $DBTax = '';
             //JText::_('COM_VIRTUEMART_RULES_EFFECTING') ;
             foreach ($calculator->rules['DBTax'] as $rule) {
                 $DBTax .= $rule['calc_name'] . '<br />';
             }
             $this->assignRef('DBTaxRules', $DBTax);
             $tax = '';
             //JText::_('COM_VIRTUEMART_TAX_EFFECTING').'<br />';
             foreach ($calculator->rules['Tax'] as $rule) {
                 $tax .= $rule['calc_name'] . '<br />';
             }
             foreach ($calculator->rules['VatTax'] as $rule) {
                 $tax .= $rule['calc_name'] . '<br />';
             }
             $this->assignRef('taxRules', $tax);
             $DATax = '';
             //JText::_('COM_VIRTUEMART_RULES_EFFECTING');
             foreach ($calculator->rules['DATax'] as $rule) {
                 $DATax .= $rule['calc_name'] . '<br />';
             }
             $this->assignRef('DATaxRules', $DATax);
             // 				$this->assignRef('override', $calculator->override);
             // 				$this->assignRef('product_override_price', $calculator->product_override_price);
             if (!isset($product->product_tax_id)) {
                 $product->product_tax_id = 0;
             }
             $lists['taxrates'] = ShopFunctions::renderTaxList($product->product_tax_id, 'product_tax_id');
             if (!isset($product->product_discount_id)) {
                 $product->product_discount_id = 0;
             }
             $lists['discounts'] = $this->renderDiscountList($product->product_discount_id);
             if (!class_exists('VirtueMartModelConfig')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'config.php';
             }
             $productLayouts = VirtueMartModelConfig::getLayoutList('productdetails');
             $this->assignRef('productLayouts', $productLayouts);
             // Load Images
             $model->addImages($product);
             if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) {
                 $imagePath = VmConfig::get('vmtemplate') . '/images/availability/';
             } else {
                 $imagePath = '/components/com_virtuemart/assets/images/availability/';
             }
             $this->assignRef('imagePath', $imagePath);
             // Load the vendors
             $vendor_model = VmModel::getModel('vendor');
             // 				$vendors = $vendor_model->getVendors();
             // 				$lists['vendors'] = JHTML::_('select.genericlist', $vendors, 'virtuemart_vendor_id', '', 'virtuemart_vendor_id', 'vendor_name', $product->virtuemart_vendor_id);
             if (Vmconfig::get('multix', 'none') !== 'none') {
//.........这里部分代码省略.........
开发者ID:joselapria,项目名称:virtuemart,代码行数:101,代码来源:view.html.php

示例11: calculePrice

 /**
  * Calcule final price to product
  *
  * @param VirtueMartCart $cart
  * @param $key
  * @return float
  */
 private function calculePrice(VirtueMartCart $cart, $key)
 {
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'components' . DS . 'virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $cart_prices = $calculator->getCheckoutPrices($cart);
     $sales_price = $cart->products[$key]->product_price;
     foreach ($cart_prices as $prices_key => $prices) {
         if ($key === $prices_key) {
             $sales_price = $prices["salesPrice"];
         }
     }
     return $sales_price;
 }
开发者ID:saper,项目名称:organic-extensions,代码行数:22,代码来源:pagseguro.patch.php

示例12: getPrice

 /**
  * Gets the price for a variant
  *
  * @author Max Milbers
  */
 public function getPrice($product, $quantity)
 {
     $db = JFactory::getDBO();
     // 		vmdebug('strange',$product);
     if (!is_object($product)) {
         $product = $this->getProduct($product, TRUE, FALSE, TRUE, $quantity);
     }
     //if (empty($product->customfields) and !empty($product->virtuemart_customfield_id)) {
     if (empty($product->customfields)) {
         $customfieldsModel = VmModel::getModel('Customfields');
         $product->customfields = $customfieldsModel->getCustomEmbeddedProductCustomFields($product->allIds);
     }
     // Loads the product price details
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     // Calculate the modificator
     $customfieldsModel = VmModel::getModel('Customfields');
     $variantPriceModification = $customfieldsModel->calculateModificators($product);
     //$variantPriceModification = $calculator->calculateModificators ($product, $customVariant);
     $prices = $calculator->getProductPrices($product, $variantPriceModification, $quantity);
     return $prices;
 }
开发者ID:lenard112,项目名称:cms,代码行数:29,代码来源:product.php

示例13: plgVmConfirmedOrder

 function plgVmConfirmedOrder($cart, $order)
 {
     $avaTaxRule = 0;
     if (isset($order['calc_rules'])) {
         foreach ($order['calc_rules'] as $rule) {
             if ($rule->calc_mathop == 'avalara') {
                 $avaTaxRule = $rule;
                 break;
             }
         }
     }
     if ($avaTaxRule !== 0) {
         if (!empty($avaTaxRule->calc_params)) {
             VmTable::bindParameterable($avaTaxRule, $this->_xParams, $this->_varsToPushParam);
             vmdebug('$avaTaxRule', $avaTaxRule);
             if ($rule->activated == 0) {
                 return false;
             }
             if (empty($this->addresses)) {
                 $this->addresses = $this->fillValidateAvalaraAddress($rule);
             }
             if ($this->addresses) {
                 if (!class_exists('calculationHelper')) {
                     require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
                 }
                 vmdebug('$order', $order);
                 $orderModel = VmModel::getModel('orders');
                 $invoiceNumber = 'onr_' . $order['details']['BT']->order_number;
                 $orderModel->createInvoiceNumber($order['details']['BT'], $invoiceNumber);
                 $calculator = calculationHelper::getInstance();
                 $tax = $this->getTax($calculator, $rule, 0, $invoiceNumber);
                 //	vmdebug('tax',$tax);
             }
         }
     }
     /*	VmTable::bindParameterable ($rule, $this->_xParams, $this->_varsToPushParam);
     		if($rule->activated==0) return $price;
     		if(empty($this->addresses)){
     			$this->addresses = $this->fillValidateAvalaraAddress($rule);
     		}
     		if($this->addresses){
     			$tax = $this->getTax( $calculationHelper,$rule,$price,true);
     		}*/
 }
开发者ID:romuland,项目名称:khparts,代码行数:44,代码来源:avalara.php

示例14: getInvoiceFeeInclTax

 public static function getInvoiceFeeInclTax($method, $country)
 {
     $invoice_fee = self::getInvoiceFee($method, $country);
     $invoice_tax_id = self::getInvoiceTaxId($method, $country);
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     if (!class_exists('VirtueMartModelVendor')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
     }
     $vendor_id = 1;
     $vendor_currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
     $db = JFactory::getDBO();
     $calculator = calculationHelper::getInstance();
     $currency = CurrencyDisplay::getInstance();
     $value = $currency->convertCurrencyTo($vendor_currency->virtuemart_currency_id, $invoice_fee);
     $taxrules = array();
     if (!empty($invoice_tax_id)) {
         $q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $invoice_tax_id . '" ';
         $db->setQuery($q);
         $taxrules = $db->loadAssocList();
     }
     if (count($taxrules) > 0) {
         $salesPrice = $calculator->roundInternal($calculator->executeCalculation($taxrules, $value));
     } else {
         $salesPrice = $value;
     }
     return $salesPrice;
 }
开发者ID:joselapria,项目名称:virtuemart,代码行数:32,代码来源:klarnahandler.php

示例15: checkoutData

 function checkoutData($redirect = true)
 {
     $cart =& self::$current_cart;
     $this->_redirect = false;
     $this->_inCheckOut = true;
     include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     $cart->_inCheckOut = true;
     if (!isset($cart->tosAccepted)) {
         $cart->tosAccepted = 1;
     }
     $cart->tosAccepted = JRequest::getInt('tosAccepted', $cart->tosAccepted);
     if (!isset($cart->customer_comment)) {
         $cart->customer_comment = '';
     }
     $cart->customer_comment = JRequest::getVar('customer_comment', $cart->customer_comment);
     if (empty($cart->customer_comment)) {
         $cart->customer_comment = JRequest::getVar('customer_note', $cart->customer_comment);
     }
     $op_disable_shipto = OPCloader::getShiptoEnabled($cart);
     if (empty($op_disable_shipto)) {
         $shipto = JRequest::getVar('shipto', null);
         if ($shipto != 'new') {
             if (($cart->selected_shipto = $shipto) !== null) {
                 //JModel::addIncludePath(JPATH_VM_ADMINISTRATOR . DS . 'models');
                 require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
                 $userModel = OPCmini::getModel('user');
                 //JModel::getInstance('user', 'VirtueMartModel');
                 $stData = $userModel->getUserAddressList(0, 'ST', $cart->selected_shipto);
                 if (isset($stData[0])) {
                     $this->validateUserData('ST', $stData[0], $cart);
                 }
             }
         }
     } else {
         $cart->STsameAsBT = 1;
         $cart->ST = $cart->BT;
     }
     $cart->setCartIntoSession();
     $mainframe = JFactory::getApplication();
     if (isset($cart->cartProductsData)) {
         $count = count($cart->cartProductsData);
     } else {
         $count = count($cart->products);
     }
     if ($count == 0) {
         $mainframe->redirect(JRoute::_('index.php?option=com_virtuemart', false), JText::_('COM_VIRTUEMART_CART_NO_PRODUCT'));
     } else {
         foreach ($cart->products as $product) {
             $redirectMsg = $this->checkForQuantities($product, $product->quantity);
             if (!$redirectMsg) {
                 //					$this->setCartIntoSession();
                 $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=checkout', false, VmConfig::get('useSSL', false)), $redirectMsg);
             }
         }
     }
     include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     //But we check the data again to be sure
     if (empty($cart->BT)) {
         $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=checkout', false, VmConfig::get('useSSL', false)));
     } else {
         $redirectMsg = $this->validateUserData('BT', null, $cart);
         if ($redirectMsg) {
             $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=checkout', false, VmConfig::get('useSSL', false)), $redirectMsg);
         }
     }
     if ($cart->STsameAsBT !== 0) {
         $cart->ST = $cart->BT;
     } else {
         //Only when there is an ST data, test if all necessary fields are filled
         if (!empty($cart->ST)) {
             $redirectMsg = $this->validateUserData('ST', null, $cart);
             if ($redirectMsg) {
                 //				$cart->setCartIntoSession();
                 $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=checkout', false, VmConfig::get('useSSL', false)), $redirectMsg);
             }
         }
     }
     // Test Coupon
     $shipment = $cart->virtuemart_shipmentmethod_id;
     $payment = $cart->virtuemart_paymentmethod_id;
     //2.0.144: $prices = $cartClass->getCartPrices();
     $cart->virtuemart_shipmentmethod_id = $shipment;
     $cart->virtuemart_paymentmethod_id = $payment;
     //2.0.144 added
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calc = calculationHelper::getInstance();
     if (method_exists($calc, 'setCartPrices')) {
         $vm2015 = true;
     } else {
         $vm2015 = false;
     }
     if ($vm2015) {
         $calc->setCartPrices(array());
     }
     //  $cart->pricesUnformatted = $prices = $calc->getCheckoutPrices(  $cart, false, 'opc');
     $cart->pricesUnformatted = $prices = OPCloader::getCheckoutPrices($cart, false, $vm2015, 'opc');
     //$calc->getCheckoutPrices(  $cart, false, 'opc');
     // Check if a minimun purchase value is set
//.........这里部分代码省略.........
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:101,代码来源:cart_override.php


注:本文中的calculationHelper::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。