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


PHP CASHSystem::getCurrencySymbol方法代码示例

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


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

示例1: getData

 public function getData()
 {
     // define $markup to store all screen output
     $item_request = new CASHRequest(array('cash_request_type' => 'commerce', 'cash_action' => 'getitem', 'id' => $this->options['item_id']));
     $item = $item_request->response['payload'];
     $this->element_data['item_name'] = $item['name'];
     $this->element_data['item_price'] = number_format($item['price'], 2, '.', '');
     $this->element_data['item_flexible_price'] = $item['flexible_price'];
     $this->element_data['item_description'] = $item['description'];
     $this->element_data['item_asset'] = $item['fulfillment_asset'];
     if ($item['available_units'] != 0) {
         $this->element_data['is_available'] = true;
     } else {
         $this->element_data['is_available'] = false;
     }
     $currency_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'use_currency', 'user_id' => $this->element_data['user_id']));
     if ($currency_request->response['payload']) {
         $this->element_data['currency'] = CASHSystem::getCurrencySymbol($currency_request->response['payload']);
     } else {
         $this->element_data['currency'] = CASHSystem::getCurrencySymbol('USD');
     }
     if ($this->status_uid == 'commerce_finalizepayment_200' || $this->status_uid == 'element_redeemcode_200' || $this->status_uid == 'commerce_initiatecheckout_200' && $this->original_response['payload'] == 'force_success') {
         if ($item['fulfillment_asset'] != 0) {
             $fulfillment_request = new CASHRequest(array('cash_request_type' => 'asset', 'cash_action' => 'getfulfillmentassets', 'asset_details' => $item['fulfillment_asset']));
             if ($fulfillment_request->response['payload']) {
                 $this->element_data['fulfillment_assets'] = new ArrayIterator($fulfillment_request->response['payload']);
             }
         }
         $this->setTemplate('success');
     } elseif ($this->status_uid == 'commerce_initiatecheckout_400') {
         // could happen on a database glitch, but probably means the user set a pay-minimum price below the
         // minimum price. what a heel.
         $this->element_data['error_message'] = 'Make sure you enter a price of at least ' . $this->element_data['currency'] . $item['price'] . ' and try again.';
     } elseif ($this->status_uid == 'commerce_finalizepayment_400' || $this->status_uid == 'element_redeemcode_400') {
         // payerid is specific to paypal, so this is temporary to tell between canceled and errored:
         if (isset($_GET['PayerID'])) {
             //$this->element_data['error_message'] = $this->options['message_error'];
             $this->element_data['error_message'] = print_r($this->original_response, true);
         }
     } elseif (isset($_POST['singlepurchase1'])) {
         $total_price = $item['price'];
         if (isset($_POST['total_price'])) {
             $total_price = $_POST['total_price'];
         }
         $this->element_data['total_price'] = $total_price;
         if ($this->element_data['region1_cost'] + $this->element_data['region2_cost'] == 0.0) {
             $this->element_data['no_shipping'] = true;
         }
         if ($total_price >= $item['price']) {
             $this->setTemplate('shipping');
         } else {
             $this->element_data['error_message'] = 'Make sure you enter a price of at least ' . $this->element_data['currency'] . $item['price'] . ' and try again.';
         }
     }
     return $this->element_data;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:56,代码来源:SinglePurchase.php

示例2: round

                }
            }
            $orders_currency = $order['currency'];
        }
        $total_spend = round($total_spend);
    }
    $cash_admin->page_data['dashboard_lists'] = $session_news['activity']['lists'];
    if ($session_news['activity']['orders']) {
        $cash_admin->page_data['total_orders'] = count($session_news['activity']['orders']);
        if ($cash_admin->page_data['total_orders'] == 1) {
            $cash_admin->page_data['orders_singular'] = true;
        }
    } else {
        $cash_admin->page_data['total_orders'] = false;
    }
    $cash_admin->page_data['total_spend'] = CASHSystem::getCurrencySymbol($orders_currency) . $total_spend;
}
// handle all of the sales options, first the change
if (isset($_POST['currency_id'])) {
    $settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'setsettings', 'type' => 'use_currency', 'value' => $_POST['currency_id'], 'user_id' => $cash_admin->effective_user_id));
    $settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'setsettings', 'type' => 'payment_defaults', 'value' => array('pp_default' => $_POST['paypal_default_id'], 'pp_micro' => $_POST['paypal_micropayment_id']), 'user_id' => $cash_admin->effective_user_id));
    if ($settings_response['payload']) {
        AdminHelper::formSuccess('Success.', '/commerce/');
    }
}
// now get the current currency setting
$settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'use_currency', 'user_id' => $cash_admin->effective_user_id));
if ($settings_response['payload']) {
    $current_currency = $settings_response['payload'];
} else {
    $current_currency = 'USD';
开发者ID:rayangc,项目名称:platform,代码行数:31,代码来源:commerce.php

示例3: sendOrderReceipt

 protected function sendOrderReceipt($id = false, $order_details = false, $finalize_url = false)
 {
     if (!$id && !$order_details) {
         return false;
     }
     if (!$order_details) {
         $order_details = $this->getOrder($id, true);
     }
     $order_totals = $this->getOrderTotals($order_details['order_contents']);
     try {
         $personalized_message = '';
         if ($order_details['element_id']) {
             $element_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getelement', 'id' => $order_details['element_id']));
             if ($element_request->response['payload']) {
                 if (isset($element_request->response['payload']['options']['message_email'])) {
                     if ($element_request->response['payload']['options']['message_email']) {
                         $personalized_message = $element_request->response['payload']['options']['message_email'] . "\n\n";
                     }
                 }
             }
         }
         if ($order_details['digital']) {
             $addcode_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'addlockcode', 'element_id' => $order_details['element_id']));
             if (!$finalize_url) {
                 $finalize_url = CASHSystem::getCurrentURL();
             }
             return CASHSystem::sendEmail('Thank you for your order', $order_details['user_id'], $order_details['customer_details']['email_address'], $personalized_message . "Your order is complete. Here are some details:\n\n**Order #" . $order_details['id'] . "**  \n" . $order_totals['description'] . "  \n Total: " . CASHSystem::getCurrencySymbol($order_details['currency']) . number_format($order_details['gross_price'], 2) . "\n\n" . "\n\n" . '[View your receipt and any downloads](' . $finalize_url . '?cash_request_type=element&cash_action=redeemcode&code=' . $addcode_request->response['payload'] . '&element_id=' . $order_details['element_id'] . '&email=' . urlencode($order_details['customer_details']['email_address']) . '&order_id=' . $order_details['id'] . ')', 'Thank you.');
         } else {
             return CASHSystem::sendEmail('Thank you for your order', $order_details['user_id'], $order_details['customer_details']['email_address'], $personalized_message . "Your order is complete. Here are some details:\n\n**Order #" . $order_details['id'] . "**  \n" . $order_totals['description'] . "  \n Total: " . CASHSystem::getCurrencySymbol($order_details['currency']) . number_format($order_details['gross_price'], 2) . "\n\n", 'Thank you.');
         }
     } catch (Exception $e) {
         // TODO: handle the case where an email can't be sent. maybe display the download
         //       code on-screen? that plus storing it with the order is probably enough
         return false;
     }
 }
开发者ID:jmcclenon,项目名称:platform,代码行数:36,代码来源:CommercePlant.php

示例4: finalizeRedirectedPayment

 protected function finalizeRedirectedPayment($order_id, $creation_date, $direct_post_details = false, $session_id = false)
 {
     $order_details = $this->getOrder($order_id);
     $transaction_details = $this->getTransaction($order_details['transaction_id']);
     $connection_type = $this->getConnectionType($transaction_details['connection_id']);
     $r = new CASHRequest();
     $r->startSession(false, $session_id);
     $finalize_url = $r->sessionGet('payment_finalize_url');
     if ($finalize_url) {
         $r->sessionClear('payment_finalize_url');
     }
     switch ($connection_type) {
         case 'com.paypal':
             if (isset($_GET['token'])) {
                 if (isset($_GET['PayerID'])) {
                     $pp = new PaypalSeed($order_details['user_id'], $transaction_details['connection_id'], $_GET['token']);
                     $initial_details = $pp->getExpressCheckout();
                     if ($initial_details['ACK'] == 'Success') {
                         $order_totals = $this->getOrderTotals($order_details['order_contents']);
                         if ($initial_details['AMT'] >= $order_totals['price']) {
                             $final_details = $pp->doExpressCheckout();
                             if ($final_details) {
                                 // look for a user to match the email. if not present, make one
                                 $user_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'getuseridforaddress', 'address' => $initial_details['EMAIL']));
                                 $user_id = $user_request->response['payload'];
                                 if (!$user_id) {
                                     $user_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'addlogin', 'address' => $initial_details['EMAIL'], 'password' => time(), 'is_admin' => 0, 'display_name' => $initial_details['FIRSTNAME'] . ' ' . $initial_details['LASTNAME'], 'first_name' => $initial_details['FIRSTNAME'], 'last_name' => $initial_details['LASTNAME'], 'address_country' => $initial_details['COUNTRYCODE']));
                                     $user_id = $user_request->response['payload'];
                                 }
                                 // deal with physical quantities
                                 if ($order_details['physical'] == 1) {
                                     $order_items = json_decode($order_details['order_contents'], true);
                                     if (is_array($order_items)) {
                                         foreach ($order_items as $i) {
                                             if ($i['available_units'] > 0 && $i['physical_fulfillment'] == 1) {
                                                 $item = $this->getItem($i['id']);
                                                 if ($i['variant']) {
                                                     $variant_id = 0;
                                                     $variant_qty = 0;
                                                     if ($item['variants']) {
                                                         foreach ($item['variants']['quantities'] as $q) {
                                                             if ($q['key'] == $i['variant']) {
                                                                 $variant_id = $q['id'];
                                                                 $variant_qty = $q['value'];
                                                                 break;
                                                             }
                                                         }
                                                         if ($variant_id) {
                                                             $this->editItemVariant($variant_id, max($variant_qty - $i['qty'], 0), $i['id']);
                                                         }
                                                     }
                                                 } else {
                                                     $available_units = $this->editItem($i['id'], false, false, false, false, false, max($item['available_units'] - $i['qty'], 0));
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 // record all the details
                                 if ($order_details['digital'] == 1 && $order_details['physical'] == 0) {
                                     // if the order is 100% digital just mark it as fulfilled
                                     $is_fulfilled = 1;
                                 } else {
                                     // there's something physical. sorry dude. gotta deal with it still.
                                     $is_fulfilled = 0;
                                 }
                                 $this->editOrder($order_id, $is_fulfilled, 0, false, $initial_details['COUNTRYCODE'], $user_id);
                                 $this->editTransaction($order_details['transaction_id'], strtotime($final_details['TIMESTAMP']), $final_details['CORRELATIONID'], json_encode($initial_details), json_encode($final_details), 1, $final_details['PAYMENTINFO_0_AMT'], $final_details['PAYMENTINFO_0_FEEAMT'], 'complete');
                                 // empty the cart at this point
                                 $this->emptyCart($session_id);
                                 // TODO: add code to order metadata
                                 // bit of a hack, hard-wiring the email bits:
                                 try {
                                     $personalized_message = '';
                                     if ($order_details['element_id']) {
                                         $element_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getelement', 'id' => $order_details['element_id']));
                                         if ($element_request->response['payload']) {
                                             if (isset($element_request->response['payload']['options']['message_email'])) {
                                                 if ($element_request->response['payload']['options']['message_email']) {
                                                     $personalized_message = $element_request->response['payload']['options']['message_email'] . "\n\n";
                                                 }
                                             }
                                         }
                                     }
                                     if ($order_details['digital']) {
                                         $addcode_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'addlockcode', 'element_id' => $order_details['element_id']));
                                         if (!$finalize_url) {
                                             $finalize_url = CASHSystem::getCurrentURL();
                                         }
                                         CASHSystem::sendEmail('Thank you for your order', $order_details['user_id'], $initial_details['EMAIL'], $personalized_message . "Your order is complete. Here are some details:\n\n**Order #" . $order_details['id'] . "**  \n" . $initial_details['PAYMENTREQUEST_0_DESC'] . "  \n Total: " . CASHSystem::getCurrencySymbol($order_details['currency']) . number_format($final_details['PAYMENTINFO_0_AMT'], 2) . "\n\n" . "\n\n" . '[View your receipt and any downloads](' . $finalize_url . '?cash_request_type=element&cash_action=redeemcode&code=' . $addcode_request->response['payload'] . '&element_id=' . $order_details['element_id'] . '&email=' . urlencode($initial_details['EMAIL']) . '&order_id=' . $order_details['id'] . ')', 'Thank you.');
                                     } else {
                                         CASHSystem::sendEmail('Thank you for your order', $order_details['user_id'], $initial_details['EMAIL'], $personalized_message . "Your order is complete. Here are some details:\n\n**Order #" . $order_details['id'] . "**  \n" . $initial_details['PAYMENTREQUEST_0_DESC'] . "  \n Total: " . CASHSystem::getCurrencySymbol($order_details['currency']) . number_format($final_details['PAYMENTINFO_0_AMT'], 2) . "\n\n", 'Thank you.');
                                     }
                                 } catch (Exception $e) {
                                     // TODO: handle the case where an email can't be sent. maybe display the download
                                     //       code on-screen? that plus storing it with the order is probably enough
                                 }
                                 return $order_details['id'];
                             } else {
                                 // make sure this isn't an accidentally refreshed page
//.........这里部分代码省略.........
开发者ID:hubub,项目名称:platform,代码行数:101,代码来源:CommercePlant.php

示例5: number_format

                    if ($variant_response['payload']) {
                        $item['variant'] = $variant_response['payload'];
                    }
                }
            }
            if ($o['gross_price'] - $item_price) {
                $shipping_cost = CASHSystem::getCurrencySymbol($o['currency']) . number_format($o['gross_price'] - $item_price, 2);
                $item_price = CASHSystem::getCurrencySymbol($o['currency']) . number_format($item_price, 2);
            } else {
                $shipping_cost = false;
            }
            $customer_name = $o['customer_shipping_name'];
            if (!$customer_name) {
                $customer_name = $o['customer_name'];
            }
            $all_order_details[] = array('id' => $o['id'], 'customer_name' => $customer_name, 'customer_email' => $o['customer_email'], 'customer_address1' => $o['customer_address1'], 'customer_address2' => $o['customer_address2'], 'customer_city' => $o['customer_city'], 'customer_region' => $o['customer_region'], 'customer_postalcode' => $o['customer_postalcode'], 'customer_country' => $o['customer_country'], 'number' => '#' . str_pad($o['id'], 6, 0, STR_PAD_LEFT), 'date' => CASHSystem::formatTimeAgo((int) $order_date, true), 'order_description' => str_replace("\n", ' ', $o['order_description']), 'order_contents' => new ArrayIterator($order_contents), 'shipping' => $shipping_cost, 'itemtotal' => $item_price, 'gross' => CASHSystem::getCurrencySymbol($o['currency']) . number_format($o['gross_price'], 2), 'fulfilled' => $o['fulfilled'], 'notes' => $o['notes']);
        }
    }
    if (count($all_order_details) > 0) {
        if (count($all_order_details) > 10) {
            $cash_admin->page_data['show_pagination'] = true;
            $cash_admin->page_data['show_next'] = true;
            if ($cash_admin->page_data['show_previous']) {
                $cash_admin->page_data['show_nextandprevious'] = true;
            }
            array_pop($all_order_details);
        }
        $cash_admin->page_data['orders_recent'] = new ArrayIterator($all_order_details);
        $cash_admin->page_data['show_filters'] = true;
    }
}
开发者ID:jmcclenon,项目名称:platform,代码行数:31,代码来源:commerce.php

示例6: echoCurrencyOptions

 /**
  * MONIES
  *
  * @return array
  */
 public static function echoCurrencyOptions($selected = 'USD')
 {
     $currencies = CASHSystem::getCurrencySymbol('all');
     $all_options = '';
     $has_selected = false;
     foreach ($currencies as $currency => $symbol) {
         $all_options .= '<option value="' . $currency . '"';
         if (!$has_selected && $currency == $selected) {
             $all_options .= ' selected="selected"';
             $has_selected = true;
         }
         $all_options .= '>' . $currency . ' / ' . $symbol . '</option>';
     }
     return $all_options;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:20,代码来源:AdminHelper.php

示例7: getData


//.........这里部分代码省略.........
     }
     $cart_request = new CASHRequest(array('cash_request_type' => 'commerce', 'cash_action' => 'getcart', 'session_id' => $this->session_id));
     $cart = $cart_request->response['payload'];
     if ($cart) {
         if (is_array($cart)) {
             $checkcount = count($cart);
             if (isset($cart['shipto'])) {
                 $checkcount = $checkcount - 1;
             }
             if ($checkcount) {
                 $this->element_data['items_in_cart'] = true;
             }
         }
     } else {
         $cart = array();
     }
     $featured_items = array();
     $unfeatured_items = array();
     if (is_array($this->element_data['featured_items'])) {
         foreach ($this->element_data['featured_items'] as $i) {
             $featured_items[] = $indexed_items[$i['item_id']];
         }
     }
     if (is_array($this->element_data['additional_items'])) {
         foreach ($this->element_data['additional_items'] as $i) {
             $unfeatured_items[] = $indexed_items[$i['item_id']];
         }
     }
     $this->element_data['items'] = new ArrayIterator($unfeatured_items);
     $this->element_data['features'] = new ArrayIterator($featured_items);
     // get currency info for element owner
     $currency_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'use_currency', 'user_id' => $this->element_data['user_id']));
     if ($currency_request->response['payload']) {
         $this->element_data['currency'] = CASHSystem::getCurrencySymbol($currency_request->response['payload']);
     } else {
         $this->element_data['currency'] = CASHSystem::getCurrencySymbol('USD');
     }
     // get region information for element owner
     // now get the current setting
     $settings_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'regions', 'user_id' => $this->element_data['user_id']));
     if ($settings_request->response['payload']) {
         $this->element_data['region1'] = $settings_request->response['payload']['region1'];
         $this->element_data['region2'] = $settings_request->response['payload']['region2'];
     } else {
         $this->element_data['region1'] = 'US';
         $this->element_data['region2'] = 'International';
     }
     if ($this->status_uid == 'commerce_finalizepayment_200' || $this->status_uid == 'element_redeemcode_200') {
         if ($this->status_uid == 'commerce_finalizepayment_200') {
             $this->element_data['order_id'] = $this->original_response['payload'];
             $verified = true;
         } else {
             if ($this->status_uid == 'element_redeemcode_200') {
                 $this->element_data['order_id'] = $_GET['order_id'];
                 $verified = false;
             }
         }
         $order_request = new CASHRequest(array('cash_request_type' => 'commerce', 'cash_action' => 'getorder', 'id' => $this->element_data['order_id'], 'deep' => true));
         $order_details = $order_request->response['payload'];
         if ($order_details) {
             if ($this->status_uid == 'element_redeemcode_200') {
                 if ($_GET['email'] == $order_details['customer_details']['email_address']) {
                     $verified = true;
                 }
             }
             if ($verified) {
开发者ID:JamesLinus,项目名称:platform,代码行数:67,代码来源:Store.php


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