• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP calculationHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了calculationHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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


示例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: setKlarnaCartPrices

 function setKlarnaCartPrices(VirtueMartCart $cart, &$cart_prices, $method)
 {
     $this->_getCartAddressCountryCode(NULL, $country, $countryId);
     $invoice_fee = KlarnaHandler::getInvoiceFee($method, $country);
     $invoice_tax_id = KlarnaHandler::getInvoiceTaxId($method, $country);
     $_psType = ucfirst($this->_psType);
     $cart_prices[$this->_psType . 'Value'] = $invoice_fee;
     $taxrules = array();
     if (!empty($invoice_tax_id)) {
         $db = JFactory::getDBO();
         $q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $invoice_tax_id . '" ';
         $db->setQuery($q);
         $taxrules = $db->loadAssocList();
     }
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     if (count($taxrules) > 0) {
         $cart_prices['salesPrice' . $_psType] = $calculator->roundInternal($calculator->executeCalculation($taxrules, $cart_prices[$this->_psType . 'Value']));
         $cart_prices[$this->_psType . 'Tax'] = $calculator->roundInternal($cart_prices['salesPrice' . $_psType]) - $cart_prices[$this->_psType . 'Value'];
     } else {
         $cart_prices['salesPrice' . $_psType] = $invoice_fee;
         $cart_prices[$this->_psType . 'Tax'] = 0;
     }
 }
开发者ID:joselapria,项目名称:virtuemart,代码行数:26,代码来源:klarna.php


示例8: calculateSalesPrice

 /**
  * calculateSalesPrice
  * overrides default function to remove currency conversion
  * @author Zasilkovna
  */
 function calculateSalesPrice($cart, $method, $cart_prices)
 {
     $value = $this->getCosts($cart, $method, $cart_prices);
     $tax_id = @$method->tax_id;
     $vendor_id = $cart->vendorId;
     if (empty($vendor_id)) {
         $vendor_id = 1;
     }
     $vendor_currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
     $db = JFactory::getDBO();
     $calculator = calculationHelper::getInstance();
     $currency = CurrencyDisplay::getInstance();
     $taxrules = array();
     if (!empty($tax_id)) {
         $q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $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:aldegtyarev,项目名称:stelsvelo,代码行数:30,代码来源:ulozenka.php


示例9: createStandardRequest

 function createStandardRequest($calc, $products, $sign = 1)
 {
     if (!class_exists('TaxServiceSoap')) {
         require VMAVALARA_CLASS_PATH . DS . 'TaxServiceSoap.class.php';
     }
     if (!class_exists('DocumentType')) {
         require VMAVALARA_CLASS_PATH . DS . 'DocumentType.class.php';
     }
     if (!class_exists('DetailLevel')) {
         require VMAVALARA_CLASS_PATH . DS . 'DetailLevel.class.php';
     }
     if (!class_exists('Line')) {
         require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
     }
     if (!class_exists('ServiceMode')) {
         require VMAVALARA_CLASS_PATH . DS . 'ServiceMode.class.php';
     }
     if (!class_exists('Line')) {
         require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
     }
     if (!class_exists('GetTaxRequest')) {
         require VMAVALARA_CLASS_PATH . DS . 'GetTaxRequest.class.php';
     }
     if (!class_exists('GetTaxResult')) {
         require VMAVALARA_CLASS_PATH . DS . 'GetTaxResult.class.php';
     }
     if (!class_exists('Address')) {
         require VMAVALARA_CLASS_PATH . DS . 'Address.class.php';
     }
     if (is_object($calc)) {
         $calc = get_object_vars($calc);
     }
     $request = new GetTaxRequest();
     $origin = new Address();
     //In Virtuemart we have not differenct warehouses, but we have a shipment address
     //So when the vendor has a shipment address, we assume that it is his warehouse
     //Later we can combine products with shipment addresses for different warehouse (yehye, future music)
     //But for now we just use the BT address
     if (!class_exists('VirtueMartModelVendor')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
     }
     $userId = VirtueMartModelVendor::getUserIdByVendorId($calc['virtuemart_vendor_id']);
     $userModel = VmModel::getModel('user');
     $virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId);
     // this is needed to set the correct user id for the vendor when the user is logged
     $userModel->getVendor($calc['virtuemart_vendor_id']);
     $vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE);
     $vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
     $origin->setLine1($vendorFields['fields']['address_1']['value']);
     $origin->setLine2($vendorFields['fields']['address_2']['value']);
     $origin->setCity($vendorFields['fields']['city']['value']);
     $origin->setCountry($vendorFields['fields']['virtuemart_country_id']['country_2_code']);
     $origin->setRegion($vendorFields['fields']['virtuemart_state_id']['state_2_code']);
     $origin->setPostalCode($vendorFields['fields']['zip']['value']);
     $request->setOriginAddress($origin);
     //Address
     if (isset($this->addresses[0])) {
         $destination = $this->addresses[0];
     } else {
         return FALSE;
     }
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $request->setCurrencyCode($calculator->_currencyDisplay->_vendorCurrency_code_3);
     //CurrencyCode
     $request->setDestinationAddress($destination);
     //Address
     $request->setCompanyCode($calc['company_code']);
     // Your Company Code From the Dashboard
     $request->setDocDate(date('Y-m-d'));
     //date, checked
     $request->setCustomerCode(self::$vmadd['customer_number']);
     //string Required
     if (isset(self::$vmadd['tax_usage_type'])) {
         $request->setCustomerUsageType(self::$vmadd['tax_usage_type']);
         //string   Entity Usage
     }
     if (isset(self::$vmadd['tax_exemption_number'])) {
         $request->setExemptionNo(self::$vmadd['tax_exemption_number']);
         //string   if not using ECMS which keys on customer code
     }
     if (isset(self::$vmadd['taxOverride'])) {
         $request->setTaxOverride(self::$vmadd['taxOverride']);
         avadebug('I set tax override ', self::$vmadd['taxOverride']);
     }
     $setAllDiscounted = false;
     if (isset($products['discountAmount'])) {
         if (!empty($products['discountAmount'])) {
             //$request->setDiscount($sign * $products['discountAmount'] * (-1));            //decimal
             $request->setDiscount($sign * $products['discountAmount']);
             //decimal
             vmdebug('We sent as discount ' . $request->getDiscount());
             $setAllDiscounted = true;
         }
         unset($products['discountAmount']);
     }
     $request->setDetailLevel('Tax');
     //Summary or Document or Line or Tax or Diagnostic
//.........这里部分代码省略.........
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:101,代码来源:avalara.php


示例10: calculateSalesPrice

 /**
  * calculateSalesPrice
  *
  * @param $value
  * @param $tax_id: tax id
  * @return $salesPrice
  */
 protected function calculateSalesPrice($cart, $method, $cart_prices)
 {
     $value = $this->getCosts($cart, $method, $cart_prices);
     $tax_id = @$method->tax_id;
     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, $value);
     $taxrules = array();
     if (!empty($tax_id)) {
         $q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $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:romuland,项目名称:khparts,代码行数:39,代码来源:vmpsplugin.php


示例11: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     //Load languages
     $language = JFactory::getLanguage();
     $language->load('plg_k2_k2mart', JPATH_ADMINISTRATOR);
     $language->load('com_virtuemart', JPATH_ADMINISTRATOR);
     //Get params
     $params = JComponentHelper::getParams('com_k2mart');
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     //Add scripts and styles
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/plugins/k2/k2mart/tmpl/admin/css/admin.style.css');
     $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_k2mart/css/chosen.css');
     $document->addScript(JURI::root(true) . '/plugins/k2/k2mart/includes/js/admin.k2mart.js');
     $document->addScript(JURI::root(true) . '/administrator/components/com_k2mart/js/chosen.jquery.min.js');
     $document->addScript(JURI::root(true) . '/components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.js');
     $document->addScript(JURI::root(true) . '/administrator/components/com_virtuemart/assets/js/vm2admin.js');
     $document->addScript(JURI::root(true) . '/administrator/components/com_virtuemart/assets/js/jquery.coookie.js');
     //Get K2 Item
     $itemID = JRequest::getInt('cid');
     $productID = 0;
     if ($itemID) {
         $query = "SELECT referenceID FROM #__k2mart WHERE baseID = {$itemID}";
         $db->setQuery($query);
         $productID = $db->loadResult();
     }
     //Include Virtuemart classes
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     $config = VmConfig::loadConfig();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctions.php';
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'html.php';
     JModel::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
     //Get product
     $model = JModel::getInstance('Product', 'VirtuemartModel');
     $product = $model->getProductSingle($productID, false);
     //Get product children
     $product->children = method_exists($model, 'getProductChilds') ? $model->getProductChilds($productID) : $model->getProductChildIds($productID);
     //Get product parent
     JModel::addIncludePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models');
     $K2Model = JModel::getInstance('Itemlist', 'K2Model');
     $tree = $K2Model->getCategoryTree($params->get('catalogRoot', 0));
     $query = "SELECT id AS value, title AS text FROM #__k2_items WHERE catid IN(" . implode(',', $tree) . ")";
     $db->setQuery($query);
     $items = $db->loadObjectList();
     $option = new JObject();
     $option->value = 0;
     $option->text = JText::_('K2MART_NONE');
     array_unshift($items, $option);
     $parent = 0;
     if ($product->product_parent_id) {
         $query = "SELECT baseID FROM #__k2mart WHERE referenceID = {$product->product_parent_id}";
         $db->setQuery($query);
         $parent = $db->loadResult();
     }
     $lists['product_parent_id'] = JHTML::_('select.genericlist', $items, 'product_parent_id', 'class="inputbox"', 'value', 'text', $parent);
     //Get category tree
     if (isset($product->categories)) {
         $lists['categories'] = ShopFunctions::categoryListTree($product->categories);
     } else {
         $lists['categories'] = ShopFunctions::categoryListTree();
     }
     //Get vendors
     if (Vmconfig::get('multix', 'none') !== 'none') {
         $lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id);
     }
     //Get images
     $model->addImages($product);
     if (is_array($product->images) && isset($product->images[0])) {
         $product->image = $product->images[0];
     } else {
         $product->image = new JObject();
         $product->image->virtuemart_media_id = 0;
         $product->image->file_title = '';
         $product->image->file_description = '';
         $product->image->file_meta = '';
         $product->image->file_url = '';
         $product->image->file_url_thumb = '';
         $product->image->file_title = '';
     }
     //Get manufacturers
     $model = JModel::getInstance('Manufacturer', 'VirtuemartModel');
     $manufacturers = $model->getManufacturerDropdown($product->virtuemart_manufacturer_id);
     if (count($manufacturers) > 0) {
         $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id);
     }
     //Get shopper groups
     if (isset($product->shoppergroups)) {
         $lists['shopperGroups'] = ShopFunctions::renderShopperGroupList($product->shoppergroups, true);
     }
     //Get product price
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
     $calculator = calculationHelper::getInstance();
     $product->prices = $calculator->getProductPrices($product);
     // Get product price override options
     $options = array(0 => 'Disabled', 1 => 'Overwrite final', -1 => 'Overwrite price to tax');
     $lists['price_override_options'] = VmHtml::radioList('override', $product->override, $options);
     // Get tax rules
     $dbTax = '';
     foreach ($calculator->rules['DBTax'] as $rule) {
//.........这里部分代码省略.........
开发者ID:Gskflute,项目名称:joomla25,代码行数:101,代码来源:virtuemart.php


示例12: 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


示例13: 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


示例14: getInstance

 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new calculationHelper();
     } else {
         $jnow = JFactory::getDate();
         self::$_instance->_now = $jnow->toMySQL();
     }
     return self::$_instance;
 }
开发者ID:romuland,项目名称:khparts,代码行数:10,代码来源:calculationh.php


示例15: 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


示例16: getPrice

 /**
  * Gets the price for a variant
  *
  * @author Max Milbers
  */
 public function getPrice($product, $customVariant, $quantity)
 {
     $this->_db = JFactory::getDBO();
     // 		vmdebug('strange',$product);
     if (!is_object($product)) {
         // 		vmError('deprecated use of getPrice');
         $product = $this->getProduct($product, TRUE, FALSE, TRUE, $quantity);
         // 		return false;
     }
     // Loads the product price details
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     // Calculate the modificator
     $variantPriceModification = $calculator->calculateModificators($product, $customVariant);
     $prices = $calculator->getProductPrices($product, $variantPriceModification, $quantity);
     return $prices;
 }
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:24,代码来源:product.php


示例17: _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


示例18: setShopperGroupsController


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP calendar类代码示例发布时间:2022-05-23
下一篇:
PHP cachemgr类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap