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


PHP ShopFunctions::getCurrencyIDByName方法代码示例

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


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

示例1: getCurrencyIdByField

 /**
  * Changes the currency_code into the right virtuemart_currency_id
  * For exampel 'currency_code_3' : EUR => 47
  *
  * @author Max Milbers
  * @author Kohl Patrick
  */
 function getCurrencyIdByField($value = 0, $fieldName = 'currency_code_3')
 {
     if (is_string($value)) {
         if (!class_exists('ShopFunctions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         return ShopFunctions::getCurrencyIDByName($value, $fieldName);
     }
     return $value;
 }
开发者ID:lenard112,项目名称:cms,代码行数:17,代码来源:currencydisplay.php

示例2: convertPrice

 /**
  * @static
  * @param        $price
  * @param string $toCurrency
  * @return float
  */
 static function convertPrice($price, $fromCurrency, $toCurrency = '', $cartPricesCurrency = '')
 {
     if (!(is_int($toCurrency) or is_numeric($toCurrency)) && !empty($toCurrency)) {
         $toCurrency = ShopFunctions::getCurrencyIDByName($toCurrency);
     }
     if ($fromCurrency == $toCurrency) {
         return $price;
     }
     // product prices or total in cart is always in vendor currency
     $priceInNewCurrency = vmPSPlugin::getAmountInCurrency($price, $toCurrency);
     // set back the currency display
     if (empty($cartPricesCurrency)) {
         $cartPricesCurrency = $fromCurrency;
     }
     $cd = CurrencyDisplay::getInstance($cartPricesCurrency);
     vmDebug('convertPrice', $price, $toCurrency, $fromCurrency, $cartPricesCurrency, $priceInNewCurrency);
     return $priceInNewCurrency['value'];
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:24,代码来源:klarnahandler.php

示例3: getCosts

 /**    
  * @return delivery cost for the shipping method instance
  * @author Zasilkovna
  */
 function getCosts(VirtueMartCart $cart, $method, $cart_prices)
 {
     //get actual display currency. in $cart->pricesCurrency its not updated immediately.. but if we dont use change currency,   getUserStateFromRequest doesnt return anything.. so then use cart pricesCurrency
     $currency = CurrencyDisplay::getInstance();
     $pricesCurrencyId = $currency->_app->getUserStateFromRequest('virtuemart_currency_id', 'virtuemart_currency_id', $currency->_vendorCurrency);
     if (empty($pricesCurrencyId)) {
         //this is pretty weird
         $pricesCurrencyId = $cart->pricesCurrency;
     }
     $pobocka = $this->getSelectedPobocka();
     if (empty($pobocka)) {
         return 0;
     }
     require_once dirname(__FILE__) . DS . 'helper.php';
     $pobockaObj = UlozenkaHelper::getDataPobocky($method, $pobocka);
     $parcel_price = 'parcelprice' . $pobocka;
     $dobierka_price = 'codprice' . $pobocka;
     $price = $method->pobocky->{$parcel_price};
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $cid = ShopFunctions::getCurrencyIDByName("CZK");
     /*
       Set free shipping
     */
     $total = $cart->pricesUnformatted['billTotal'];
     if (!empty($cart->pricesUnformatted['salesPriceShipment'])) {
         $total -= (double) $cart->pricesUnformatted['salesPriceShipment'];
     }
     if (!empty($cart->pricesUnformatted['salesPricePayment'])) {
         $total -= (double) $cart->pricesUnformatted['salesPricePayment'];
     }
     if (!empty($pobockaObj->sk)) {
         $method->free_start_sk = (double) $method->free_start_sk;
         if (!empty($method->free_start_sk)) {
             if ($total >= $method->free_start_sk) {
                 return 0;
             }
         }
     } else {
         if (!empty($pobockaObj->partner)) {
             if (!empty($method->free_start_partner)) {
                 $fs = (double) $method->free_start_partner;
                 if ($total >= $fs) {
                     return 0;
                 }
             }
         } else {
             if (!empty($method->free_start_ulozenka)) {
                 $fs = (double) $method->free_start_ulozenka;
                 if ($total >= $fs) {
                     return 0;
                 }
             }
         }
     }
     if (!empty($method->cod_payments)) {
         if (!empty($cart->virtuemart_paymentmethod_id)) {
             if (in_array($cart->virtuemart_paymentmethod_id, $method->cod_payments)) {
                 if (!empty($method->pobocky->{$dobierka_price})) {
                     $price += $method->pobocky->{$dobierka_price};
                 }
             }
         }
     }
     $orderWeight = $this->getOrderWeight($cart, $method->weight_unit);
     if (!empty($method->weight_stop)) {
         if ($orderWeight > $method->weight_stop) {
             $w = (double) $method->weight_stop;
             $times = $orderWeight / $w;
             $c = ceil($times);
             $price = $price * $c;
         }
     }
     return $price;
 }
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:80,代码来源:ulozenka.php

示例4: getStoreInternalData

 function getStoreInternalData($klarna_data, &$dbValues, $action = NULL, $message)
 {
     $dbValues['data'] = json_encode($klarna_data);
     $dbValues['payment_order_total'] = $klarna_data['order_amount'];
     $dbValues['payment_currency'] = ShopFunctions::getCurrencyIDByName($klarna_data['purchase_currency']);
     $dbValues['action'] = $action;
     $dbValues['klarna_id'] = $klarna_data['order_id'];
     $dbValues['klarna_status'] = $klarna_data['status'];
     $dbValues['klarna_fraud_status'] = $klarna_data['fraud_status'];
     //$dbValues['klarna_reservation'] = $klarna_checkout_order['reservation'];
     $dbValues['klarna_reference'] = isset($klarna_data['klarna_reference']) ? $klarna_data['klarna_reference'] : '';
     $dbValues['klarna_started_at'] = isset($klarna_data['started_at']) ? $klarna_data['started_at'] : '';
     $dbValues['klarna_completed_at'] = isset($klarna_data['completed_at']) ? $klarna_data['completed_at'] : '';
     $dbValues['klarna_expires_at'] = isset($klarna_data['expires_at']) ? $klarna_data['expires_at'] : '';
     $dbValues['format'] = 'json';
     $data = json_decode($dbValues['data']);
 }
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:17,代码来源:kco_rest_php.php

示例5: getStoreInternalData

 function getStoreInternalData($klarna_checkout_order, $dbValues)
 {
     $dbValues['payment_order_total'] = $klarna_checkout_order['cart']['total_price_including_tax'] / 100;
     $dbValues['payment_currency'] = ShopFunctions::getCurrencyIDByName($klarna_checkout_order['purchase_currency']);
     $dbValues['klarna_id'] = $klarna_checkout_order['id'];
     $dbValues['klarna_status'] = $klarna_checkout_order['status'];
     $dbValues['klarna_reservation'] = $klarna_checkout_order['reservation'];
     $dbValues['klarna_reference'] = $klarna_checkout_order['reference'];
     $dbValues['klarna_started_at'] = $klarna_checkout_order['started_at'];
     $dbValues['klarna_completed_at'] = $klarna_checkout_order['completed_at'];
     $dbValues['klarna_expires_at'] = $klarna_checkout_order['expires_at'];
     $dbValues['format'] = 'none';
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:13,代码来源:kco_php.php

示例6: convertPrice

 static function convertPrice($price, $toCurrency = '')
 {
     if (!is_int($toCurrency) && !empty($toCurrency)) {
         $toCurrency = ShopFunctions::getCurrencyIDByName($toCurrency);
     }
     $currency = CurrencyDisplay::getInstance($toCurrency);
     $fromCurrency = $currency->getCurrencyForDisplay();
     $price = round($currency->convertCurrencyTo($toCurrency, $price, false), 2);
     $cd = CurrencyDisplay::getInstance($fromCurrency);
     return $price;
 }
开发者ID:joselapria,项目名称:virtuemart,代码行数:11,代码来源:klarnahandler.php

示例7: getViewData

 /**
  * @param $product
  * @return array|null
  */
 private function getViewData($product)
 {
     if (!class_exists('KlarnaAPI')) {
         require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarnaapi.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $price = $product->prices['salesPrice'];
     $country = $this->cData['country'];
     $lang = $this->cData['language_code'];
     $types = array(KlarnaPClass::CAMPAIGN, KlarnaPClass::ACCOUNT, KlarnaPClass::FIXED);
     $kCheckout = new KlarnaAPI($country, $lang, 'part', $price, KlarnaFlags::PRODUCT_PAGE, $this->klarna_virtuemart, $types, $this->path);
     $kCheckout->setCurrency($this->cData['currency']);
     // TODO : Not top to get setup  values here!
     $this->settings = $kCheckout->getSetupValues();
     if ($price > 0 && count($kCheckout->aPClasses) > 0) {
         $currencydisplay = CurrencyDisplay::getInstance();
         $sMonthDefault = NULL;
         $sTableHtml = "";
         $monthTable = array();
         // either in vendor's currency, or shipTo Currency
         $countryCurrencyId = ShopFunctions::getCurrencyIDByName($this->cData['currency_code']);
         $currency = CurrencyDisplay::getInstance($countryCurrencyId);
         $fromCurrency = $currency->getCurrencyForDisplay();
         //$paymentCurrency = CurrencyDisplay::getInstance($this->cart->paymentCurrency);
         //$totalInPaymentCurrency = $paymentCurrency->priceDisplay( $this->cart->pricesUnformatted['billTotal'],$this->cart->paymentCurrency) ;
         //$currencyDisplay = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
         $i = 0;
         foreach ($kCheckout->aPClasses as $pclass) {
             if ($sMonthDefault === NULL || $pclass['monthlyCost'] < $sMonthDefault) {
                 $sMonthDefault = $currency->priceDisplay($pclass['monthlyCost'], $countryCurrencyId);
             }
             if ($pclass['pclass']->getType() == KlarnaPClass::ACCOUNT) {
                 $pp_title = JText::_('VMPAYMENT_KLARNA_PPBOX_ACCOUNT');
             } else {
                 $pp_title = $pclass['pclass']->getMonths() . " " . JText::_('VMPAYMENT_KLARNA_PPBOX_TH_MONTH');
             }
             $pp_price = $currency->priceDisplay($pclass['monthlyCost'], $countryCurrencyId);
             $monthTable[$i] = array('pp_title' => html_entity_decode($pp_title), 'pp_price' => $pp_price, 'country' => $country);
             $i++;
         }
         $cd = CurrencyDisplay::getInstance($fromCurrency);
         $aInputValues = array();
         $aInputValues['defaultMonth'] = $sMonthDefault;
         $aInputValues['monthTable'] = $monthTable;
         $aInputValues['eid'] = $this->cData['eid'];
         $aInputValues['country'] = KlarnaCountry::getCode($country);
         if ($country == KlarnaCountry::DE) {
             $aInputValues['asterisk'] = '*';
         } else {
             $aInputValues['asterisk'] = '';
         }
         return $aInputValues;
     }
     return NULL;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:61,代码来源:klarna_productprice.php

示例8: convertPrice

 /**
  * @static
  * @param        $price
  * @param string $toCurrency
  * @return float
  */
 static function convertPrice($price, $cartPricesCurrency, $toCurrency = '')
 {
     if (!(is_int($toCurrency) or is_numeric($toCurrency)) && !empty($toCurrency)) {
         $toCurrency = ShopFunctions::getCurrencyIDByName($toCurrency);
     }
     if ($cartPricesCurrency == $toCurrency) {
         return $price;
     }
     $currencyToConvert = CurrencyDisplay::getInstance($toCurrency);
     // product prices or total in cart is always in vendor currency
     $priceInNewCurrency = round($currencyToConvert->convertCurrencyTo($toCurrency, $price, FALSE), 2);
     // set back the currency display
     $cd = CurrencyDisplay::getInstance($cartPricesCurrency);
     vmDebug('convertPrice', $price, $cartPricesCurrency, $toCurrency, $priceInNewCurrency);
     return $priceInNewCurrency;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:22,代码来源:klarnahandler.php


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