本文整理汇总了PHP中CFloat函数的典型用法代码示例。如果您正苦于以下问题:PHP CFloat函数的具体用法?PHP CFloat怎么用?PHP CFloat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CFloat函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetQuote
public function GetQuote()
{
// The following array will be returned to the calling function.
// It will contain at one ISC_SHIPPING_QUOTE object
$pi_quote = array();
// Workout the cost by multiplying peritemcost * numproducts
$num_items = 0;
foreach ($this->_products as $item) {
$num_items += $item->getquantity();
}
$price = $this->GetValue("peritemcost");
if (!$price) {
$price = 0;
}
$total = $num_items * $price;
// Create a quote object
$Error = false;
$this->_shippingcost = CFloat($total);
$pi_quote = new ISC_SHIPPING_QUOTE($this->GetId(), $this->getDisplayName(), $this->_shippingcost);
return $pi_quote;
}
示例2: ManageGroupDiscountGrid
//.........这里部分代码省略.........
/**
* Special global for naving ot a page when displaying an error
*/
if (isc_strtolower($type) == 'product' && isset($GLOBALS['pageNavToProduct'])) {
$page = $GLOBALS['pageNavToProduct'];
} else if (isc_strtolower($type) == 'category' && isset($GLOBALS['pageNavToCategory'])) {
$page = $GLOBALS['pageNavToCategory'];
}
if ($page == 1) {
$start = 1;
} else {
$start = ($page * ISC_GROUPDISCOUNT_ITEMS_PER_PAGE) - (ISC_GROUPDISCOUNT_ITEMS_PER_PAGE - 1);
}
$start = $start-1;
$numPages = ceil($total / ISC_GROUPDISCOUNT_ITEMS_PER_PAGE);
if ($total > ISC_GROUPDISCOUNT_ITEMS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf('(%s %d of %d) ', GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($total, ISC_GROUPDISCOUNT_ITEMS_PER_PAGE, $page, 'index.php?ToDo=viewCustomerGroupDiscounts&type=' . urlencode($type), 'getGroupDiscountDataBlock');
} else {
$GLOBALS['Nav'] = '';
}
$html = '';
foreach ($items as $item) {
$GLOBALS['DiscountMethodPercent'] = '';
$GLOBALS['DiscountMethodPrice'] = '';
$GLOBALS['DiscountMethodFixed'] = '';
if ($type == 'product') {
$GLOBALS['ProductId'] = (int)$item['discountid'];
$GLOBALS['CatOrProdId'] = (int)$item['catorprodid'];
if (isId($item['discountid'])) {
$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT prodname FROM [|PREFIX|]products WHERE productid=" . (int)$item['catorprodid']);
$prodname = $GLOBALS['ISC_CLASS_DB']->FetchOne($result, 'prodname');
}
if (!isId($item['discountid']) || $prodname == '') {
$item['catorprodid'] = '';
$GLOBALS['SelectedItemName'] = GetLang('NoneSelected');
} else {
$GLOBALS['SelectedItemName'] = isc_html_escape($prodname);
}
} else {
$GLOBALS['CategoryId'] = (int)$item['discountid'];
$GLOBALS['CategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions(array($item['catorprodid']), "<option %s value='%d'>%s</option>", "selected=\"selected\"", "", false);
$GLOBALS['DiscountCatTypeCat'] = '';
$GLOBALS['DiscountCatTypeCatAndSub'] = '';
if (isc_strtolower($item['appliesto']) == 'category_and_subcats') {
$GLOBALS['DiscountCatTypeCatAndSub'] = 'selected';
} else {
$GLOBALS['DiscountCatTypeCat'] = 'selected';
}
}
if ($item['discountmethod'] == 'percent') {
$GLOBALS['AmountPrefix'] = '';
$GLOBALS['AmountPostfix'] = '%';
$GLOBALS['DiscountMethodPercent'] = 'selected';
} else {
if ($item['discountmethod'] == 'fixed') {
$GLOBALS['DiscountMethodFixed'] = 'selected';
} else {
$GLOBALS['DiscountMethodPrice'] = 'selected';
}
if (GetConfig('CurrencyLocation') == 'right') {
$GLOBALS['AmountPrefix'] = '';
$GLOBALS['AmountPostfix'] = GetConfig('CurrencyToken');
} else {
$GLOBALS['AmountPrefix'] = GetConfig('CurrencyToken');
$GLOBALS['AmountPostfix'] = '';
}
}
if ((int)$item['discountpercent'] == $item['discountpercent']) {
$GLOBALS['DiscountAmount'] = (int)$item['discountpercent'];
} else {
$GLOBALS['DiscountAmount'] = CFloat($item['discountpercent']);
}
$html .= $this->template->render('Snippets/CustomerGroup'.ucfirst(isc_strtolower($type)).'Row.html');
}
if ($numPages <= 1) {
$GLOBALS['HidePagingNav'] = 'none';
} else {
$GLOBALS['HidePagingNav'] = '';
}
$GLOBALS['Type'] = isc_html_escape($type);
$GLOBALS['CustomerGroupDiscountGrid'] = $html;
return $this->template->render('customers.groups.discount.grid.tpl');
}
示例3: EditCustomerGroup
/**
* EditCustomerGroup
* Load up a customer group's details for editing. Why am I working on this at 11:10pm on a Saturday night?! - Mitch
*
* @return Void
*/
private function EditCustomerGroup($MsgDesc = "", $MsgStatus = "")
{
if (isset($_GET['groupId']) && is_numeric($_GET['groupId'])) {
$groupId = (int) $_GET['groupId'];
$query = sprintf("SELECT customergroupid, groupname, discount, discountmethod, categoryaccesstype, isdefault\n\t\t\t\t\t\t\t\t FROM [|PREFIX|]customer_groups\n\t\t\t\t\t\t\t\t WHERE customergroupid='%d'", $groupId);
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
if ($MsgDesc != "") {
$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
}
if (count($_POST) > 0) {
// Something went wrong, get the details from the form
$GLOBALS['GroupName'] = isc_html_escape($_POST['groupname']);
$GLOBALS['Discount'] = isc_html_escape($_POST['discount']);
$GLOBALS['StoreDiscountMethod'] = $_POST['storeDiscountMethod'];
if (isset($_POST['isdefault'])) {
$GLOBALS['IsDefault'] = "CHECKED='CHECKED'";
}
} else {
// Load the customer group's details from the database
$GLOBALS['GroupId'] = (int) $row['customergroupid'];
$GLOBALS['GroupName'] = isc_html_escape($row['groupname']);
if ($row['discount'] == (int) $row['discount']) {
$GLOBALS['Discount'] = (int) $row['discount'];
$GLOBALS['StoreDiscountMethod'] = $row['discountmethod'];
} else {
$GLOBALS['Discount'] = CFloat($row['discount']);
$GLOBALS['StoreDiscountMethod'] = 'price';
}
if ($row['isdefault'] == "1") {
$GLOBALS['IsDefault'] = "CHECKED='CHECKED'";
}
}
$access_cats = array();
if (isset($_POST['accesscategories']) || $row['categoryaccesstype'] == "all") {
$GLOBALS['AccessAllCategories'] = "CHECKED='CHECKED'";
$GLOBALS['HideAccessCategories'] = "none";
$GLOBALS['HideAccessCatLinks'] = "none";
} else {
if (isset($_POST['accesscategorieslist'])) {
$access_cats = $_POST['accesscategorieslist'];
} else {
//$access_cats = explode(",", $row['accesscategories']);
$query = "SELECT * FROM [|PREFIX|]customer_group_categories WHERE customergroupid = '" . $groupId . "'";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($category = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$access_cats[] = $category['categoryid'];
}
}
}
foreach ($access_cats as $k => $v) {
if (!is_numeric($v)) {
unset($access_cats[$k]);
}
}
// Reuse them for the categories which the group has access to and make them all selected by default
$GLOBALS['AccessCategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions($access_cats, "<option %s value='%d'>%s</option>", 'selected="selected"', "", false);
$GLOBALS['FormAction'] = "editCustomerGroup2";
$GLOBALS['Title'] = GetLang("EditACustomerGroup");
// Build the categories dropdown HTML
$GLOBALS['CategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions(array(), "<option %s value='%d'>%s</option>", "selected=\"selected\"", "", false);
// Setup the JavaScript for existing discounts (if any)
$GLOBALS['ExistingCategoryDiscounts'] = "";
$query = sprintf("SELECT discountpercent, catorprodid, appliesto, discounttype, discountmethod, p.prodname\n\t\t\t\t\t\t\t\t\t FROM [|PREFIX|]customer_group_discounts\n\t\t\t\t\t\t\t\t\t LEFT JOIN [|PREFIX|]products p\n\t\t\t\t\t\t\t\t\t ON p.productid=catorprodid\n\t\t\t\t\t\t\t\t\t WHERE customergroupid='%d'\n\t\t\t\t\t\t\t\t\t ORDER BY discounttype ASC, groupdiscountid ASC", $groupId);
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
// Is the discount an integrate or decimal?
if ((int) $row['discountpercent'] == $row['discountpercent']) {
// It's an integer
$discount = (int) $row['discountpercent'];
} else {
// It's a decimal such as 7.50
$discount = CFloat($row['discountpercent']);
}
if ($row['discounttype'] == "CATEGORY") {
// It's a category discount
$GLOBALS['ExistingCategoryDiscounts'] .= sprintf("AddCatRule(%d, '%s', '%s', '%s');\n", $row['catorprodid'], $discount, $row['appliesto'], $row['discountmethod']);
} else {
// It's a product discount
$GLOBALS['ExistingCategoryDiscounts'] .= sprintf("AddProdRule(%d, '%s', '%s', '%s');\n", $row['catorprodid'], str_replace("'", "\\'", $row['prodname']), $discount, $row['discountmethod']);
}
}
$GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("customers.group.form");
$GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
} else {
$this->ManageCustomerGroups();
}
} else {
$this->ManageCustomerGroups();
}
}
示例4: CopyProductStep1
public function CopyProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost = false, $OriginalProductID = 0)
{
if ($MsgDesc != "") {
$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
}
// Show the form to edit a product
if (isset($_REQUEST['productId']) && isId($_REQUEST['productId'])) {
$OriginalProductID = $_REQUEST['productId'];
}
$prodId = $OriginalProductID;
$z = 0;
$arrData = array();
$arrImages = array();
$arrCustomFields = array();
if (GetConfig('CurrencyLocation') == 'right') {
$GLOBALS['CurrencyTokenLeft'] = '';
$GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
} else {
$GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
$GLOBALS['CurrencyTokenRight'] = '';
}
$GLOBALS['ServerFiles'] = $this->_GetImportFilesOptions();
$GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY');
// Make sure the product exists
if (ProductExists($prodId)) {
if ($PreservePost == true) {
$this->_GetProductData(0, $arrData);
$this->_GetCustomFieldData(0, $arrCustomFields);
$GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout(0, true);
// Restore the hash
$GLOBALS['ProductHash'] = $arrData['prodhash'];
} else {
$this->_GetProductData($prodId, $arrData);
$this->_GetCustomFieldData($prodId, $arrCustomFields);
$GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout($prodId, true);
// Generate the hash
$GLOBALS['ProductHash'] = md5(time() . uniqid(rand(), true));
// We'll need to duplicate (copy) the thumbnail, images and download files here
$this->_CopyProductImages($prodId, 0, $GLOBALS['ProductHash']);
$this->_CopyDownloads($prodId, 0, $GLOBALS['ProductHash']);
$arrData['prodname'] = GetLang('CopyOf') . $arrData['prodname'];
}
// Does this user have permission to edit this product?
if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['prodvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewProducts');
}
$arrImages = $this->_GetImageData(0, $GLOBALS['ProductHash']);
if (isset($_POST['currentTab'])) {
$GLOBALS['CurrentTab'] = (int) $_POST['currentTab'];
} else {
$GLOBALS['CurrentTab'] = 0;
}
$GLOBALS['FormAction'] = 'copyProduct2';
$GLOBALS['Title'] = GetLang('CopyProductTitle');
$GLOBALS['Intro'] = GetLang('CopyProductIntro');
$GLOBALS["ProdType_" . $arrData['prodtype']] = 'checked="checked"';
$GLOBALS['ProdType'] = $arrData['prodtype'] - 1;
$GLOBALS['ProdCode'] = isc_html_escape($arrData['prodcode']);
$GLOBALS['ProdName'] = isc_html_escape($arrData['prodname']);
$GLOBALS['OriginalProductId'] = $OriginalProductID;
$visibleCategories = array();
if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
$vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
if ($vendorData['vendoraccesscats']) {
$visibleCategories = explode(',', $vendorData['vendoraccesscats']);
}
}
// $GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions($arrData['prodcats'], "<option %s value='%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories);
$GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptionsProduct($arrData['prodcats'], "<option %s value='%d' id='category_old%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories);
$GLOBALS['RelatedCategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions(0, "<option %s value='%d'>%s</option>", "selected='selected'", "- ", false);
//blessen
$wysiwygOptions = array('id' => 'wysiwyg', 'width' => '60%', 'height' => '350px', 'value' => $arrData['proddesc']);
$wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodmfg']);
$wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodwarranty']);
$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);
$GLOBALS['WYSIWYG1'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions1);
$GLOBALS['WYSIWYG2'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions2);
$GLOBALS['ProdSearchKeywords'] = isc_html_escape($arrData['prodsearchkeywords']);
$GLOBALS['ProdAvailability'] = isc_html_escape($arrData['prodavailability']);
$GLOBALS['ProdPrice'] = number_format($arrData['prodprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
if (CFloat($arrData['prodcostprice']) > 0) {
$GLOBALS['ProdCostPrice'] = number_format($arrData['prodcostprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
}
if (CFloat($arrData['prodretailprice']) > 0) {
$GLOBALS['ProdRetailPrice'] = number_format($arrData['prodretailprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
}
if (CFloat($arrData['prodsaleprice']) > 0) {
$GLOBALS['ProdSalePrice'] = number_format($arrData['prodsaleprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
}
$GLOBALS['ProdSortOrder'] = $arrData['prodsortorder'];
if ($arrData['prodvisible'] == 1) {
$GLOBALS['ProdVisible'] = "checked";
}
if ($arrData['prodfeatured'] == 1) {
$GLOBALS['ProdFeatured'] = "checked";
}
if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
$GLOBALS['HideStoreFeatured'] = 'display: none';
} else {
if (!gzte11(ISC_HUGEPRINT) || !$arrData['prodvendorid']) {
//.........这里部分代码省略.........
示例5: CPrice
function CPrice($Val)
{
$val = CFloat($Val);
$val = number_format($val, GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), GetConfig('ThousandsToken'));
return $val;
}
示例6: UpdateStoreCredit
/**
* Update the store credit for a customer
*
* @return void
**/
private function UpdateStoreCredit()
{
if (!isset($_REQUEST['customerId'])) {
exit;
}
$query = sprintf("SELECT customerid, custstorecredit FROM [|PREFIX|]customers WHERE customerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['customerId']));
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$customer = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
if ($customer['customerid'] == 0) {
exit;
}
$updatedCustomer = array("custstorecredit" => DefaultPriceFormat($_REQUEST['credit']));
$GLOBALS['ISC_CLASS_DB']->UpdateQuery("customers", $updatedCustomer, "customerid='" . $GLOBALS['ISC_CLASS_DB']->Quote($customer['customerid']) . "'");
// Log the credit change
$creditChange = CFloat($_REQUEST['credit'] - $customer['custstorecredit']);
if ($creditChange != 0) {
$creditLog = array("customerid" => (int) $customer['customerid'], "creditamount" => $creditChange, "credittype" => "adjustment", "creditdate" => time(), "creditrefid" => 0, "credituserid" => $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUserId(), "creditreason" => "");
$GLOBALS['ISC_CLASS_DB']->InsertQuery("customer_credits", $creditLog);
}
echo 1;
exit;
}
示例7: _GetCouponData
private function _GetCouponData($CouponId = 0, &$RefArray)
{
if ($CouponId == 0) {
$RefArray['couponid'] = 0;
$RefArray['coupontype'] = $_POST['coupontype'];
$RefArray['couponamount'] = (int) $_POST['couponamount'];
$RefArray['couponminpurchase'] = CFloat($_POST['couponminpurchase']);
$RefArray['couponmaxuses'] = (int) $_POST['couponmaxuses'];
if ($_POST['couponexpires'] != "") {
$RefArray['couponexpires'] = ConvertDateToTime($_POST['couponexpires']);
} else {
$RefArray['couponexpires'] = 0;
}
if (isset($_POST['couponenabled'])) {
$RefArray['couponenabled'] = 1;
} else {
$RefArray['couponenabled'] = 0;
}
if (isset($_POST['couponcode']) && $_POST['couponcode'] != "") {
$RefArray['couponcode'] = $_POST['couponcode'];
} else {
$RefArray['couponcode'] = GenerateCouponCode();
}
} else {
// Get the data for this coupon code from the database
$query = sprintf("select * from [|PREFIX|]coupons where couponid='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($CouponId));
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
$RefArray = $row;
}
}
}
示例8: CopyProductStep1
public function CopyProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost=false, $OriginalProductID=0)
{
if ($MsgDesc != "") {
$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
}
// Show the form to edit a product
if (isset($_REQUEST['productId']) && isId($_REQUEST['productId'])) {
$OriginalProductID = $_REQUEST['productId'];
}
$prodId = $OriginalProductID;
$z = 0;
$arrData = array();
$arrCustomFields = array();
if (GetConfig('CurrencyLocation') == 'right') {
$GLOBALS['CurrencyTokenLeft'] = '';
$GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
} else {
$GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
$GLOBALS['CurrencyTokenRight'] = '';
}
$GLOBALS['ServerFiles'] = $this->_GetImportFilesOptions();
$GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY');
// Make sure the product exists
if (ProductExists($prodId)) {
if($PreservePost == true) {
$this->_GetProductData(0, $arrData);
$this->_GetCustomFieldData(0, $arrCustomFields);
$GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout(0, true);
// Restore the hash
$GLOBALS['ProductHash'] = $arrData['prodhash'];
} else {
$this->_GetProductData($prodId, $arrData);
$this->_GetCustomFieldData($prodId, $arrCustomFields);
$GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout($prodId, true);
// Generate the hash
$GLOBALS['ProductHash'] = md5(time().uniqid(rand(), true));
// We'll need to duplicate (copy) the thumbnail, images and download files here
$this->_CopyDownloads($prodId, 0, $GLOBALS['ProductHash']);
$productImages = ISC_PRODUCT_IMAGE::copyImagesToProductHash($prodId, $GLOBALS['ProductHash']);
$this->setupProductImageGlobals($productImages);
$arrData['prodname'] = GetLang('CopyOf') . $arrData['prodname'];
}
$this->template->assign('product', $arrData);
// Does this user have permission to edit this product?
if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['prodvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewProducts');
}
if(isset($_POST['currentTab'])) {
$GLOBALS['CurrentTab'] = (int)$_POST['currentTab'];
}
else {
$GLOBALS['CurrentTab'] = 0;
}
$GLOBALS['FormAction'] = 'copyProduct2';
$GLOBALS['Title'] = GetLang('CopyProductTitle');
$GLOBALS['Intro'] = GetLang('CopyProductIntro');
$GLOBALS["ProdType_" . $arrData['prodtype']] = 'checked="checked"';
$GLOBALS['ProdType'] = $arrData['prodtype'] - 1;
$GLOBALS['ProdCode'] = isc_html_escape($arrData['prodcode']);
$GLOBALS['ProdName'] = isc_html_escape($arrData['prodname']);
$GLOBALS['OriginalProductId'] = $OriginalProductID;
$visibleCategories = array();
if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
$vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
if($vendorData['vendoraccesscats']) {
$visibleCategories = explode(',', $vendorData['vendoraccesscats']);
}
}
$GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions($arrData['prodcats'], "<option %s value='%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories);
$GLOBALS['RelatedCategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions(0, "<option %s value='%d'>%s</option>", "selected='selected'", "- ", false);
$wysiwygOptions = array(
'id' => 'wysiwyg',
'width' => '100%',
'height' => '500px',
'value' => $arrData['proddesc']
);
$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);
$GLOBALS['ProdSearchKeywords'] = isc_html_escape($arrData['prodsearchkeywords']);
$GLOBALS['ProdAvailability'] = isc_html_escape($arrData['prodavailability']);
$GLOBALS['ProdPrice'] = number_format($arrData['prodprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
if (CFloat($arrData['prodcostprice']) > 0) {
//.........这里部分代码省略.........
示例9: _GetCouponData
protected function _GetCouponData($CouponId = 0, &$RefArray = array())
{
if ($CouponId == 0) {
$RefArray['couponid'] = (int)$_POST['couponId'];
$RefArray['couponname'] = $_POST['couponname'];
$RefArray['coupontype'] = $_POST['coupontype'];
$RefArray['couponamount'] = (int)$_POST['couponamount'];
$RefArray['couponminpurchase'] = CFloat($_POST['couponminpurchase']);
$RefArray['couponmaxuses'] = (int)$_POST['couponmaxuses'];
$RefArray['couponmaxusespercus'] = 0;
if (isset($_POST['couponmaxusespercus'])) {
$RefArray['couponmaxusespercus'] = (int)$_POST['couponmaxusespercus'];
}
if ($_POST['couponexpires'] != "") {
$RefArray['couponexpires'] = ConvertDateToTime($_POST['couponexpires']);
} else {
$RefArray['couponexpires'] = 0;
}
if (isset($_POST['couponenabled'])) {
$RefArray['couponenabled'] = 1;
} else {
$RefArray['couponenabled'] = 0;
}
if (isset($_POST['couponcode']) && $_POST['couponcode'] != "") {
$RefArray['couponcode'] = $_POST['couponcode'];
} else {
$RefArray['couponcode'] = GenerateCouponCode();
}
$RefArray['couponappliesto'] = $_POST['usedfor'];
if ($_POST['usedfor'] == "categories") {
$RefArray['couponappliestovalues'] = $_POST['catids'];
}
else {
$RefArray['couponappliestovalues'] = $_POST['prodids'];
}
// Restore data of shipping location restriction.
$RefArray['location_restricted'] = 0;
$RefArray['restrictedLocations'] = array();
$RefArray['restrictedLocationType'] = '';
if (!empty ($_POST['YesLimitByLocation']) && !empty ($_POST['LocationType'])) {
$RefArray['location_restricted'] = 1;
if (!empty ($_POST['LocationType'])) {
$RefArray['restrictedLocationType'] = $_POST['LocationType'];
if ($RefArray['restrictedLocationType'] == 'country'
&& !empty ($_POST['LocationTypeCountries'])
&& is_array($_POST['LocationTypeCountries'])) {
$countryList = GetCountryListAsIdValuePairs();
foreach ($_POST['LocationTypeCountries'] as $countryId) {
if(empty ($countryList[$countryId])) {
continue;
}
$RefArray['restrictedLocations'][] = array(
'coupon_id' => (int)$_POST['couponId'],
'selected_type' => $RefArray['restrictedLocationType'],
'value_id' => (int)$countryId,
'value' => $countryList[$countryId],
'country_id' => 0,
);
}
}
else if($RefArray['restrictedLocationType'] == 'state' && !empty ($_POST['LocationTypeStatesSelect'])) {
$countryList = GetCountryListAsIdValuePairs();
$stateList = array();
foreach($_POST['LocationTypeStatesSelect'] as $stateRecord) {
$state = explode('-', $stateRecord, 2);
if(!isset($stateList[$state[0]])) {
// Load the states in this country as we haven't done that before
$stateList[$state[0]] = array();
$query = "SELECT * FROM [|PREFIX|]country_states WHERE statecountry='".(int)$state[0]."'";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while($stateResult = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$stateList[$stateResult['statecountry']][$stateResult['stateid']] = $stateResult['statename'];
}
}
// Start storing what we received
if(isset($stateList[$state[0]][$state[1]])) {
$stateName = $stateList[$state[0]][$state[1]];
}
else {
$stateName = '';
}
$RefArray['restrictedLocations'][] = array(
'coupon_id' => (int)$_POST['couponId'],
'selected_type' => $RefArray['restrictedLocationType'],
'value' => $stateName,
'value_id' => (int)$state[1],
'country_id' => (int)$state[0],
);
}
}
else if($RefArray['restrictedLocationType'] == 'zip' && !empty ($_POST['LocationTypeZipPostCodes'])) {
$zipCodes = explode("\n", $_POST['LocationTypeZipPostCodes']);
foreach($zipCodes as $zipCode) {
$zipCode = trim($zipCode);
//.........这里部分代码省略.........