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


PHP Currency::getActiveCurrencyCode方法代码示例

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


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

示例1: getAsStrings

 /**
  * Returns an array of two HTML representations of the Attributes and
  * their respective options specified by the array given
  *
  * One of these representation may be used anywhere the matching Product
  * is viewed.  The first (at index 0) is the long form best used in the
  * cart view, the second (at index 1) is suitable for the JSCart in the
  * sidebar.
  * Attributes with an empty list of option IDs will not be included in
  * the string produced.  Invalid IDs are silently skipped.
  * Note that the format of the string can be easily customized by editing
  * the following language entries:
  *  TXT_SHOP_OPTION_LONG_FORMAT
  *  TXT_SHOP_OPTION_LONG_FORMAT_JOINER
  *  TXT_SHOP_ATTRIBUTE_LONG_FORMAT
  *  TXT_SHOP_ATTRIBUTE_LONG_FORMAT_JOINER
  *  TXT_SHOP_OPTION_CART_FORMAT
  *  TXT_SHOP_OPTION_CART_FORMAT_JOINER
  *  TXT_SHOP_ATTRIBUTE_CART_FORMAT
  *  TXT_SHOP_ATTRIBUTE_CART_FORMAT_JOINER
  * The array parameter must have the form
  *  array(
  *    Attribute ID => array(
  *      option ID,
  *      [...]
  *    ),
  *    [...],
  *  )
  * @global  array   $_ARRAYLANG
  * @param   array   $arrAttributesOptions   The array of Attribute and
  *                                          option IDs
  * @param   float   $options_price          The sum of all option prices,
  *                                          by reference
  * @return  array                           The array of two HTML
  *                                          representations of
  *                                          the Attributes and options
  *                                          present in the parameter array
  */
 static function getAsStrings($arrAttributesOptions, &$options_price = NULL)
 {
     global $_ARRAYLANG;
     //DBG::log("Attributes::getAsStrings(".var_export($arrAttributesOptions, true).", $options_price)");
     $options_price = 0;
     if (!is_array($arrAttributesOptions) || empty($arrAttributesOptions)) {
         return array('', '');
     }
     $attributes_long = $attributes_cart = array();
     foreach ($arrAttributesOptions as $attribute_id => $arrOptionIds) {
         //DBG::log("Attributes::getAsStrings(): Attribute ID $attribute_id");
         if (empty($arrOptionIds)) {
             continue;
         }
         $objAttribute = Attribute::getById($attribute_id);
         if (!$objAttribute) {
             continue;
         }
         //DBG::log("Attributes::getAsStrings(): Attribute ".var_export($objAttribute, true));
         $options_long = $options_cart = array();
         $arrOptions = $objAttribute->getOptionArray();
         foreach ($arrOptionIds as $option_id) {
             //DBG::log("Attributes::getAsStrings(): Option ID $option_id");
             $option_name = '';
             // Valid indices are: 'value', 'price', 'order'
             $option_price = $arrOptions[$option_id]['price'];
             // Note that this *MUST NOT* test for is_integer()
             // (which $option_id isn't -- it's either an arbitrary
             // string, or one that represents a positive integer),
             // but for a *string matching a valid ID*.
             // intval() doesn't do the job properly, as it also
             // converts "1 but true" to 1.
             // A good match would be done by is_numeric(); however,
             // this would also accept floats and scientific
             // notation...
             if (preg_match('/^[1-9][0-9]*$/', $option_id) && in_array($objAttribute->getType(), array(Attribute::TYPE_MENU_OPTIONAL, Attribute::TYPE_MENU_MANDATORY, Attribute::TYPE_RADIOBUTTON, Attribute::TYPE_CHECKBOX))) {
                 $option_name = $arrOptions[$option_id]['value'];
             } else {
                 $option_name = ShopLibrary::stripUniqidFromFilename($option_id);
                 $path = Order::UPLOAD_FOLDER . $option_id;
                 if ($option_name != $option_id && file_exists($path)) {
                     $option_name = \Html::getLink('/' . $path, $option_name, 'uploadimage');
                 }
             }
             $options_long[] = sprintf($_ARRAYLANG['TXT_SHOP_OPTION_LONG_FORMAT'], $option_name, $option_price, Currency::getActiveCurrencyCode(), Currency::getActiveCurrencySymbol());
             $options_cart[] = sprintf($_ARRAYLANG['TXT_SHOP_OPTION_CART_FORMAT'], $option_name, $option_price, Currency::getActiveCurrencyCode(), Currency::getActiveCurrencySymbol());
             $options_price += $option_price;
             //DBG::log("Attributes::getAsStrings(): Price + $option_price = $options_price");
         }
         if ($options_long) {
             $options_long = join($_ARRAYLANG['TXT_SHOP_OPTION_LONG_FORMAT_JOINER'], $options_long);
             $attributes_long[] = sprintf($_ARRAYLANG['TXT_SHOP_ATTRIBUTE_LONG_FORMAT'], $objAttribute->getName(), $options_long);
             $options_cart = join($_ARRAYLANG['TXT_SHOP_OPTION_CART_FORMAT_JOINER'], $options_cart);
             $attributes_cart[] = sprintf($_ARRAYLANG['TXT_SHOP_ATTRIBUTE_CART_FORMAT'], $objAttribute->getName(), $options_cart);
         }
     }
     if ($attributes_long) {
         $attributes_long = join($_ARRAYLANG['TXT_SHOP_ATTRIBUTE_LONG_FORMAT_JOINER'], $attributes_long);
         $attributes_cart = join($_ARRAYLANG['TXT_SHOP_ATTRIBUTE_CART_FORMAT_JOINER'], $attributes_cart);
     }
     return array($attributes_long, $attributes_cart);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:100,代码来源:Attributes.class.php

示例2: showShipmentTerms

 /**
  * Set up the template block with the shipment terms and conditions
  *
  * Please *DO NOT* remove this method, despite the site terms and
  * conditions have been removed from the Shop!
  * This has been requested by some shopkeepers and may be used at will.
  * @global    array   $_ARRAYLANG     Language array
  * @author    Reto Kohli <reto.kohli@comvation.com>
  */
 static function showShipmentTerms()
 {
     if (self::$objTemplate->blockExists('shopShipper')) {
         // TODO: Should be set by the calling view, if any
         global $_ARRAYLANG;
         self::$objTemplate->setGlobalVariable($_ARRAYLANG + array('SHOP_CURRENCY_SYMBOL' => Currency::getActiveCurrencySymbol(), 'SHOP_CURRENCY_CODE' => Currency::getActiveCurrencyCode()));
         $arrShipment = Shipment::getShipmentConditions();
         foreach ($arrShipment as $strShipperName => $arrContent) {
             $strCountries = join(', ', $arrContent['countries']);
             $arrConditions = $arrContent['conditions'];
             self::$objTemplate->setCurrentBlock('shopShipment');
             foreach ($arrConditions as $arrData) {
                 self::$objTemplate->setVariable(array('SHOP_MAX_WEIGHT' => $arrData['max_weight'], 'SHOP_COST_FREE' => $arrData['free_from'], 'SHOP_COST' => $arrData['fee']));
                 self::$objTemplate->parse('shopShipment');
             }
             self::$objTemplate->setVariable(array('SHOP_SHIPPER' => $strShipperName, 'SHOP_COUNTRIES' => $strCountries));
             self::$objTemplate->parse('shopShipper');
         }
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:29,代码来源:Shop.class.php

示例3: getTotalAmountString

 /**
  * Returns a formatted string indicating the given amount as discounted
  * due to the use of coupon codes
  * @param   float   $amount     The amount
  * @return  sting               The formatted string
  */
 static function getTotalAmountString($amount)
 {
     global $_ARRAYLANG;
     return sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_AMOUNT_TOTAL_STRING_FORMAT'], Currency::formatPrice($amount), Currency::getActiveCurrencyCode());
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:11,代码来源:Coupon.class.php

示例4: checkIn

 /**
  * Check in the payment processor after the payment is complete.
  * @return  mixed   For external payment methods:
  *                  The integer order ID, if known, upon success
  *                  For internal payment methods:
  *                  Boolean true, in order to make these skip the order
  *                  status update, as this has already been done.
  *                  If the order ID is unknown or upon failure:
  *                  Boolean false
  */
 static function checkIn()
 {
     //DBG::log("PaymentProcessing::checkIn(): Entered");
     //DBG::log("POST: ".var_export($_POST, true));
     //DBG::log("GET: ".var_export($_GET, true));
     $result = NULL;
     if (isset($_GET['result'])) {
         $result = abs(intval($_GET['result']));
         if ($result == 0 || $result == 2) {
             return false;
         }
     }
     if (empty($_REQUEST['handler'])) {
         return false;
     }
     switch ($_REQUEST['handler']) {
         case 'paymill_cc':
         case 'paymill_elv':
         case 'paymill_iban':
             $arrShopOrder = array('order_id' => $_SESSION['shop']['order_id'], 'amount' => intval(bcmul($_SESSION['shop']['grand_total_price'], 100, 0)), 'currency' => Currency::getActiveCurrencyCode(), 'note' => $_SESSION['shop']['note']);
             $response = \PaymillHandler::processRequest($_REQUEST['paymillToken'], $arrShopOrder);
             \DBG::log(var_export($response, true));
             if ($response['status'] === 'success') {
                 return true;
             } else {
                 \DBG::log("PaymentProcessing::checkIn(): WARNING: paymill: Payment verification failed; errors: " . var_export($response, true));
                 return false;
             }
         case 'saferpay':
             $arrShopOrder = array('ACCOUNTID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_id', 'Shop'));
             $id = \Saferpay::payConfirm();
             if (\Cx\Core\Setting\Controller\Setting::getValue('saferpay_finalize_payment', 'Shop')) {
                 $arrShopOrder['ID'] = $id;
                 $id = \Saferpay::payComplete($arrShopOrder);
             }
             //DBG::log("Transaction: ".var_export($transaction, true));
             return (bool) $id;
         case 'paypal':
             if (empty($_POST['custom'])) {
                 //DBG::log("PaymentProcessing::checkIn(): No custom parameter, returning NULL");
                 return NULL;
             }
             $order_id = \PayPal::getOrderId();
             //                    if (!$order_id) {
             //                        $order_id = (isset($_SESSION['shop']['order_id'])
             //                            ? $_SESSION['shop']['order_id']
             //                            : (isset ($_SESSION['shop']['order_id_checkin'])
             //                                ? $_SESSION['shop']['order_id_checkin']
             //                                : NULL));
             //                    }
             $order = Order::getById($order_id);
             $amount = $currency_id = $customer_email = NULL;
             if ($order) {
                 $amount = $order->sum();
                 $currency_id = $order->currency_id();
                 $customer_id = $order->customer_id();
                 $customer = Customer::getById($customer_id);
                 if ($customer) {
                     $customer_email = $customer->email();
                 }
             }
             $currency_code = Currency::getCodeById($currency_id);
             return \PayPal::ipnCheck($amount, $currency_code, $order_id, $customer_email, \Cx\Core\Setting\Controller\Setting::getValue('paypal_account_email', 'Shop'));
         case 'yellowpay':
             $passphrase = \Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_out', 'Shop');
             return \Yellowpay::checkIn($passphrase);
             //                    if (\Yellowpay::$arrError || \Yellowpay::$arrWarning) {
             //                        global $_ARRAYLANG;
             //                        echo('<font color="red"><b>'.
             //                        $_ARRAYLANG['TXT_SHOP_PSP_FAILED_TO_INITIALISE_YELLOWPAY'].
             //                        '</b><br />'.
             //                        'Errors:<br />'.
             //                        join('<br />', \Yellowpay::$arrError).
             //                        'Warnings:<br />'.
             //                        join('<br />', \Yellowpay::$arrWarning).
             //                        '</font>');
             //                    }
         //                    if (\Yellowpay::$arrError || \Yellowpay::$arrWarning) {
         //                        global $_ARRAYLANG;
         //                        echo('<font color="red"><b>'.
         //                        $_ARRAYLANG['TXT_SHOP_PSP_FAILED_TO_INITIALISE_YELLOWPAY'].
         //                        '</b><br />'.
         //                        'Errors:<br />'.
         //                        join('<br />', \Yellowpay::$arrError).
         //                        'Warnings:<br />'.
         //                        join('<br />', \Yellowpay::$arrWarning).
         //                        '</font>');
         //                    }
         case 'payrexx':
             return \PayrexxProcessor::checkIn();
//.........这里部分代码省略.........
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:PaymentProcessing.class.php

示例5: getSubstitutionArray


//.........这里部分代码省略.........
         $product_code = $objProduct->code();
         // Pick the order items attributes
         $str_options = '';
         // Any attributes?
         if ($item['attributes']) {
             $str_options = '  ';
             // '[';
             $attribute_name_previous = '';
             foreach ($item['attributes'] as $attribute_name => $arrAttribute) {
                 //DBG::log("Attribute /$attribute_name/ => ".var_export($arrAttribute, true));
                 // NOTE: The option price is optional and may be left out
                 foreach ($arrAttribute as $arrOption) {
                     $option_name = $arrOption['name'];
                     $option_price = $arrOption['price'];
                     $item_price += $option_price;
                     // Recognize the names of uploaded files,
                     // verify their presence and use the original name
                     $option_name_stripped = ShopLibrary::stripUniqidFromFilename($option_name);
                     $path = Order::UPLOAD_FOLDER . $option_name;
                     if ($option_name != $option_name_stripped && \File::exists($path)) {
                         $option_name = $option_name_stripped;
                     }
                     if ($attribute_name != $attribute_name_previous) {
                         if ($attribute_name_previous) {
                             $str_options .= '; ';
                         }
                         $str_options .= $attribute_name . ': ' . $option_name;
                         $attribute_name_previous = $attribute_name;
                     } else {
                         $str_options .= ', ' . $option_name;
                     }
                     // TODO: Add proper formatting with sprintf() and language entries
                     if ($option_price != 0) {
                         $str_options .= ' ' . Currency::formatPrice($option_price) . ' ' . Currency::getActiveCurrencyCode();
                     }
                 }
             }
             //                $str_options .= ']';
         }
         // Product details
         $arrProduct = array('PRODUCT_ID' => $product_id, 'PRODUCT_CODE' => $product_code, 'PRODUCT_QUANTITY' => $quantity, 'PRODUCT_TITLE' => $product_name, 'PRODUCT_OPTIONS' => $str_options, 'PRODUCT_ITEM_PRICE' => sprintf('% 9.2f', $item_price), 'PRODUCT_TOTAL_PRICE' => sprintf('% 9.2f', $item_price * $quantity));
         //DBG::log("Orders::getSubstitutionArray($order_id, $create_accounts): Adding article: ".var_export($arrProduct, true));
         $orderItemCount += $quantity;
         $total_item_price += $item_price * $quantity;
         if ($create_accounts) {
             // Add an account for every single instance of every Product
             for ($instance = 1; $instance <= $quantity; ++$instance) {
                 $validity = 0;
                 // Default to unlimited validity
                 // In case there are protected downloads in the cart,
                 // collect the group IDs
                 $arrUsergroupId = array();
                 if ($objProduct->distribution() == 'download') {
                     $usergroupIds = $objProduct->usergroup_ids();
                     if ($usergroupIds != '') {
                         $arrUsergroupId = explode(',', $usergroupIds);
                         $validity = $objProduct->weight();
                     }
                 }
                 // create an account that belongs to all collected
                 // user groups, if any.
                 if (count($arrUsergroupId) > 0) {
                     // The login names are created separately for
                     // each product instance
                     $username = self::usernamePrefix . "_{$order_id}_{$product_id}_{$instance}";
                     $userEmail = $username . '-' . $arrSubstitution['CUSTOMER_EMAIL'];
开发者ID:Niggu,项目名称:cloudrexx,代码行数:67,代码来源:Orders.class.php


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