本文整理汇总了PHP中fmod_round函数的典型用法代码示例。如果您正苦于以下问题:PHP fmod_round函数的具体用法?PHP fmod_round怎么用?PHP fmod_round使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fmod_round函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: while
<?php
// Split Page
// reset page when page is unknown
if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['bID'] != '') {
$banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added, banners_open_new_windows, banners_on_ssl, banners_sort_order from " . TABLE_BANNERS . " order by banners_title, banners_group";
$check_page = $db->Execute($banners_query_raw);
$check_count = 1;
if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
while (!$check_page->EOF) {
if ($check_page->fields['banners_id'] == $_GET['bID']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round($check_count / MAX_DISPLAY_SEARCH_RESULTS + (fmod_round($check_count, MAX_DISPLAY_SEARCH_RESULTS) != 0 ? 0.5 : 0), 0);
} else {
$_GET['page'] = 1;
}
}
$banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added, banners_open_new_windows, banners_on_ssl, banners_sort_order from " . TABLE_BANNERS . " order by banners_title, banners_group";
$banners_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows);
$banners = $db->Execute($banners_query_raw);
while (!$banners->EOF) {
$info = $db->Execute("select sum(banners_shown) as banners_shown,\n sum(banners_clicked) as banners_clicked\n from " . TABLE_BANNERS_HISTORY . "\n where banners_id = '" . (int) $banners->fields['banners_id'] . "'");
if ((!isset($_GET['bID']) || isset($_GET['bID']) && $_GET['bID'] == $banners->fields['banners_id']) && !isset($bInfo) && substr($action, 0, 3) != 'new') {
$bInfo_array = array_merge($banners->fields, $info->fields);
$bInfo = new objectInfo($bInfo_array);
}
$banners_shown = $info->fields['banners_shown'] != '' ? $info->fields['banners_shown'] : '0';
$banners_clicked = $info->fields['banners_clicked'] != '' ? $info->fields['banners_clicked'] : '0';
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:31,代码来源:banner_manager.php
示例2: while
}
// Split Page
// reset page when page is unknown
if (($_GET['page'] == '1' or $_GET['page'] == '') and $_GET['pID'] != '') {
$old_page = $_GET['page'];
$check_page = $db->Execute($products_query_raw);
if ($check_page->RecordCount() > MAX_DISPLAY_RESULTS_CATEGORIES) {
$check_count = 1;
while (!$check_page->EOF) {
if ($check_page->fields['products_id'] == $_GET['pID']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round($check_count / MAX_DISPLAY_RESULTS_CATEGORIES + (fmod_round($check_count, MAX_DISPLAY_RESULTS_CATEGORIES) != 0 ? 0.5 : 0), 0);
$page = $_GET['page'];
if ($old_page != $_GET['page']) {
// zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
}
} else {
$_GET['page'] = 1;
}
}
$products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_RESULTS_CATEGORIES, $products_query_raw, $products_query_numrows);
$products = $db->Execute($products_query_raw);
// Split Page
while (!$products->EOF) {
$products_count++;
$rows++;
// Get categories_id for product if search
开发者ID:ygeneration666,项目名称:ec,代码行数:31,代码来源:category_product_listing.php
示例3: get_products
//.........这里部分代码省略.........
if ($check_for_valid_cart == true) {
$fix_once = 0;
// Check products_status if not already
$check_status = $products->fields['products_status'];
if ($check_status == 0) {
$fix_once++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
$this->remove($products_id);
} else {
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
$chkcount = 0;
while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
$chkcount++;
$chk_attributes_exist_query = "select products_id\n from " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n where pa.products_id = '" . (int) $products_id . "'\n and pa.options_values_id = '" . (int) $value . "'";
$chk_attributes_exist = $db->Execute($chk_attributes_exist_query);
//echo 'what is it: ' . ' : ' . $products_id . ' - ' . $value . ' records: ' . $chk_attributes_exist->RecordCount() . ' vs ' . print_r($this->contents[$products_id]) . '<br>';
if ($chk_attributes_exist->EOF) {
$fix_once++;
$_SESSION['valid_to_checkout'] = false;
$chk_product_attributes = $db->Execute("SELECT products_status FROM " . TABLE_PRODUCTS . " WHERE products_status = 1 and products_id = '" . $products->fields["products_id"] . "' limit 1");
if (!$chk_product_attributes->EOF && $chk_product_attributes->fields['products_status'] == 1) {
$chk_products_link = '<a href="' . zen_href_link(zen_get_info_page($products->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($products->fields["master_categories_id"]) . '&products_id=' . $products->fields["products_id"]) . '">' . $products->fields['products_name'] . '</a>';
} else {
$chk_products_link = $products->fields['products_name'];
}
$_SESSION['cart_errors'] .= ERROR_PRODUCT_ATTRIBUTES . $chk_products_link . ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES . '<br />';
$this->remove($products_id);
break;
}
}
}
}
// check only if valid products_status
if ($fix_once == 0) {
$check_quantity = $this->contents[$products_id]['qty'];
$check_quantity_min = $products->fields['products_quantity_order_min'];
// Check quantity min
if ($new_check_quantity = $this->in_cart_mixed($prid)) {
$check_quantity = $new_check_quantity;
}
}
// Check Quantity Max if not already an error on Minimum
if ($fix_once == 0) {
if ($products->fields['products_quantity_order_max'] != 0 && $check_quantity > $products->fields['products_quantity_order_max']) {
$fix_once++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MAX_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
}
}
if ($fix_once == 0) {
if ($check_quantity < $check_quantity_min) {
$fix_once++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
}
}
// Check Quantity Units if not already an error on Quantity Minimum
if ($fix_once == 0) {
$check_units = $products->fields['products_quantity_order_units'];
if (fmod_round($check_quantity, $check_units) != 0) {
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
}
}
// Verify Valid Attributes
}
//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
// convert quantity to proper decimals
if (QUANTITY_DECIMALS != 0) {
// $new_qty = round($new_qty, QUANTITY_DECIMALS);
$fix_qty = $this->contents[$products_id]['qty'];
switch (true) {
case !strstr($fix_qty, '.'):
$new_qty = $fix_qty;
break;
default:
$new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
break;
}
} else {
$new_qty = $this->contents[$products_id]['qty'];
}
$check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
if (strstr($check_unit_decimals, '.')) {
$new_qty = round($new_qty, QUANTITY_DECIMALS);
} else {
$new_qty = round($new_qty, 0);
}
//@@TODO - should be okay to remove
if (false && $new_qty == (int) $new_qty) {
$new_qty = (int) $new_qty;
}
$products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from'], 'products_virtual' => $products->fields['products_virtual'], 'product_is_always_free_shipping' => $products->fields['product_is_always_free_shipping']);
}
}
$this->notify('NOTIFIER_CART_GET_PRODUCTS_END', array(), $products_array);
return $products_array;
}
开发者ID:jeking928,项目名称:Dual-Pricing-2.1.6,代码行数:101,代码来源:shopping_cart.php
示例4: while
$featured_query_raw = "select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_priced_by_attribute, f.featured_id, f.featured_date_added, f.featured_last_modified, f.expires_date, f.date_status_change, f.status, f.featured_date_available from " . TABLE_PRODUCTS . " p, " . TABLE_FEATURED . " f, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_id = f.products_id" . $search . $order_by;
// Split Page
// reset page when page is unknown
if (($_GET['page'] == '1' or $_GET['page'] == '') and $_GET['fID'] != '') {
$old_page = $_GET['page'];
$check_page = $db->Execute($featured_query_raw);
if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) {
$check_count = 1;
while (!$check_page->EOF) {
if ($check_page->fields['featured_id'] == $_GET['fID']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round($check_count / MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN + (fmod_round($check_count, MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) != 0 ? 0.5 : 0), 0);
$page = $_GET['page'];
if ($old_page != $_GET['page']) {
// do nothing
}
} else {
$_GET['page'] = 1;
}
}
// create split page control
$featured_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN, $featured_query_raw, $featured_query_numrows);
$featured = $db->Execute($featured_query_raw);
while (!$featured->EOF) {
if ((!isset($_GET['fID']) || isset($_GET['fID']) && $_GET['fID'] == $featured->fields['featured_id']) && !isset($fInfo)) {
$products = $db->Execute("select products_image\n from " . TABLE_PRODUCTS . "\n where products_id = '" . (int) $featured->fields['products_id'] . "'");
$fInfo_array = array_merge($featured->fields, $products->fields);
开发者ID:zenmagick,项目名称:zencart,代码行数:31,代码来源:featured.php
示例5: zen_get_buy_now_qty
function zen_get_buy_now_qty($product_id)
{
global $cart;
$check_min = zen_get_products_quantity_order_min($product_id);
$check_units = zen_get_products_quantity_order_units($product_id);
$buy_now_qty = 1;
// works on Mixed ON
switch (true) {
case $_SESSION['cart']->in_cart_mixed($product_id) == 0:
if ($check_min >= $check_units) {
$buy_now_qty = $check_min;
} else {
$buy_now_qty = $check_units;
}
break;
case $_SESSION['cart']->in_cart_mixed($product_id) < $check_min:
$buy_now_qty = $check_min - $_SESSION['cart']->in_cart_mixed($product_id);
break;
case $_SESSION['cart']->in_cart_mixed($product_id) > $check_min:
// set to units or difference in units to balance cart
$new_units = $check_units - fmod_round($_SESSION['cart']->in_cart_mixed($product_id), $check_units);
//echo 'Cart: ' . $_SESSION['cart']->in_cart_mixed($product_id) . ' Min: ' . $check_min . ' Units: ' . $check_units . ' fmod: ' . fmod($_SESSION['cart']->in_cart_mixed($product_id), $check_units) . '<br />';
$buy_now_qty = $new_units > 0 ? $new_units : $check_units;
break;
default:
$buy_now_qty = $check_units;
break;
}
if ($buy_now_qty <= 0) {
$buy_now_qty = 1;
}
return $buy_now_qty;
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:33,代码来源:functions_prices.php
示例6: get_products
//.........这里部分代码省略.........
$fix_once = 0;
// Check products_status if not already
$check_status = $products->fields['products_status'];
if ($check_status == 0) {
$fix_once++;
$this->setSessionVar('valid_to_checkout', false);
$cart_errors = $this->getSessionVar('cart_errors');
$cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
$this->setSessionVar('cart_errors', $cart_errors);
$this->remove($products_id);
} else {
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
$chkcount = 0;
while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
$chkcount++;
$chk_attributes_exist_query = "select products_id\n from %table.products_attributes% pa\n where pa.products_id = '" . (int) $products_id . "'\n and pa.options_values_id = '" . (int) $value . "'";
$chk_attributes_exist = $this->getDb()->Execute($chk_attributes_exist_query);
if ($chk_attributes_exist->EOF) {
$fix_once++;
$this->setSessionVar('valid_to_checkout', false);
$cart_errors = $this->getSessionVar('cart_errors');
$cart_errors .= ERROR_PRODUCT_ATTRIBUTES . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES . '<br />';
$this->setSessionVar('cart_errors', $cart_errors);
$this->remove($products_id);
break;
}
}
}
}
// check only if valid products_status
if ($fix_once == 0) {
$check_quantity = $this->contents[$products_id]['qty'];
$check_quantity_min = $products->fields['products_quantity_order_min'];
// Check quantity min
if ($new_check_quantity = $this->in_cart_mixed($prid)) {
$check_quantity = $new_check_quantity;
}
}
// Check Quantity Max if not already an error on Minimum
if ($fix_once == 0) {
if ($products->fields['products_quantity_order_max'] != 0 && $check_quantity > $products->fields['products_quantity_order_max']) {
$fix_once++;
$this->setSessionVar('valid_to_checkout', false);
$cart_errors = $this->getSessionVar('cart_errors');
$cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MAX_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
$this->setSessionVar('cart_errors', $cart_errors);
}
}
if ($fix_once == 0) {
if ($check_quantity < $check_quantity_min) {
$fix_once++;
$this->setSessionVar('valid_to_checkout', false);
$cart_errors = $this->getSessionVar('cart_errors');
$cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
$this->setSessionVar('cart_errors', $cart_errors);
}
}
// Check Quantity Units if not already an error on Quantity Minimum
if ($fix_once == 0) {
$check_units = $products->fields['products_quantity_order_units'];
if (fmod_round($check_quantity, $check_units) != 0) {
$this->setSessionVar('valid_to_checkout', false);
$cart_errors = $this->getSessionVar('cart_errors');
$cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
$this->setSessionVar('cart_errors', $cart_errors);
}
}
// Verify Valid Attributes
}
//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
// convert quantity to proper decimals
if (QUANTITY_DECIMALS != 0) {
$fix_qty = $this->contents[$products_id]['qty'];
switch (true) {
case !strstr($fix_qty, '.'):
$new_qty = $fix_qty;
break;
default:
$new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
break;
}
} else {
$new_qty = $this->contents[$products_id]['qty'];
}
$check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
if (strstr($check_unit_decimals, '.')) {
$new_qty = round($new_qty, QUANTITY_DECIMALS);
} else {
$new_qty = round($new_qty, 0);
}
if ($new_qty == (int) $new_qty) {
$new_qty = (int) $new_qty;
}
$products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from']);
}
}
$this->notify('NOTIFIER_CART_GET_PRODUCTS_END');
return $products_array;
}
开发者ID:zenmagick,项目名称:zenmagick,代码行数:101,代码来源:ShoppingCart.php
示例7: while
$points_query_raw = "\r\n select\r\n " . $new_fields . "\r\n from\r\n " . TABLE_POINT_HISTORIES . " ph\r\n , " . TABLE_CUSTOMERS . " c\r\n , " . TABLE_ADDRESS_BOOK . " ab\r\n where\r\n ph.customers_id = c.customers_id\r\n and c.customers_id = ab.customers_id\r\n and c.customers_default_address_id = ab.address_book_id\r\n " . $search . "\r\n order by\r\n ph.id DESC\r\n ";
}
// Split Page
// reset page when page is unknown
if (($_GET['page'] == '' or $_GET['page'] <= 1) and $_GET['pID'] != '') {
$check_page = $db->Execute($points_query_raw);
$check_count = 1;
if ($check_page->RecordCount() > MODULE_POINT_BASE_MAX_DISPLAY_SEARCH_RESULTS_POINTS) {
while (!$check_page->EOF) {
if ($check_page->fields['id'] == $_GET['pID']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round($check_count / MODULE_POINT_BASE_MAX_DISPLAY_SEARCH_RESULTS_POINTS + (fmod_round($check_count, MODULE_POINT_BASE_MAX_DISPLAY_SEARCH_RESULTS_POINTS) != 0 ? 0.5 : 0), 0);
} else {
$_GET['page'] = 1;
}
}
// $points_query_numrows = '';
$points_split = new splitPageResults($_GET['page'], MODULE_POINT_BASE_MAX_DISPLAY_SEARCH_RESULTS_POINTS, $points_query_raw, $points_query_numrows);
$points = $db->Execute($points_query_raw);
while (!$points->EOF) {
if ((!isset($_GET['pID']) || isset($_GET['pID']) && $_GET['pID'] == $points->fields['id']) && !isset($pInfo) && $action != 'new') {
$pInfo = new objectInfo($points->fields);
}
if (isset($pInfo) && is_object($pInfo) && $points->fields['id'] == $pInfo->id) {
echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ADDON_MODULES_ADMIN, zen_get_all_get_params(array('module', 'pID', 'action')) . 'module=point_base&pID=' . $pInfo->id . '&action=edit', 'NONSSL') . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ADDON_MODULES_ADMIN, zen_get_all_get_params(array('module', 'pID', 'action')) . 'module=point_base&pID=' . $points->fields['id'], 'NONSSL') . '\'">' . "\n";
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:31,代码来源:admin.php
示例8: while
$count_by_page = MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER;
if ($count_by_page < 1) {
$count_by_page = 20;
}
if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['cID'] != '') {
$check_page = $db->Execute($customers_query_raw);
$check_count = 1;
if ($check_page->RecordCount() > $count_by_page) {
while (!$check_page->EOF) {
if ($check_page->fields['customers_id'] == $_GET['cID']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round($check_count / $count_by_page + (fmod_round($check_count, $count_by_page) != 0 ? 0.5 : 0), 0);
// zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $_GET['cID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'NONSSL'));
} else {
$_GET['page'] = 1;
}
}
$customers_split = new splitPageResults($_GET['page'], $count_by_page, $customers_query_raw, $customers_query_numrows);
$customers = $db->Execute($customers_query_raw);
while (!$customers->EOF) {
$info = $db->Execute("select customers_info_date_account_created as date_account_created,\r\n customers_info_date_account_last_modified as date_account_last_modified,\r\n customers_info_date_of_last_logon as date_last_logon,\r\n customers_info_number_of_logons as number_of_logons\r\n from " . TABLE_CUSTOMERS_INFO . "\r\n where customers_info_id = '" . $customers->fields['customers_id'] . "'");
if ((!isset($_GET['cID']) || isset($_GET['cID']) && $_GET['cID'] == $customers->fields['customers_id']) && !isset($cInfo)) {
$country = $db->Execute("select countries_name\r\n from " . TABLE_COUNTRIES . "\r\n where countries_id = '" . (int) $customers->fields['entry_country_id'] . "'");
$reviews = $db->Execute("select count(*) as number_of_reviews\r\n from " . TABLE_REVIEWS . " where customers_id = '" . (int) $customers->fields['customers_id'] . "'");
$customer_info = array_merge($country->fields, $info->fields, $reviews->fields);
$cInfo_array = array_merge($customers->fields, $customer_info);
$cInfo = new objectInfo($cInfo_array);
开发者ID:sgkohata,项目名称:zencart-sugu,代码行数:31,代码来源:customers.php
示例9: array
$sql_data_array = array('smtp_user' => $smtp_user, 'smtp_addr' => $smtp_addr, 'smtp_pwd' => $smtp_pwd, 'smtp_port' => $smtp_port);
if (isset($_POST['add_new'])) {
zen_db_perform('email_infor', $sql_data_array, 'insert');
} else {
if (isset($_POST['save_mail'])) {
zen_db_perform('email_infor', $sql_data_array, 'update', 'email_infor_id=' . $id);
}
}
}
}
$page_num = 20;
if (($_GET['page'] == '' or $_GET['page'] <= 1) and $_GET['oID'] != '') {
$check_page = $db->Execute('SELECT COUNT(*) AS total FROM email_infor;');
$check_count = $check_page->fields['total'];
if ($check_count > $page_num) {
$_GET['page'] = round($check_count / $page_num + (fmod_round($check_count, $page_num) != 0 ? 0.5 : 0), 0);
} else {
$_GET['page'] = 1;
}
}
$query_raw = 'SELECT * FROM email_infor';
// $orders_query_numrows = '';
$emails_split = new splitPageResults($_GET['page'], $page_num, $query_raw, $orders_query_numrows);
$emails = $db->Execute($query_raw);
if (isset($_GET['eID']) && (int) $_GET['eID'] > 0) {
$info = $db->Execute('SELECT * FROM email_infor WHERE email_infor_id=' . (int) $_GET['eID']);
$info = new objectInfo($info->fields);
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:31,代码来源:email_infor.php
示例10: defined
$cc_query_raw = "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from " . TABLE_COUPONS . " where coupon_type != 'G'";
}
$maxDisplaySearchResults = defined('MAX_DISPLAY_SEARCH_RESULTS_DISCOUNT_COUPONS') && (int) MAX_DISPLAY_SEARCH_RESULTS_DISCOUNT_COUPONS > 0 ? (int) MAX_DISPLAY_SEARCH_RESULTS_DISCOUNT_COUPONS : 20;
// reset page when page is unknown
if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['cid'] != '') {
$check_page = $db->Execute($cc_query_raw);
$check_count = 1;
if ($check_page->RecordCount() > $maxDisplaySearchResults) {
while (!$check_page->EOF) {
if ($check_page->fields['coupon_id'] == $_GET['cid']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round($check_count / $maxDisplaySearchResults + (fmod_round($check_count, $maxDisplaySearchResults) != 0 ? 0.5 : 0), 0);
} else {
$_GET['page'] = 1;
}
}
$cc_split = new splitPageResults($_GET['page'], $maxDisplaySearchResults, $cc_query_raw, $cc_query_numrows);
$cc_list = $db->Execute($cc_query_raw);
while (!$cc_list->EOF) {
if ((!$_GET['cid'] || @$_GET['cid'] == $cc_list->fields['coupon_id']) && !$cInfo) {
$cInfo = new objectInfo($cc_list->fields);
}
if (is_object($cInfo) && $cc_list->fields['coupon_id'] == $cInfo->coupon_id) {
echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_COUPON_ADMIN, zen_get_all_get_params(array('cid', 'action')) . 'cid=' . $cInfo->coupon_id . '&action=voucheredit') . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_COUPON_ADMIN, zen_get_all_get_params(array('cid', 'action')) . 'cid=' . $cc_list->fields['coupon_id']) . '\'">' . "\n";
}
开发者ID:kirkbauer2,项目名称:kirkzc,代码行数:31,代码来源:coupon_admin.php
示例11: while
}
// Split Page
// reset page when page is unknown
if (($_GET['page'] == '' or $_GET['page'] <= 1) and $_GET['oID'] != '') {
$check_page = $db->Execute($orders_query_raw);
$check_count=1;
if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_ORDERS) {
while (!$check_page->EOF) {
if ($check_page->fields['orders_id'] == $_GET['oID']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS_ORDERS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS_ORDERS) !=0 ? .5 : 0)),0);
} else {
$_GET['page'] = 1;
}
}
// $orders_query_numrows = '';
$orders_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $orders_query_raw, $orders_query_numrows);
$orders = $db->Execute($orders_query_raw);
while (!$orders->EOF) {
if ((!isset($_GET['oID']) || (isset($_GET['oID']) && ($_GET['oID'] == $orders->fields['orders_id']))) && !isset($oInfo)) {
$oInfo = new objectInfo($orders->fields);
}
if (isset($oInfo) && is_object($oInfo) && ($orders->fields['orders_id'] == $oInfo->orders_id)) {
echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '\'">' . "\n";
开发者ID:quangn92,项目名称:visualyou,代码行数:31,代码来源:orders.php
示例12: get_products
/**
* Method to return details of all products in the cart
*
* @param boolean whether to check if cart contents are valid
* @return array
*/
function get_products($check_for_valid_cart = false)
{
global $db;
$this->notify('NOTIFIER_CART_GET_PRODUCTS_START');
if (!is_array($this->contents)) {
return false;
}
$products_array = array();
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n p.products_price,p.products_price_sample, p.products_weight, p.products_tax_class_id,\n p.products_quantity_order_min, p.products_quantity_order_units,\n p.product_is_free, p.products_priced_by_attribute,\n p.products_discount_type, p.products_discount_type_from\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n where p.products_id = '" . (int) $products_id . "'\n and pd.products_id = p.products_id\n and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
if ($products = $db->Execute($products_query)) {
$prid = $products->fields['products_id'];
$products_price = $products->fields['products_price'] == 0 ? $products->fields['products_price_sample'] : $products->fields['products_price'];
//fix here
/*
$special_price = zen_get_products_special_price($prid);
if ($special_price) {
$products_price = $special_price;
}
*/
$special_price = zen_get_products_special_price($prid);
if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
$products_price = $special_price;
} else {
$special_price = 0;
}
if (zen_get_products_price_is_free($products->fields['products_id'])) {
// no charge
$products_price = 0;
}
// adjust price for discounts when priced by attribute
if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
// reset for priced by attributes
// $products_price = $products->fields['products_price'];
if ($special_price) {
$products_price = $special_price;
} else {
$products_price = $products->fields['products_price'];
}
} else {
// discount qty pricing
$categories_query = $db->Execute("SELECT categories_discount_type FROM " . TABLE_CATEGORIES . " WHERE categories_id = " . zen_get_products_category_id($products_id));
if ($products->fields['products_discount_type'] != 0 || $categories_query->fields['categories_discount_type'] != 0) {
$products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
}
}
// validate cart contents for checkout
if ($check_for_valid_cart == true) {
$fix_once = 0;
// Check products_status if not already
$check_status = $products->fields['products_status'];
if ($check_status == 0) {
$fix_once++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
$this->remove($products_id);
}
// check only if valid products_status
if ($fix_once == 0) {
$check_quantity = $this->contents[$products_id]['qty'];
$check_quantity_min = $products->fields['products_quantity_order_min'];
// Check quantity min
if ($new_check_quantity = $this->in_cart_mixed($prid)) {
$check_quantity = $new_check_quantity;
}
}
if ($fix_once == 0) {
if ($check_quantity < $check_quantity_min) {
$fix_once++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
}
}
// Check Quantity Units if not already an error on Quantity Minimum
if ($fix_once == 0) {
$check_units = $products->fields['products_quantity_order_units'];
if (fmod_round($check_quantity, $check_units) != 0) {
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
}
}
// Verify Valid Attributes
}
//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
// convert quantity to proper decimals
if (QUANTITY_DECIMALS != 0) {
// $new_qty = round($new_qty, QUANTITY_DECIMALS);
$fix_qty = $this->contents[$products_id]['qty'];
switch (true) {
case !strstr($fix_qty, '.'):
$new_qty = $fix_qty;
break;
default:
//.........这里部分代码省略.........
开发者ID:happyxlq,项目名称:lt_svn,代码行数:101,代码来源:shopping_cart.php
注:本文中的fmod_round函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论