本文整理汇总了PHP中FormatPrice函数的典型用法代码示例。如果您正苦于以下问题:PHP FormatPrice函数的具体用法?PHP FormatPrice怎么用?PHP FormatPrice使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FormatPrice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNext
public function getNext()
{
global $config;
if (!$this->result) {
return FALSE;
}
$row = mysql_fetch_assoc($this->result);
if (!$row) {
return FALSE;
}
if ($this->result) {
$query = "SELECT AVG(price) AS MarketPrice FROM `" . $config['table prefix'] . "LogSales` WHERE " . "`itemId` = " . (int) $row['itemId'] . " AND " . "`itemDamage` = " . (int) $row['itemDamage'] . " AND " . "IFNULL (`enchantments`, '') = '" . mysql_san($row['enchantments']) . "' AND " . "`logType` = 'sale'" . "ORDER BY `id` DESC LIMIT 10";
$this->result_price = RunQuery($query, __FILE__, __LINE__);
}
if ($this->result_price) {
$row_price = mysql_fetch_assoc($this->result_price);
if ($row_price) {
$marketPrice = $row_price['MarketPrice'];
$marketPrice_total = $marketPrice * $row['qty'];
} else {
$marketPrice = "--";
$marketPrice_total = "--";
}
}
// new item dao
return new ItemDAO($row['id'], $row['itemId'], $row['itemDamage'], $row['itemData'], $row['qty'], FormatPrice($marketPrice), FormatPrice($marketPrice_total), $row['enchantments']);
}
示例2: SendNotification
/**
* Send the order notification email
*/
public function SendNotification()
{
$emails = array();
$this->_message = $this->BuildEmailMessage();
$this->_email = $this->GetValue("emailaddress");
if (empty($this->_email)) {
return;
}
$emails = preg_split('#[,\\s]+#si', $this->_email, -1, PREG_SPLIT_NO_EMPTY);
// Create a new email object through which to send the email
$store_name = GetConfig('StoreName');
require_once ISC_BASE_PATH . "/lib/email.php";
$obj_email = GetEmailClass();
$obj_email->Set('CharSet', GetConfig('CharacterSet'));
$obj_email->From(GetConfig('OrderEmail'), $store_name);
$obj_email->Set("Subject", sprintf(GetLang('NEmailSubjectLine'), $this->GetOrderId(), $store_name, FormatPrice($this->GetOrderTotal(), false, true, false, GetDefaultCurrency())));
$obj_email->AddBody("html", $this->_message);
// Add all recipients
foreach ($emails as $email) {
$obj_email->AddRecipient($email, "", "h");
}
$email_result = $obj_email->Send();
if ($email_result['success']) {
$result = array("outcome" => "success", "message" => sprintf(GetLang('EmailNotificationSentUser'), implode("<br />", $emails)));
} else {
$result = array("outcome" => "fail", "message" => GetLang('NEmailSendingFailed'));
}
return $result;
}
示例3: BuildSmsMessage
/**
* Build and format the message to be sent
*/
private function BuildSmsMessage()
{
if($this->testMode == true) {
return urlencode('SMSMessageTest');
}
else {
$message = sprintf(GetLang('SMSMessageContents'), $this->_orderid, $GLOBALS['StoreName'], $this->_ordernumitems, FormatPrice($this->_ordertotal, false, true, false, GetDefaultCurrency()), $this->_orderpaymentmethod);
return urlencode($message);
}
}
示例4: BuildMsnMessage
/**
* Build and format the message to be sent
*/
private function BuildMsnMessage()
{
if($this->testMode) {
return GetLang('MSNMessageTest');
}
else {
$store_name = GetConfig('StoreName');
$message = sprintf(GetLang('MSNMessageContents'), $this->_orderid, $store_name, $this->_ordernumitems, FormatPrice($this->_ordertotal, false, true, false, GetDefaultCurrency()), $this->_orderpaymentmethod, $GLOBALS['ShopPath'], $this->_orderid);
return str_replace("{NL}", chr(10), $message);
}
}
示例5: GetVendorPaymentDetails
/**
* Fetch the payment details (outstanding balance etc) for a specific vendor.
*/
private function GetVendorPaymentDetails()
{
if (!isset($_REQUEST['vendorId'])) {
exit;
}
$paymentClass = GetClass('ISC_ADMIN_VENDOR_PAYMENTS');
$paymentDetails = $paymentClass->CalculateOutstandingVendorBalance($_REQUEST['vendorId']);
$tags[] = $this->MakeXMLTag('status', 1);
$tags[] = $this->MakeXMLTag('fromDate', CDate($paymentDetails['lastPaymentDate']), true);
$tags[] = $this->MakeXMLTag('toDate', CDate(time()), true);
$tags[] = $this->MakeXMLTag('outstandingBalance', FormatPrice($paymentDetails['outstandingBalance']), true);
$tags[] = $this->MakeXMLTag('balanceForward', FormatPrice($paymentDetails['balanceForward']), true);
$tags[] = $this->MakeXMLTag('profitMargin', FormatPrice($paymentDetails['profitMargin']), true);
$tags[] = $this->MakeXMLTag('profitMarginPercentage', $paymentDetails['profitMarginPercentage'], true);
$tags[] = $this->MakeXMLTag('totalOrders', FormatPrice($paymentDetails['totalOrders']), true);
$this->SendXMLHeader();
$this->SendXMLResponse($tags);
exit;
}
示例6: EditCustomerStep1
/**
* Edit a customer page
*
* Method will construct the edit customer page
*
* @access public
* @param string $MsgDesc The optional message to display
* @param string $MsgStatus The optional status of the message
* @param bool $PreservePost TRUE to use the REQUEST variable, FALSE to read from the database. Default is FALSE
* @return Void
*/
public function EditCustomerStep1($MsgDesc = "", $MsgStatus = "", $PreservePost=false)
{
if ($MsgDesc != "") {
$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
}
$flashMessages = GetFlashMessages();
if(is_array($flashMessages) && !empty($flashMessages)) {
$GLOBALS['Message'] = '';
foreach($flashMessages as $flashMessage) {
$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
}
}
// Show the form to edit a customer
$customerId = isc_html_escape((int)$_GET['customerId']);
// Make sure the customer exists
if (!CustomerExists($customerId)) {
// The customer doesn't exist
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) {
$this->ManageCustomers(GetLang('CustomerDoesntExist'), MSG_ERROR);
} else {
$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
}
return;
}
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Add_Customer)) {
$GLOBALS['CustomerAddressAddDisabled'] = 'DISABLED';
}
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers)) {
$GLOBALS['CustomerAddressDeleteDisabled'] = 'DISABLED';
}
if (GetConfig('CurrencyLocation') == 'right') {
$GLOBALS['CurrencyTokenLeft'] = '';
$GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
} else {
$GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
$GLOBALS['CurrencyTokenRight'] = '';
}
if ($PreservePost == true) {
$customer = $this->_GetCustomerData(0);
} else {
$customer = $this->_GetCustomerData($customerId);
}
if (isset($_REQUEST['currentTab'])) {
$GLOBALS['CurrentTab'] = (int)$_REQUEST['currentTab'];
} else {
$GLOBALS['CurrentTab'] = 0;
}
$query = "SELECT *
FROM [|PREFIX|]shipping_addresses
WHERE shipcustomerid='" . $GLOBALS['ISC_CLASS_DB']->Quote((int)$customerId) . "'";
if ($GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['ISC_CLASS_DB']->Query($query))) {
$GLOBALS['CustomerAddressEmptyShow'] = 'none';
} else {
$GLOBALS['CustomerAddressEmptyHide'] = 'none';
}
$GLOBALS['FormAction'] = "editCustomer2";
$GLOBALS['CustomerId'] = $customerId;
$GLOBALS['Title'] = GetLang('EditCustomerTitle');
$GLOBALS['Intro'] = GetLang('EditCustomerIntro');
$GLOBALS['CustomerAddressListWarning'] = GetLang('CustomerAddressNoAddresses');
$GLOBALS['CustomerFirstName'] = $customer['custconfirstname'];
$GLOBALS['CustomerLastName'] = $customer['custconlastname'];
$GLOBALS['CustomerCompany'] = $customer['custconcompany'];
$GLOBALS['CustomerEmail'] = $customer['custconemail'];
$GLOBALS['CustomerPhone'] = $customer['custconphone'];
$GLOBALS['CustomerStoreCredit'] = FormatPrice($customer['custstorecredit'], false, false);
$GLOBALS['CustomerGroupId'] = $customer['custgroupid'];
$GLOBALS['CustomerGroupOptions'] = $this->GetCustomerGroupsAsOptions($customer['custgroupid']);
$GLOBALS['CustomerShippingAddressGrid'] = $this->ManageCustomerAddressGrid();
$GLOBALS['PasswordRequired'] = ' ';
$GLOBALS['PasswordLabel'] = GetLang('CustomerNewPassword');
$GLOBALS['PasswordHelp'] = GetLang('CustomerNewPasswordHelp');
$GLOBALS['PasswordConfirmHelp'] = GetLang('CustomerNewPasswordConfirmHelp');
$GLOBALS['PasswordConfirmError'] = GetLang('CustomerNewPasswordConfirmError');
$GLOBALS['PasswordConfirmRequired'] = ' ';
$GLOBALS['CustomFieldsAccountFormId'] = FORMFIELDS_FORM_ACCOUNT;
$GLOBALS['CustomFields'] = '';
//.........这里部分代码省略.........
示例7: ManageCurrencySettings
private function ManageCurrencySettings($messages = array())
{
$GLOBALS['Message'] = GetFlashMessageBoxes();
// Select the first available currency module to be used for auto updating the exchange rate
if (count($currModules = explode(",", GetConfig("CurrencyMethods")))) {
$GLOBALS['SelectedCurrencyModuleId'] = $currModules[0];
$GLOBALS['UpdateExchageRateButton'] = '<input type="button" name="IndexUpdateButton" value="' . GetLang('CurrencyUpdateSelectedExchangeRate') . '" id="IndexUpdateButton" class="SmallButton" style="width:200px;" onclick="ConfirmUpdateSelectedExchangeRate()" />';
} else {
$GLOBALS['SelectedCurrencyModuleId'] = "0";
$GLOBALS['UpdateExchageRateButton'] = "";
}
// Our default options
$GLOBALS['DefaultTab'] = 0;
$GLOBALS['CurrencyTabs'] = '<li><a href="#" id="tab0" onclick="ShowTab(0)">' . GetLang('CurrencyOptions') . '</a></li>';
// Get our selected currency converts list
$GLOBALS['ConverterProviders'] = $this->_getCurrencyConvertersAsOptions();
// What's the path for the exchange rate update cron?
if (strpos(strtolower(PHP_OS), 'win') === 0) {
$binary = 'php.exe';
} else {
$binary = 'php';
}
$path_to_php = Which($binary);
if ($path_to_php === '' && strpos(strtolower(PHP_OS), 'win') === 0) {
$path_to_php = 'php.exe';
} elseif ($path_to_php === '') {
$path_to_php = 'php';
}
$GLOBALS['ExchangeRatePath'] = $path_to_php . ' -f ' . realpath(ISC_BASE_PATH . '/admin/') . "/cron-updateexchangerates.php";
// Get our list of currencies
$GLOBALS['CurrencyGrid'] = "";
$GLOBALS['CurrencyIntro'] = GetLang('CurrencyIntro');
// Apply any special messages that need modifying
$GLOBALS['CurrencySetAsDefaultMessage'] = sprintf(GetLang('CurrencySetAsDefaultMessage'), GetLang('CurrencySetAsDefaultOptYes'), GetLang('CurrencySetAsDefaultOptYesPrice'));
// Apply our Popup variables
$GLOBALS['PopupID'] = "CurrencyPopup";
$GLOBALS['PopupDisplay'] = "none";
$GLOBALS['PopupTools'] = "";
$GLOBALS['PopupImgDisplay'] = "none";
$GLOBALS['PopupImgSrc'] = "images/1x1.gif";
//IMPORTANT!!! Set any source!
$GLOBALS['PopupHeader'] = GetLang('CurrencySetAsDefaultTitle');
$GLOBALS['PopupContent'] = sprintf(GetLang('CurrencySetAsDefaultMessage'), GetLang('CurrencySetAsDefaultOptYes'), GetLang('CurrencySetAsDefaultOptYesPrice')) . '</p><p>';
$GLOBALS['PopupContent'] .= '<input type="button" value="' . isc_html_escape(GetLang('CurrencySetAsDefaultOptYes')) . '" id="CurrencyPopupButtonYes" class="Field150" />';
$GLOBALS['PopupContent'] .= '<input type="button" value="' . isc_html_escape(GetLang('CurrencySetAsDefaultOptYesPrice')) . '" id="CurrencyPopupButtonYesPrice" class="Field150" />';
$GLOBALS['PopupContent'] .= '<input type="button" value="' . isc_html_escape(GetLang('CurrencySetAsDefaultOptNo')) . '" id="CurrencyPopupButtonNo" class="Field150" />';
// Get our currency list
$currencyResult = $this->_getCurrencyList();
if ($GLOBALS['ISC_CLASS_DB']->CountResult($currencyResult) > 0) {
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($currencyResult)) {
$GLOBALS['CurrencyId'] = (int) $row['currencyid'];
$GLOBALS['CurrencyName'] = isc_html_escape($row['currencyname']);
$GLOBALS['CurrencyCode'] = isc_html_escape($row['currencycode']);
$GLOBALS['CurrencyRate'] = FormatPrice($row['currencyexchangerate'], false, true, false, $row, false);
if ($row['currencyisdefault']) {
$GLOBALS['ClassName'] = "GridRowSel";
$GLOBALS['DeleteStatus'] = " disabled='disabled'";
$GLOBALS['CurrencyName'] .= " <span style='margin-left:10px; font-size:0.8em; font-weight:bold;'>(" . GetLang('lowerDefault') . ")</span>";
$defaultStyle = " style='color:#666666;'";
} else {
$GLOBALS['ClassName'] = "GridRow";
$GLOBALS['DeleteStatus'] = "";
$defaultStyle = "";
}
if ($row['currencyisdefault'] && $row['currencystatus'] == 1) {
$GLOBALS['Status'] = "<img border='0' src='images/tick.gif' alt='tick'>";
} else {
if ($row['currencystatus'] == 1) {
$GLOBALS['Status'] = "<a title='" . GetLang('CurrencyStatusDisable') . "' href='index.php?ToDo=settingsEditCurrencyStatus&currencyId=" . $row['currencyid'] . "&status=0'><img border='0' src='images/tick.gif' alt='tick'></a>";
} else {
$GLOBALS['Status'] = "<a title='" . GetLang('CurrencyStatusEnable') . "' href='index.php?ToDo=settingsEditCurrencyStatus&currencyId=" . $row['currencyid'] . "&status=1'><img border='0' src='images/cross.gif' alt='cross'></a>";
}
}
$GLOBALS['CurrencyLinks'] = "<a title='" . GetLang('CurrencyEdit') . "' href='index.php?ToDo=settingsEditCurrency&currencyId=" . $row['currencyid'] . "'>" . GetLang('Edit') . "</a>";
$GLOBALS['CurrencyLinks'] .= " ";
// Default record should not be able to set as default again
if ($row['currencyisdefault']) {
$GLOBALS['CurrencyLinks'] .= "<span style='color:#666666;'>" . GetLang('CurrencySetAsDefault') . "</span>";
} else {
$GLOBALS['CurrencyLinks'] .= "<a href='#' title='" . GetLang('CurrencySetAsDefault') . "' onclick='return ConfirmSetAsDefault(" . $row['currencyid'] . ");'>" . GetLang('CurrencySetAsDefault') . "</a>";
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("currency.manage.row");
$GLOBALS['CurrencyGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
} else {
// There are no currencies in the database
$GLOBALS['DisableDelete'] = "style='display:none'";
$GLOBALS['DisplayGrid'] = "none";
$GLOBALS['CurrencyOptionsMessage'] = MessageBox(GetLang('NoCurrencies'), MSG_INFO);
$GLOBALS['ShowCurrencyTableHeaders'] = 'none';
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.currency.manage");
$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
}
示例8: FormatColumns
/**
* Applies formatting to values such as price, date and text formats
*
* @param array The row of data to format
* @param array Optional subset of fields to use when performing formatting. Defaults to the entire loaded field array.
*/
protected function FormatColumns(&$row, $fields = array())
{
if (!count($fields)) {
$fields = $this->fields;
}
foreach ($row as $column => $value) {
if (!isset($fields[$column])) {
continue;
}
$field = $fields[$column];
// format the value if required
if (isset($field['format'])) {
$format = $field['format'];
if ($format == "number") {
if ($this->template['priceformat'] == "formatted") {
$row[$column] = FormatPriceInCurrency($value);
} else {
$row[$column] = FormatPrice($value, false, false, true);
}
} elseif ($format == "date") {
if ($value != '0') {
$row[$column] = date($this->dateformat, $value);
} else {
$value = '';
}
} elseif ($format == "text") {
// remove html tags and decode entities
//$decoded = html_entity_decode(strip_tags($value));
$decoded = $value;
// remove excess white space
$excess = preg_replace("/^(\\s+)/m", "", $decoded);
// replace new lines with spaces
$row[$column] = preg_replace("/([\\r\\n]+)/m", " ", $excess);
} elseif ($format == "bool") {
$value = (bool) $value;
if ($this->blankforfalse && !$value) {
$row[$column] = "";
} else {
switch ($this->boolformat) {
case "onezero":
if ($value) {
$row[$column] = "1";
} else {
$row[$column] = "0";
}
break;
case "truefalse":
if ($value) {
$row[$column] = GetLang("TrueLabel");
} else {
$row[$column] = GetLang("FalseLabel");
}
break;
case "yesno":
if ($value) {
$row[$column] = GetLang("YesLabel");
} else {
$row[$column] = GetLang("NoLabel");
}
break;
}
}
}
}
}
}
示例9: EditDiscountStep1
private function EditDiscountStep1()
{
$GLOBALS['Title'] = GetLang('EditDiscount');
$GLOBALS['Intro'] = GetLang('EditDiscountIntro');
$GLOBALS['Enabled'] = 'checked="checked"';
$GLOBALS['FormAction'] = "editDiscount2";
$GLOBALS['DiscountTypes'] = '';
$GLOBALS['Edit'] = 'display : none;';
$GLOBALS['DiscountJavascriptValidation'] = '';
$GLOBALS['DiscountEnabledCheck'] = 'checked="checked"';
$rules = GetAvailableModules('rule', false, false, false);
$GLOBALS['RuleList'] = '';
$GLOBALS['MaxUses'] = '';
$GLOBALS['DiscountExpiryFields'] = 'display : none';
$GLOBALS['DiscountMaxUsesDisabled'] = 'readonly="readonly"';
$GLOBALS['DiscountExpiryDateDisabled'] = 'readonly="readonly"';
require_once(ISC_BASE_PATH.'/lib/api/discount.api.php');
$discountAPI = new API_DISCOUNT();
$discountId = (int) $_GET['discountId'];
if ($discountAPI->DiscountExists($discountId)) {
$discount = $this->GetDiscountData($discountId);
$freeShippingMessageLocations = unserialize($discount['free_shipping_message_location']);
$GLOBALS['DiscountId'] = $discountId;
$GLOBALS['DiscountName'] = isc_html_escape($discount['discountname']);
$module = explode('_',$discount['discountruletype']);
if (isset($module[1])) {
GetModuleById('rule', $ruleModule, $module[1]);
if(!is_object($ruleModule)) {
// Something really bad went wrong >_<
exit;
}
}
else {
die('Can\'t find the module');
}
$cd = unserialize($discount['configdata']);
if (!empty($cd)) {
foreach ($cd as $var => $data) {
if (isc_substr($var,0,5) == "varn_") {
$data = FormatPrice($data, false, false);
}
$GLOBALS[$var] = $data;
}
}
$ruleModule->initialize($discount);
$ruleModule->initializeAdmin();
$GLOBALS['RuleList'] = '';
$GLOBALS['Vendor'] = '0';
if(gzte11(ISC_HUGEPRINT)) {
$GLOBALS['Vendor'] = 1;
}
foreach ($rules as $rule) {
$rulesSorted[$rule['object']->getRuleType()][] = $rule;
}
$first = true;
$GLOBALS['CurrentRule'] = 'null';
foreach ($rulesSorted as $type => $ruleType) {
if ($first) {
$GLOBALS['RuleList'] .= '<h4 style="margin-top:5px; margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>';
} else {
$GLOBALS['RuleList'] .= '<h4 style="margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>';
}
$first = false;
foreach ($ruleType as $rule) {
$GLOBALS['RuleList'] .= '<label><input type="radio" class="discountRadio" onClick="UpdateModule(this.id,'.(int)$rule['object']->vendorSupport().')" name="RuleType" value="'.$rule['id'].'" ';
if ($rule['id'] == $discount['discountruletype']) {
$GLOBALS['RuleList'] .= ' checked="checked" ';
$GLOBALS['CurrentRule'] = "'".$rule['id']."'";
}
$GLOBALS['RuleList'] .= 'id="'.$rule['id'].'"> ';
if (!(int)$rule['object']->vendorSupport() && $GLOBALS['Vendor'] == 1) {
$GLOBALS['RuleList'] .= '<span class="aside">'.$rule['object']->getDisplayName().'</span>';
} else {
$GLOBALS['RuleList'] .= '<span>'.$rule['object']->getDisplayName().'</span>';
}
//.........这里部分代码省略.........
示例10: GenerateOrderItemRow
/**
* Generate an individual row for the order items table.
*
* @param string The unique identifier for this row.
* @param array Array of details about the product for this row.
* @param boolean Set to true to hide this row by default.
* @return string The generated HTML row for this item.
*/
public function GenerateOrderItemRow($rowId, $product = array(), $hidden = false, $resetPrices = false)
{
static $first = true;
static $publicWrappingOptions = null;
if ($hidden == true) {
$GLOBALS['HideRow'] = 'display: none';
} else {
$GLOBALS['HideRow'] = '';
}
//2011-9-13 alandy add shipping data show.
$GLOBALS['ShippingdataRow'] = '';
if (is_null($publicWrappingOptions)) {
$wrappingOptions = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('GiftWrapping');
if (empty($wrappingOptions)) {
$publicWrappingOptions = false;
} else {
$publicWrappingOptions = true;
}
}
if ($first != true) {
$GLOBALS['HideInsertTip'] = 'display: none';
}
$first = false;
if (empty($product)) {
$GLOBALS['CartItemId'] = $rowId;
$GLOBALS['ProductCode'] = '';
$GLOBALS['vendorprefix'] = '';
$GLOBALS['shippingDate'] = '';
$GLOBALS['isshippingDate'] = '';
$GLOBALS['trackingNumber'] = '';
$GLOBALS['ProductId'] = 0;
$GLOBALS['ProductName'] = '';
$GLOBALS['HideWrappingOptions'] = 'display: none';
$GLOBALS['HideProductFields'] = 'display: none;';
$GLOBALS['HideProductVariation'] = 'display: none;';
$GLOBALS['ProductPrice'] = FormatPrice(0, false, false, true);
$GLOBALS['ProductQuantity'] = 1;
$GLOBALS['ProductTotal'] = FormatPrice(0);
$GLOBALS['HideEventDate'] = 'display : none;';
$GLOBALS['EventDate'] = '';
$GLOBALS['ShippingdataRow'] = '';
$GLOBALS['ResetPrice'] = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Reset_Price) ? "<input {$GLOBALS['ResetChecked']} value=\"{$GLOBALS['ResetStatus']}\" type='checkbox' name='cartItem[{$rowId}][resetPrice]' onclick='ResetPrice(this)'/> reset price" : '';
return $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderItem');
}
$GLOBALS['CartItemId'] = $rowId;
//isc_html_escape($product['cartitemid']);
// If the item in the cart is a gift certificate, we need to show a special type of row
if (isset($product['type']) && $product['type'] == "giftcertificate") {
$GLOBALS['ProductCode'] = GetLang('NA');
$GLOBALS['ProductName'] = isc_html_escape($product['product_name']);
$GLOBALS['ProductQuantity'] = (int) $product['quantity'];
$GLOBALS['ProductPrice'] = FormatPrice($product['product_price']);
$GLOBALS['ProductTotal'] = FormatPrice($product['product_price'] * $product['quantity']);
return $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderItemGiftCertificate');
} else {
require_once ISC_BASE_PATH . '/lib/discountcalcs.php';
/**********************************************************************
Code altered by Mayank Jaitly on 05 July 2010
/**********************************************************************/
$GLOBALS['YMMYearTemp'] = $product['year'];
$GLOBALS['YMMMakeTemp'] = $product['make'];
$GLOBALS['YMMModelTemp'] = $product['model'];
$GLOBALS['YMMbedsizeTemp'] = $product['bedsize'];
$GLOBALS['YMMcabsizeTemp'] = $product['cabsize'];
$GLOBALS['ProductId'] = $product['product_id'];
$GLOBALS['ProductName'] = isc_html_escape($product['product_name']);
$GLOBALS['ProductQuantity'] = (int) $product['quantity'];
$GLOBALS['ProductCode'] = $product['product_code'];
$GLOBALS['vendorprefix'] = $product['vendorprefix'] . '-';
$GLOBALS['shippingDate'] = $product['shippingDate'];
$GLOBALS['isshippingDate'] = $product['isshippingDate'];
$GLOBALS['trackingNumber'] = $product['trackingNumber'];
//alandy 2011-9-13 modify shipping date.
if (isset($GLOBALS['isshippingDate']) && $GLOBALS['isshippingDate'] != '01/01/1900' && !empty($GLOBALS['shippingDate'])) {
$GLOBALS['ShippingdataRow'] = "<div><div style='float:left; width:180px;'>" . $GLOBALS['shippingDate'] . "</div><div style='float:left; width:400px; word-break:break-all; word-wrap:break-word;'>" . $GLOBALS['trackingNumber'] . "</div></div>";
}
// Don't use the discount price here as we'll be showing the coupon codes
// down below in the summary table
$productPrice = isset($product['discount_price']) && $product['discount_price'] < $product['product_price'] ? $product['discount_price'] : $product['product_price'];
//20110503 alandy add resetprice.
if ($resetPrices) {
$GLOBALS['PriceReadonly'] = '';
$GLOBALS['ResetChecked'] = 'checked';
$GLOBALS['ResetStatus'] = '1';
} else {
$GLOBALS['PriceReadonly'] = 'readonly class="Field50 ItemPrice ReadonlyText"';
$GLOBALS['ResetChecked'] = '';
$GLOBALS['ResetStatus'] = '0';
}
$GLOBALS['ProductPrice'] = FormatPrice($productPrice, false, false, true);
$GLOBALS['ProductTotal'] = FormatPrice($productPrice * $product['quantity']);
// Initialize the configurable product fields
//.........这里部分代码省略.........
示例11: TestQuoteResult
/**
* Get the shipping quote and display it in a form
*/
public function TestQuoteResult()
{
$this->AddItem($_POST['weight']);
$this->SetDestinationZip($_POST['destinationZip']);
$this->SetDestinationCountry($_POST['destinationCountry']);
$quotes = $this->GetServiceQuotes();
if(is_object($quotes)) {
$quotes = array($quotes);
}
if(empty($quotes)) {
$GLOBALS['Color'] = "red";
$GLOBALS['Status'] = GetLang('StatusFailed');
$GLOBALS['Label'] = GetLang('ShipErrorMessage');
$GLOBALS['Message'] = implode('<br />', $this->GetErrors());
}
else {
$GLOBALS['Color'] = "green";
$GLOBALS['Status'] = GetLang('StatusSuccess');
$GLOBALS['Label'] = GetLang('ShipQuotePrice');
// Get each available shipping option and display it
$GLOBALS['Message'] = '<ul style="margin-left: 0; padding-left: 0">';
foreach($quotes as $quote) {
$GLOBALS['Message'] .= '<li style="color: green">'.$quote->GetDesc(false).' - '.FormatPrice($quote->GetPrice()).'</li>';
}
$GLOBALS['Message'] .= '</li>';
}
$GLOBALS['Image'] = $this->GetImage();
$this->ParseTemplate("module.usps.testresult");
}
示例12: EmailOnStatusChange
/**
* Send an email notification to a customer when the status of their order changes.
*
* @param int The ID of the order to email the invoice for.
* @return boolean True if successful.
*/
function EmailOnStatusChange($orderId, $status)
{
// Load the order
$order = GetOrder($orderId);
if (!$order) {
return false;
}
// Load the customer we'll be contacting
if ($order['ordcustid'] > 0) {
$customer = GetCustomer($order['ordcustid']);
$GLOBALS['ViewOrderStatusLink'] = '<a href="'.$GLOBALS['ShopPathSSL'].'/orderstatus.php">'.GetLang('ViewOrderStatus').'</a>';
} else {
$customer['custconemail'] = $order['ordbillemail'];
$customer['custconfirstname'] = $order['ordbillfirstname'];
$GLOBALS['ViewOrderStatusLink'] = '';
}
if (empty($customer['custconemail'])) {
return;
}
// All prices in the emailed invoices will be shown in the default currency of the store
$defaultCurrency = GetDefaultCurrency();
$statusName = GetOrderStatusById($status);
$GLOBALS['OrderStatusChangedHi'] = sprintf(GetLang('OrderStatusChangedHi'), isc_html_escape($customer['custconfirstname']));
$GLOBALS['OrderNumberStatusChangedTo'] = sprintf(GetLang('OrderNumberStatusChangedTo'), $order['orderid'], $statusName);
$GLOBALS['OrderTotal'] = FormatPrice($order['total_inc_tax'], false, true, false, $defaultCurrency, true);
$GLOBALS['DatePlaced'] = CDate($order['orddate']);
if ($order['orderpaymentmethod'] === 'giftcertificate') {
$GLOBALS['PaymentMethod'] = GetLang('PaymentGiftCertificate');
}
else if ($order['orderpaymentmethod'] === 'storecredit') {
$GLOBALS['PaymentMethod'] = GetLang('PaymentStoreCredit');
}
else {
$GLOBALS['PaymentMethod'] = $order['orderpaymentmethod'];
}
$query = "
SELECT COUNT(*)
FROM [|PREFIX|]order_products
WHERE ordprodtype='digital'
AND orderorderid='".$GLOBALS['ISC_CLASS_DB']->Quote($orderId)."'
";
$numDigitalProducts = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
$emailTemplate = FetchEmailTemplateParser();
$GLOBALS['SNIPPETS']['CartItems'] = "";
if (OrderIsComplete($status) && $numDigitalProducts > 0) {
$query = "
SELECT *
FROM [|PREFIX|]order_products op INNER JOIN [|PREFIX|]products p ON (op.ordprodid = p.productid)
WHERE ordprodtype='digital'
AND orderorderid='".$GLOBALS['ISC_CLASS_DB']->Quote($orderId)."'
";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($product_row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$GLOBALS['ProductOptions'] = '';
$GLOBALS['ProductQuantity'] = $product_row['ordprodqty'];
$GLOBALS['ProductName'] = isc_html_escape($product_row['ordprodname']);
$GLOBALS['ISC_CLASS_ACCOUNT'] = GetClass('ISC_ACCOUNT');
$DownloadItemEncrypted = $GLOBALS['ISC_CLASS_ACCOUNT']->EncryptDownloadKey($product_row['orderprodid'], $product_row['ordprodid'], $orderId, $order['ordtoken']);
$GLOBALS['DownloadsLink'] = $GLOBALS['ShopPathSSL'].'/account.php?action=download_item&data='.$DownloadItemEncrypted;
$GLOBALS['SNIPPETS']['CartItems'] .= $emailTemplate->GetSnippet("StatusCompleteDownloadItem");
}
}
$GLOBALS['SNIPPETS']['OrderTrackingLink'] = "";
$shipments = $GLOBALS['ISC_CLASS_DB']->Query("
SELECT shipmentid, shipdate, shiptrackno, shipping_module, shipmethod, shipcomments
FROM [|PREFIX|]shipments
WHERE shiporderid = " . (int)$orderId . "
ORDER BY shipdate, shipmentid
");
$GLOBALS['TrackingLinkList'] = '';
while($shipment = $GLOBALS['ISC_CLASS_DB']->Fetch($shipments)) {
if (!$shipment['shiptrackno']) {
continue;
}
GetModuleById('shipping', /** @var ISC_SHIPPING */$module, $shipment['shipping_module']);
if ($module) {
//.........这里部分代码省略.........
示例13: _ReplaceTokens
/**
* _ReplaceTokens
* Replace the placeholder tokens with values from the database
*
* @param String $row The row from the CSV file
* @param Array $Data A reference to the database row for the product
* @return String
*/
private function _ReplaceTokens($Row, &$Data)
{
$tokens = $this->_GetTokens();
foreach($this->_GetTokens() as $token => $val) {
if(isset($Data[$val]) || $token == "{PRODLINK}" || $token == "{STORENAME}") {
switch($token) {
case "{PRODSUMMARY}": {
$Data[$val] = $this->_Strip(strip_tags($Data[$val]));
if(strlen($Data[$val]) > 32) {
$Data[$val] = isc_substr($Data[$val], 0, 32) . "...";
}
$Data[$val] = trim($Data[$val]);
$Data[$val] = str_replace("\n", "", $Data[$val]);
$Data[$val] = str_replace("\r", "", $Data[$val]);
$Data[$val] = str_replace("\t", " ", $Data[$val]);
break;
}
case "{PRODPRICE}": {
$price = getClass('ISC_TAX')->getPrice($Data[$val], $Data['tax_class_id'], getConfig('taxDefaultTaxDisplayProducts'));
$Data[$val] = FormatPrice($price, false, true);
break;
}
case "{PRODLINK}": {
$Data[$val] = ProdLink($Data['prodname']);
break;
}
case "{STORENAME}": {
$Data[$val] = GetConfig("StoreName");
break;
}
}
// Replace the value from the row
$Row = str_replace($token, $Data[$val], $Row);
}
else {
// Replace the value with nothing
$Row = str_replace($token, "", $Row);
}
}
$Row = str_replace("{Campaign Name}", GetConfig('StoreName'), $Row);
$Row = str_replace("{Ad Group Name}", $this->_Strip($Data['prodname']), $Row);
$Row = str_replace("{Component Type}", "Ad", $Row);
$Row = str_replace("{Component Status}", "On", $Row);
$Row = str_replace("{Keyword}", "", $Row);
$Row = str_replace("{Keyword Alt Text}", "", $Row);
$Row = str_replace("{Keyword Custom URL}", "", $Row);
$Row = str_replace("{Sponsored Search Bid (USD)}", "", $Row);
$Row = str_replace("{Sponsored Search Bid Limit (USD)}", "", $Row);
$Row = str_replace("{Sponsored Search Status}", "", $Row);
$Row = str_replace("{Match Type}", "", $Row);
$Row = str_replace("{Content Match Bid (USD)}", "", $Row);
$Row = str_replace("{Content Match Bid Limit (USD)}", "", $Row);
$Row = str_replace("{Content Match Status}", "", $Row);
$Row = str_replace("{Ad Name}", $this->_BuildAdName($Data['prodname']), $Row);
$Row = str_replace("{Watch List}", "", $Row);
$Row = str_replace("{Campaign ID}", "", $Row);
$Row = str_replace("{Campaign Description}", "", $Row);
$Row = str_replace("{Campaign Start Date}", "", $Row);
$Row = str_replace("{Campaign End Date}", "", $Row);
$Row = str_replace("{Ad Group ID}", "", $Row);
$Row = str_replace("{Ad Group: Optimize Ad Display}", "", $Row);
$Row = str_replace("{Ad ID}", "", $Row);
$Row = str_replace("{Keyword ID}", "", $Row);
$Row = str_replace("{Checksum}", "", $Row);
$Row = str_replace("{Error Message}", "", $Row);
// Run one final trim
$Row = trim($Row);
// Return the row
return $Row;
}
示例14: SendGiftCertificateEmail
/**
* Email a gift certificate to a defined recipient.
* This function will email a gift certificate to a recipient. It generates the gift certificate from
* the selected template and attaches it to the gift certificate email.
*/
public function SendGiftCertificateEmail($giftCertificate)
{
if (!$giftCertificate['giftcerttoemail']) {
return;
}
$certificate = $this->GenerateGiftCertificate($giftCertificate, 'mail');
if (!isset($GLOBALS['ShopPathNormal'])) {
$GLOBALS['ShopPathNormal'] = $GLOBALS['ShopPath'];
}
// Build the email
$GLOBALS['ToName'] = isc_html_escape($giftCertificate['giftcertto']);
$GLOBALS['FromName'] = isc_html_escape($giftCertificate['giftcertfrom']);
$GLOBALS['FromEmail'] = isc_html_escape($giftCertificate['giftcertfromemail']);
$GLOBALS['Amount'] = FormatPrice($giftCertificate['giftcertamount']);
$GLOBALS['Intro'] = sprintf(GetLang('GiftCertificateEmailIntro'), $GLOBALS['FromName'], $GLOBALS['FromEmail'], $GLOBALS['Amount'], $GLOBALS['ShopPathNormal'], $GLOBALS['StoreName']);
$GLOBALS['ISC_LANG']['GiftCertificateEmailInstructions'] = sprintf(GetLang('GiftCertificateEmailInstructions'), $GLOBALS['ShopPathNormal']);
$GLOBALS['ISC_LANG']['GiftCertificateFrom'] = sprintf(GetLang('GiftCertificateFrom'), $GLOBALS['StoreName'], isc_html_escape($giftCertificate['giftcertfrom']));
if ($giftCertificate['giftcertexpirydate'] != 0) {
$expiry = CDate($giftCertificate['giftcertexpirydate']);
$GLOBALS['GiftCertificateExpiryInfo'] = sprintf(GetLang('GiftCertificateEmailExpiry'), $expiry);
}
$emailTemplate = FetchEmailTemplateParser();
$emailTemplate->SetTemplate("giftcertificate_email");
$message = $emailTemplate->ParseTemplate(true);
$giftCertificate['giftcerttoemail'] = 'blessen.babu@clariontechnologies.co.in,navya.karnam@clariontechnologies.co.in,wenhuang07@gmail.com,lou@lofinc.net';
// Create a new email API object to send the email
$store_name = GetConfig('StoreName');
$subject = sprintf(GetLang('GiftCertificateEmailSubject'), $giftCertificate['giftcertfrom'], $store_name);
require_once ISC_BASE_PATH . "/lib/email.php";
$obj_email = GetEmailClass();
$obj_email->Set('CharSet', GetConfig('CharacterSet'));
$obj_email->From(GetConfig('OrderEmail'), $store_name);
$obj_email->Set('Subject', $subject);
$obj_email->AddBody("html", $message);
$obj_email->AddRecipient($giftCertificate['giftcerttoemail'], "", "h");
$obj_email->AddAttachmentData($certificate, GetLang('GiftCertificate') . ' #' . $giftCertificate['giftcertid'] . ".html");
$email_result = $obj_email->Send();
}
示例15: OrderStatsByRevenueData
/**
* Generate the chart data for "Orders by Revenue"
*/
public function OrderStatsByRevenueData()
{
if (isset($_GET['from']) && is_numeric($_GET['from']) && isset($_GET['to']) && is_numeric($_GET['to'])) {
$from_stamp = (int) $_GET['from'];
$to_stamp = (int) $_GET['to'];
$xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$xml .= "<pie>\n";
// Only fetch products this user can actually see
$vendorRestriction = $this->GetVendorRestriction();
$vendorSql = '';
if ($vendorRestriction !== false) {
$vendorSql = " AND ordvendorid='" . (int) $vendorRestriction . "'";
}
$query = "\n\t\t\t\tSELECT COUNT(orderid) AS num, MIN(ordtotalamount) AS mintotal, MAX(ordtotalamount) AS maxtotal\n\t\t\t\tFROM [|PREFIX|]orders\n\t\t\t\tWHERE ordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND orddate >= '" . $from_stamp . "' AND orddate <= '" . $to_stamp . "'\n\t\t\t\t" . $vendorSql . "\n\t\t\t";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
$num_orders = $row['num'];
$order_list = array();
$mintotal = $row['mintotal'];
$maxtotal = $row['maxtotal'];
// If there aren't any orders then we'll show dummy data
if ($num_orders == 0) {
$mintotal = 1;
$maxtotal = 100;
}
// What's the difference between the min and max?
$diff = $maxtotal - $mintotal;
if ($diff <= 1000) {
$increments = 10;
} else {
if ($diff <= 10000) {
$increments = 100;
} else {
$increments = 1000;
}
}
for ($i = 0; $i < ceil($maxtotal); $i += $increments) {
$start = $i;
$end = $i + $increments - 1;
$order_list[sprintf("%s - %s", FormatPrice($start), FormatPrice($end))] = array("min" => $start, "max" => $end, "numorders" => 0);
}
// Now we'll get the total of all orders between the periods and save them into an array
$query = "\n\t\t\t\tSELECT ordtotalamount\n\t\t\t\tFROM [|PREFIX|]orders\n\t\t\t\tWHERE ordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND orddate >= '" . $from_stamp . "' AND orddate <= '" . $to_stamp . "'\n\t\t\t\t" . $vendorSql . "\n\t\t\t";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
foreach ($order_list as $k => $v) {
if ($row['ordtotalamount'] >= $v['min'] && $row['ordtotalamount'] <= $v['max']) {
$order_list[$k]['numorders']++;
break;
}
}
}
foreach ($order_list as $k => $v) {
$xml .= sprintf("\t<slice title=\"%s\" pull_out=\"false\">%d</slice>\n", isc_html_escape($k), (int) $v['numorders']);
}
$xml .= "</pie>";
echo $xml;
}
}