本文整理汇总了PHP中isc_gmmktime函数的典型用法代码示例。如果您正苦于以下问题:PHP isc_gmmktime函数的具体用法?PHP isc_gmmktime怎么用?PHP isc_gmmktime使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isc_gmmktime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TrackVisitor
/**
* Actually track a visitor.
*/
public function TrackVisitor()
{
$today_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
if(!isset($_COOKIE['STORE_VISITOR'])) {
// We have a new visitor, let's track that.
$query = sprintf("SELECT COUNT(uniqueid) AS num FROM [|PREFIX|]unique_visitors WHERE datestamp='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($today_stamp));
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
if($row['num'] == 0) {
// This person is the first to visit the site today, so track it
$new_visitor = array(
"datestamp" => $today_stamp,
"numuniques" => 1
);
$GLOBALS['ISC_CLASS_DB']->InsertQuery("unique_visitors", $new_visitor);
}
else {
// At least one person has visited the site today, just update the record
$query = sprintf("UPDATE [|PREFIX|]unique_visitors SET numuniques=numuniques+1 WHERE datestamp='%d'", $today_stamp);
// Run the query to update the number of unique visitors
$GLOBALS['ISC_CLASS_DB']->Query($query);
}
// Set the tracking cookie for another 24 hours
ISC_SetCookie("STORE_VISITOR", true, time()+86400);
}
header("Content-type: image/gif");
echo base64_decode('R0lGODlhAQABALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//wBiZCH5BAEAAA8ALAAAAAABAAEAAAQC8EUAOw==');
exit;
}
示例2: __construct
function __construct()
{
if (isset($_GET['FromDate'])) {
$this->from_date = (int) $_GET['FromDate'];
} else {
$this->from_date = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d") - 30, isc_date("Y"));
}
if (isset($_GET['ToDate'])) {
$this->to_date = (int) $_GET['ToDate'];
} else {
$this->to_date = time();
}
if (isset($_GET['Search_Type'])) {
$this->stype = strtolower($_GET['Search_Type']);
if (strtolower($_GET['Search_Type']) === strtolower('SearchStatsBestPerformanceGrid')) {
$this->clickwhere = 1;
}
if (strtolower($_GET['Search_Type']) === strtolower('SearchStatsWorstPerformanceGrid')) {
$this->clickwhere = 0;
}
} else {
$this->stype = strtolower('KeywordWithResults');
}
}
示例3: CustomerStatsByDateData
//.........这里部分代码省略.........
}
else if($num_days > 1 && $num_days <= 60) {
// Get customers and show them for each day
$query = sprintf("select custdatejoined from [|PREFIX|]customers where custdatejoined >= '%s' and custdatejoined <= '%s'", $from, $to);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
// Split the customers based on the day they came in
while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
@$customers[isc_date(GetConfig('DisplayDateFormat'), $row['custdatejoined'])]++;
}
// We now have the customers in an array based on the date they joined,
// so we can loop through them to create the first graph on the chart
$x_counter = 0;
foreach($customers as $join_date=>$join_count) {
$xml .= sprintf(" <value xid=\"%s\">%d</value>\n", $join_date, $join_count);
$conversions[$join_date] = array("customers" => $join_count,
"visitors" => 0
);
}
// Build the XML for number of unique visitors
$query = sprintf("select datestamp, numuniques from [|PREFIX|]unique_visitors where datestamp >= '%d' and datestamp <= '%d'", $from, $to);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$visitor_rows[$row['datestamp']] = $row['numuniques'];
}
for($i = 0; $i < count($visitor_dates); $i++) {
$date_format = $visitor_dates[$i]['format'];
$date_stamp = isc_gmmktime(0, 0, 0, isc_date("m", $visitor_dates[$i]['stamp']), isc_date("d", $visitor_dates[$i]['stamp']), isc_date("Y", $visitor_dates[$i]['stamp']));
// Were there any visitors for this day?
if(isset($visitor_rows[$date_stamp])) {
$uniques = $visitor_rows[$date_stamp];
}
else {
$uniques = 0;
}
$visitor_xml .= sprintf(" <value xid=\"%s\">%d</value>\n", $date_format, $uniques);
// Update the conversion array
$conversions[$date_format]['visitors'] = $uniques;
// Workout the conversion rate and add it to the XML
if($conversions[$date_format]['visitors'] > 0) {
$conversion_rate = number_format((($conversions[$date_format]['customers'] / $conversions[$date_format]['visitors'])*100), 2);
}
else {
// Avoid a divide by zero error
$conversion_rate = 0;
}
$conversion_xml .= sprintf(" <value xid=\"%s\">%.2f</value>\n", $date_format, $conversion_rate);
}
}
else if($num_days > 60 && $num_days <= 182) {
// Get customers and show them for each week
$query = sprintf("select custdatejoined from [|PREFIX|]customers where custdatejoined >= '%s' and custdatejoined <= '%s'", $from, $to);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
// Split the customers based on the week they came in
示例4: OrderAddProduct
/**
* Add a product to the order that's being created/edited.
*/
private function OrderAddProduct()
{
if (!isset($_REQUEST['cartItemId']) && !isset($_REQUEST['productId']) || !isset($_REQUEST['orderSession'])) {
exit;
}
$cartOptions = array('updateQtyIfExists' => false);
if (isset($_REQUEST['EventDate'])) {
$cartOptions['EventDate'] = isc_gmmktime(0, 0, 0, $_REQUEST['EventDate']['Mth'], $_REQUEST['EventDate']['Day'], $_REQUEST['EventDate']['Yr']);
}
if (isset($_REQUEST['ordcustid']) && $_REQUEST['ordcustid'] != 0) {
$customerClass = GetClass('ISC_CUSTOMER');
$customer = $customerClass->GetCustomerInfo($_REQUEST['ordcustid']);
if (isset($customer['custgroupid'])) {
$cartOptions['customerGroup'] = $customer['custgroupid'];
}
} else {
if (isset($_REQUEST['custgroupid']) && $_REQUEST['custgroupid'] != 0) {
$cartOptions['customerGroup'] = (int) $_REQUEST['custgroupid'];
}
}
if (isset($_REQUEST['variationId'])) {
$variationId = $_REQUEST['variationId'];
} else {
$variationId = 0;
}
if (isset($_REQUEST['customerGroup'])) {
$orderDetails['customerGroup'] = (int) $_REQUEST['customerGroup'];
}
$productFields = $this->BuildProductConfigurableFieldData();
$orderClass = GetClass('ISC_ADMIN_ORDERS');
$rowId = $orderClass->GetCartApi($_REQUEST['orderSession'])->AddItem($_REQUEST['productId'], $_REQUEST['quantity'], $variationId, $productFields, $_REQUEST['cartItemId'], $cartOptions);
if ($rowId === false) {
$errors = implode("\n", $orderClass->GetCartApi()->GetErrors());
if (!$errors) {
$errors = GetLang('ErrorAddingProductToOrder');
}
$response = array('error' => $errors);
} else {
$product = $orderClass->GetCartApi()->GetProductInCart($rowId);
$response = array('productRow' => $orderClass->GenerateOrderItemRow($rowId, $product), 'orderSummary' => $orderClass->GenerateOrderSummaryTable(), 'productRowId' => $rowId);
if ($_REQUEST['cartItemId'] != $rowId) {
$response['removeRow'] = (string) $_REQUEST['cartItemId'];
}
}
if (isset($_REQUEST['ajaxFormUpload'])) {
echo '<textarea>' . isc_json_encode($response) . '</textarea>';
exit;
}
echo isc_json_encode($response);
exit;
}
示例5: CopyProductStep1
//.........这里部分代码省略.........
$GLOBALS['DiscountRules'] = $this->GetDiscountRules($prodId);
}
// Hide if we are not enabled
if (!GetConfig('BulkDiscountEnabled')) {
$GLOBALS['HideDiscountRulesWarningBox'] = '';
$GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesNotEnabledWarning');
$GLOBALS['DiscountRulesWithWarning'] = 'none';
// Also hide it if this product has variations
} else if (isset($arrData['prodvariationid']) && isId($arrData['prodvariationid'])) {
$GLOBALS['HideDiscountRulesWarningBox'] = '';
$GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesVariationWarning');
$GLOBALS['DiscountRulesWithWarning'] = 'none';
} else {
$GLOBALS['HideDiscountRulesWarningBox'] = 'none';
$GLOBALS['DiscountRulesWithWarning'] = '';
}
$GLOBALS['DiscountRulesEnabled'] = (int)GetConfig('BulkDiscountEnabled');
$GLOBALS['EventDateFieldName'] = $arrData['prodeventdatefieldname'];
if ($GLOBALS['EventDateFieldName'] == null) {
$GLOBALS['EventDateFieldName'] = GetLang('EventDateDefault');
}
if ($arrData['prodeventdaterequired'] == 1) {
$GLOBALS['EventDateRequired'] = 'checked="checked"';
$from_stamp = $arrData['prodeventdatelimitedstartdate'];
$to_stamp = $arrData['prodeventdatelimitedenddate'];
} else {
$from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
$to_stamp = isc_gmmktime(0, 0, 0, isc_date("m")+1, isc_date("d"), isc_date("Y"));
}
if ($arrData['prodeventdatelimited'] == 1) {
$GLOBALS['LimitDates'] = 'checked="checked"';
}
$GLOBALS['LimitDateOption1'] = '';
$GLOBALS['LimitDateOption2'] = '';
$GLOBALS['LimitDateOption3'] = '';
switch ($arrData['prodeventdatelimitedtype']) {
case 1 :
$GLOBALS['LimitDateOption1'] = 'selected="selected"';
break;
case 2 :
$GLOBALS['LimitDateOption2'] = 'selected="selected"';
break;
case 3 :
$GLOBALS['LimitDateOption3'] = 'selected="selected"';
break;
}
// Set the global variables for the select boxes
$from_day = isc_date("d", $from_stamp);
$from_month = isc_date("m", $from_stamp);
$from_year = isc_date("Y", $from_stamp);
$to_day = isc_date("d", $to_stamp);
$to_month = isc_date("m", $to_stamp);
$to_year = isc_date("Y", $to_stamp);
示例6: set_install_date
public function set_install_date()
{
if (GetConfig('InstallDate') > 0) {
return true;
}
// determine the install date based off the first order
$query = "SELECT orddate FROM [|PREFIX|]orders ORDER BY orderid LIMIT 1";
$res = $GLOBALS['ISC_CLASS_DB']->Query($query);
if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($res)) {
$installDate = $row['orddate'];
}
else {
// no orders? set it to the current time
$installDate = isc_gmmktime(isc_date("H"), isc_date("i"), isc_date("s"), isc_date("m"), isc_date("d"), isc_date("Y"));
}
$GLOBALS['ISC_NEW_CFG']['InstallDate'] = $installDate;
GetClass('ISC_ADMIN_SETTINGS')->CommitSettings();
return true;
}
示例7: BuildWhereFromVars
/**
* Builds a where statement for order listing based on values in an array
*
* @param mixed $array
* @return mixed
*/
public function BuildWhereFromVars($array)
{
$queryWhere = "";
$countQuery = "";
if (isset($array['fromDate'])) {
$array['fromDate'] = urldecode(urldecode(urldecode($array['fromDate'])));
}
if (isset($array['fromDate'])) {
$array['toDate'] = urldecode(urldecode(urldecode($array['toDate'])));
}
if (isset($array['orderId']) && $array['orderId'] != '') {
$queryWhere .= " AND o.orderid='" . (int) $array['orderId'] . "'";
return array("query" => $queryWhere, "count" => $countQuery);
}
if (isset($array['customerId']) && $array['customerId'] != '') {
$queryWhere .= " AND ordcustid='" . (int) $array['customerId'] . "'";
return array("query" => $queryWhere, "count" => $countQuery);
}
if (isset($array['searchQuery']) && $array['searchQuery'] != "") {
$search_query = $GLOBALS['ISC_CLASS_DB']->QuoteEx($array['searchQuery']);
//zcs=Fix BUG,escape additional characters
$queryWhere .= " AND (\n\t\t\t\t\to.orderid='" . (int) $search_query . "'\n\t\t\t\t\tOR ordtrackingno='" . $search_query . "'\n\t\t\t\t\tOR ordpayproviderid='" . $search_query . "'\n\t\t\t\t\tOR CONCAT(custconfirstname, ' ', custconlastname) LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR CONCAT(ordbillfirstname, ' ', ordbilllastname) LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR CONCAT(ordshipfirstname, ' ', ordshiplastname) LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR custconemail LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordbillstreet1 LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordbillstreet2 LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordbillsuburb LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordbillstate LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordbillzip LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordbillcountry LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordshipstreet1 LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordshipstreet2 LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordshipsuburb LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordshipstate LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordshipzip LIKE '%" . $search_query . "%'\n\t\t\t\t\tOR ordshipcountry LIKE '%" . $search_query . "%'\n\t\t\t\t) ";
$countQuery .= " LEFT JOIN [|PREFIX|]customers c ON (o.ordcustid=c.customerid)";
}
//alandy_2012-3-28 add.
if (isset($array['orderOwner']) && $array['orderOwner'] != '') {
$queryWhere .= sprintf(" AND orderOwner='%d'", $array['orderOwner']);
}
if (isset($array['orderStatus']) && $array['orderStatus'] != "") {
$order_status = $GLOBALS['ISC_CLASS_DB']->Quote((int) $array['orderStatus']);
$queryWhere .= sprintf(" AND ordstatus='%d'", $order_status);
} else {
$queryWhere .= " AND ordstatus > 0";
}
if (isset($array['paymentMethod']) && $array['paymentMethod'] != "") {
$payment_method = $GLOBALS['ISC_CLASS_DB']->Quote($array['paymentMethod']);
$queryWhere .= sprintf(" AND orderpaymentmodule='%s'", $payment_method);
}
if (isset($_REQUEST['shippingMethod']) && $_REQUEST['shippingMethod'] != "") {
$shipping_method = $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['shippingMethod']);
$queryWhere .= sprintf(" AND ordershipmodule='%s'", $shipping_method);
}
if (isset($array['orderFrom']) && isset($array['orderTo']) && $array['orderFrom'] != "" && $array['orderTo'] != "") {
$order_from = (int) $array['orderFrom'];
$order_to = (int) $array['orderTo'];
$queryWhere .= sprintf(" AND (o.orderid >= '%d' and o.orderid <= '%d')", $GLOBALS['ISC_CLASS_DB']->Quote($order_from), $GLOBALS['ISC_CLASS_DB']->Quote($order_to));
} else {
if (isset($array['orderFrom']) && $array['orderFrom'] != "") {
$order_from = (int) $array['orderFrom'];
$queryWhere .= sprintf(" AND o.orderid >= '%d'", $order_from);
} else {
if (isset($array['orderTo']) && $array['orderTo'] != "") {
$order_to = (int) $array['orderTo'];
$queryWhere .= sprintf(" AND o.orderid <= '%d'", $order_to);
}
}
}
if (isset($array['totalFrom']) && $array['totalFrom'] != "" && isset($array['totalTo']) && $array['totalTo'] != "") {
$from_total = $array['totalFrom'];
$to_total = $array['totalTo'];
$queryWhere .= sprintf(" AND ordtotalamount >= '%s' and ordtotalamount <= '%s'", $GLOBALS['ISC_CLASS_DB']->Quote($from_total), $GLOBALS['ISC_CLASS_DB']->Quote($to_total));
} else {
if (isset($array['totalFrom']) && $array['totalFrom'] != "") {
$from_total = $array['totalFrom'];
$queryWhere .= sprintf(" AND ordtotalamount >= '%s'", $GLOBALS['ISC_CLASS_DB']->Quote($from_total));
} else {
if (isset($array['totalTo']) && $array['totalTo'] != "") {
$to_total = $array['totalTo'];
$queryWhere .= sprintf(" AND ordtotalamount <= '%s'", $GLOBALS['ISC_CLASS_DB']->Quote($to_total));
}
}
}
// Limit results to a particular date range
if (isset($array['dateRange']) && $array['dateRange'] != "") {
$range = $array['dateRange'];
switch ($range) {
// Orders within the last day
case "today":
$from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
break;
// Orders received in the last 2 days
// Orders received in the last 2 days
case "yesterday":
$from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d") - 1, isc_date("Y"));
$to_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
break;
// Orders received in the last 24 hours
// Orders received in the last 24 hours
case "day":
$from_stamp = time() - 60 * 60 * 24;
break;
// Orders received in the last 7 days
// Orders received in the last 7 days
case "week":
//.........这里部分代码省略.........
示例8: BuildWhereFromVars
//.........这里部分代码省略.........
$order_from = (int)$array['orderFrom'];
$order_to = (int)$array['orderTo'];
$queryWhere .= sprintf(" AND (orderid >= '%d' and orderid <= '%d')", $GLOBALS['ISC_CLASS_DB']->Quote($order_from), $GLOBALS['ISC_CLASS_DB']->Quote($order_to));
}
else if(isset($array['orderFrom']) && $array['orderFrom'] != "") {
$order_from = (int)$array['orderFrom'];
$queryWhere .= sprintf(" AND orderid >= '%d'", $order_from);
}
else if(isset($array['orderTo']) && $array['orderTo'] != "") {
$order_to = (int)$array['orderTo'];
$queryWhere .= sprintf(" AND orderid <= '%d'", $order_to);
}
if(isset($array['totalFrom']) && $array['totalFrom'] != "" && isset($array['totalTo']) && $array['totalTo'] != "") {
$from_total = $array['totalFrom'];
$to_total = $array['totalTo'];
$queryWhere .= sprintf(" AND total_inc_tax >= '%s' and total_inc_tax <= '%s'", $GLOBALS['ISC_CLASS_DB']->Quote($from_total), $GLOBALS['ISC_CLASS_DB']->Quote($to_total));
}
else if(isset($array['totalFrom']) && $array['totalFrom'] != "") {
$from_total = $array['totalFrom'];
$queryWhere .= sprintf(" AND total_inc_tax >= '%s'", $GLOBALS['ISC_CLASS_DB']->Quote($from_total));
}
else if(isset($array['totalTo']) && $array['totalTo'] != "") {
$to_total = $array['totalTo'];
$queryWhere .= sprintf(" AND total_inc_tax <= '%s'", $GLOBALS['ISC_CLASS_DB']->Quote($to_total));
}
// Limit results to a particular date range
if(isset($array['dateRange']) && $array['dateRange'] != "") {
$range = $array['dateRange'];
switch($range) {
// Orders within the last day
case "today":
$from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
break;
// Orders received in the last 2 days
case "yesterday":
$from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d")-1, isc_date("Y"));
$to_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
break;
// Orders received in the last 24 hours
case "day":
$from_stamp = time()-60*60*24;
break;
// Orders received in the last 7 days
case "week":
$from_stamp = time()-60*60*24*7;
break;
// Orders received in the last 30 days
case "month":
$from_stamp = time()-60*60*24*30;
break;
// Orders received this month
case "this_month":
$from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), 1, isc_date("Y"));
break;
// Orders received this year
case "this_year":
$from_stamp = isc_gmmktime(0, 0, 0, 1, 1, isc_date("Y"));
break;
// Custom date
default:
if(isset($array['fromDate']) && $array['fromDate'] != "") {
$from_date = urldecode($array['fromDate']);
$from_data = explode("/", $from_date);
$from_stamp = isc_gmmktime(0, 0, 0, $from_data[0], $from_data[1], $from_data[2]);
示例9: AddToCart
private function AddToCart()
{
if (!isset($_REQUEST['product_id'])) {
ob_end_clean();
header(sprintf("Location: %s/makeaoffer.php", GetConfig('ShopPath')));
die;
}
// First get the list of existing products in the cart
$product_id = (int) $_REQUEST['product_id'];
$GLOBALS['ProductJustAdded'] = $product_id;
$query = "\n\t\t\t\tSELECT p.*, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\tWHERE p.productid='" . (int) $product_id . "'\n\t\t\t";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$product = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
$GLOBALS['Product'] =& $product;
// Check that the customer has permisison to view this product
$canView = false;
$productCategories = explode(',', $product['prodcatids']);
foreach ($productCategories as $categoryId) {
// Do we have permission to access this category?
if (CustomerGroupHasAccessToCategory($categoryId)) {
$canView = true;
}
}
if ($canView == false) {
$noPermissionsPage = GetClass('ISC_403');
$noPermissionsPage->HandlePage();
exit;
}
$variation = 0;
if (isset($_REQUEST['variation_id']) && $_REQUEST['variation_id'] != 0) {
$variation = (int) $_REQUEST['variation_id'];
} else {
if (isset($_REQUEST['variation']) && is_array($_REQUEST['variation']) && $_REQUEST['variation'][1] != 0) {
$variation = $_REQUEST['variation'];
}
}
$qty = 1;
if (isset($_REQUEST['qty'])) {
if (is_array($_REQUEST['qty'])) {
$qty = (int) array_pop($_REQUEST['qty']);
} else {
if ($_REQUEST['qty'] > 0) {
$qty = (int) $_REQUEST['qty'];
}
}
}
$configurableFields = null;
if (isset($_REQUEST['ProductFields']) || isset($_FILES['ProductFields'])) {
$configurableFields = $this->BuildProductConfigurableFieldData();
}
$options = array();
if (isset($_REQUEST['EventDate']['Day'])) {
$result = true;
$eventDate = isc_gmmktime(0, 0, 0, $_REQUEST['EventDate']['Mth'], $_REQUEST['EventDate']['Day'], $_REQUEST['EventDate']['Yr']);
$eventName = $product['prodeventdatefieldname'];
if ($product['prodeventdatelimitedtype'] == 1) {
if ($eventDate < $product['prodeventdatelimitedstartdate'] || $eventDate > $product['prodeventdatelimitedenddate']) {
$result = false;
}
} else {
if ($product['prodeventdatelimitedtype'] == 2) {
if ($eventDate < $product['prodeventdatelimitedstartdate']) {
$result = false;
}
} else {
if ($product['prodeventdatelimitedtype'] == 3) {
if ($eventDate > $product['prodeventdatelimitedenddate']) {
$result = false;
}
}
}
}
if ($result == false) {
$this->ShowRegularCart();
return;
}
$options['EventDate'] = $eventDate;
$options['EventName'] = $eventName;
}
// Actually add the product to the cart
$cartItemId = $this->api->AddItem($product_id, $qty, $variation, $configurableFields, null, $options);
$this->newCartItem = $cartItemId;
if ($cartItemId === false) {
$this->cartErrorMessage = implode('<br />', $this->api->GetErrors());
if (!$this->cartErrorMessage) {
$this->cartErrorMessage = GetLang('ProductUnavailableForPruchase');
}
if ($this->api->productLevelError == true) {
$query = "\n\t\t\t\t\t\tSELECT prodname\n\t\t\t\t\t\tFROM [|PREFIX|]products\n\t\t\t\t\t\tWHERE productid='" . (int) $product_id . "'\n\t\t\t\t\t";
$productName = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
$_SESSION['ProductErrorMessage'] = $this->cartErrorMessage;
ob_end_clean();
header("Location: " . ProdLink($productName));
exit;
}
$this->ShowRegularCart();
return;
}
$this->api->ReapplyCouponsFromCart();
//Added by Simha temp fix to avoid having multiple times coupon for same item
//.........这里部分代码省略.........
示例10: GetMonthOptions
/**
* Generate select options for selecting a delivery date month.
*
* @return string HTML string containing option tags for available months.
*/
private function GetMonthOptions()
{
$output = '<option value=\'-1\'>---</option>';
for($i = 1; $i <= 12; $i++) {
$stamp = isc_gmmktime(0, 0, 0, $i, 1, 2000);
$month = isc_date("M", $stamp);
$output .= sprintf("<option value='%d'>%s</option>", $i, $month);
}
return $output;
}
示例11: ConvertDateToTime
function ConvertDateToTime($Stamp)
{
$vals = explode("/", $Stamp);
return isc_gmmktime(0, 0, 0, $vals[0], $vals[1], $vals[2]);
}
示例12: _ImportRecord
//.........这里部分代码省略.........
op.orderorderid = " . $order['orderid'] . "
AND op.ordprodtype = 'physical'
AND op.ordprodqty > op.ordprodqtyshipped
AND os.order_address_id = op.order_address_id
ORDER BY
op.order_address_id,
op.orderprodid
";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($product = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$unshippedProducts[] = $product;
}
if (empty($unshippedProducts) && (!isset($this->ImportSession['OverrideDuplicates']) || $this->ImportSession['OverrideDuplicates'] != 1)) {
// cannot apply tracking number to order with all items shipped unless override duplicates is set
$this->ImportSession['Results']['Duplicates'][] = $record['ordernumber']." ".$record['ordertrackingnumber'];
return;
}
// the import format only allows for one tracking number per order so this tracking number gets applied to all shipments
$existingSuccess = true;
if (isset($this->ImportSession['OverrideDuplicates']) && $this->ImportSession['OverrideDuplicates'] == 1) {
$query = "
UPDATE [|PREFIX|]shipments
SET shiptrackno = '" . $GLOBALS['ISC_CLASS_DB']->Quote($record['ordertrackingnumber']) . "'
WHERE shiporderid = " . $order['orderid'] . "
";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if (!$result) {
$existingSuccess = false;
$this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record'])." ".GetLang('ImportUpdateShipmentsFailed');
}
}
/** @var ISC_ADMIN_SHIPMENTS */
$shipments = GetClass('ISC_ADMIN_SHIPMENTS');
// create shipments for unshipped products
$totalShipments = 0;
$totalSuccess = 0;
$totalFail = 0;
$quantity = array();
reset($unshippedProducts);
while ($product = current($unshippedProducts)) {
next($unshippedProducts);
$nextProduct = current($unshippedProducts);
// add product=>qty to shipment
$quantity[$product['orderprodid']] = $product['ordprodqty'] - $product['ordprodqtyshipped'];
if ($nextProduct && $nextProduct['order_address_id'] == $product['order_address_id']) {
// next product is for the same address, skip shipment creation for now
continue;
}
// next product is a different shipment so commit this one before proceeding
$shipment = array(
'orderId' => $order['orderid'],
'shiptrackno' => $record['ordertrackingnumber'],
'addressId' => $product['order_address_id'],
'shipping_module' => $product['module'],
'shipmethod' => $product['method'],
'shipcomments' => '',
'quantity' => $quantity,
);
if (isset($this->ImportSession['updateOrderStatus']) && $this->ImportSession['updateOrderStatus']!=0) {
$shipment['ordstatus'] = (int)$this->ImportSession['updateOrderStatus'];
}
$totalShipments++;
if ($shipments->CommitShipment($shipment)) {
// commit success
$this->ImportSession['Results']['Updates'][] = $record['ordernumber']." ".$record['ordertrackingnumber'];
$totalSuccess++;
} else {
// fail
$this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record'])." ".GetLang('ImportCreateShipmentFailed');
$totalFail++;
}
// reset
$quantity = array();
}
if ($existingSuccess && $totalSuccess == $totalShipments) {
// all success or no new shipments were needed
$orderData = array(
"orddateshipped" => isc_gmmktime(),
);
$GLOBALS['ISC_CLASS_DB']->UpdateQuery("orders", $orderData, "orderid='".$order['orderid']."'");
++$this->ImportSession['Results']['SuccessCount'];
} else {
// total or partial failure
$this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record'])." ".GetLang('ImportInvalidOrderNumber');
return;
}
}
示例13: OrderAddProduct
/**
* Add a product to the order that's being created/edited.
*/
private function OrderAddProduct()
{
if (!isset($_REQUEST['cartItemId']) && !isset($_REQUEST['productId']) || !isset($_REQUEST['orderSession'])) {
exit;
}
$cartOptions = array('updateQtyIfExists' => false);
if (isset($_REQUEST['EventDate'])) {
$cartOptions['EventDate'] = isc_gmmktime(0, 0, 0, $_REQUEST['EventDate']['Mth'], $_REQUEST['EventDate']['Day'], $_REQUEST['EventDate']['Yr']);
}
if (isset($_REQUEST['ordcustid']) && $_REQUEST['ordcustid'] != 0) {
$customerClass = GetClass('ISC_CUSTOMER');
$customer = $customerClass->GetCustomerInfo($_REQUEST['ordcustid']);
if (isset($customer['custgroupid'])) {
$cartOptions['customerGroup'] = $customer['custgroupid'];
}
} else {
if (isset($_REQUEST['custgroupid']) && $_REQUEST['custgroupid'] != 0) {
$cartOptions['customerGroup'] = (int) $_REQUEST['custgroupid'];
}
}
if (isset($_REQUEST['variationId'])) {
$variationId = $_REQUEST['variationId'];
} else {
$variationId = 0;
}
if (isset($_REQUEST['customerGroup'])) {
$orderDetails['customerGroup'] = (int) $_REQUEST['customerGroup'];
}
/* -- Added below condition to check if YMM values coming from dropdown, then need to decode - starts */
if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] == 0) {
if (isset($_REQUEST['ymmmake'])) {
$_REQUEST['ymmmake'] = MakeURLNormal($_REQUEST['ymmmake']);
}
if (isset($_REQUEST['ymmmodel'])) {
$_REQUEST['ymmmodel'] = MakeURLNormal($_REQUEST['ymmmodel']);
}
}
/* -- ends -- */
$productFields = $this->BuildProductConfigurableFieldData();
$orderClass = GetClass('ISC_ADMIN_ORDERS');
$rowId = $orderClass->GetCartApi($_REQUEST['orderSession'])->AddItem($_REQUEST['productId'], $_REQUEST['quantity'], $variationId, $productFields, $_REQUEST['cartItemId'], $cartOptions);
if ($rowId === false) {
$errors = implode("\n", $orderClass->GetCartApi()->GetErrors());
if (!$errors) {
$errors = GetLang('ErrorAddingProductToOrder');
}
$response = array('error' => $errors);
} else {
$product = $orderClass->GetCartApi()->GetProductInCart($rowId);
$catquery = " SELECT DISTINCT c.categoryid, p.brandseriesid\n FROM isc_categories c \n LEFT JOIN isc_categoryassociations ca ON c.categoryid = ca.categoryid \n LEFT JOIN isc_products p ON ca.productid = p.productid AND p.prodvisible='1'\n WHERE p.productid= " . $product['product_id'] . "";
$relcats = array();
$brandseries = 0;
$catresult = $GLOBALS['ISC_CLASS_DB']->Query($catquery);
while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catresult)) {
$relcats[] = $catrow['categoryid'];
$brandseries = $catrow['brandseriesid'];
}
if ($product['data']['prodsaleprice'] > 0 && $product['data']['prodsaleprice'] < $product['product_price']) {
$product['product_price'] = $product['data']['prodsaleprice'];
} else {
$product['discount_price'] = CalculateDiscountPrice($product['product_price'], $product['product_price'], $relcats[0], $brandseries);
$orderClass->GetCartApi()->SetItemValue($rowId, 'discount_price', $product['discount_price']);
// $product['product_price'] = CalculateDiscountPrice($product['product_price'], $product['product_price'], $relcats[0], $brandseries);
}
$product['vendorprefix'] = $orderClass->GetProductVendorprefix($product['product_id']);
$orderClass->GetCartApi()->SetItemValue($rowId, 'product_price', $product['product_price']);
$response = array('productRow' => $orderClass->GenerateOrderItemRow($rowId, $product), 'orderSummary' => $orderClass->GenerateOrderSummaryTable(), 'productRowId' => $rowId);
if ($_REQUEST['cartItemId'] != $rowId) {
$response['removeRow'] = (string) $_REQUEST['cartItemId'];
}
}
if (isset($_REQUEST['ajaxFormUpload'])) {
echo '<textarea>' . isc_json_encode($response) . '</textarea>';
exit;
}
echo isc_json_encode($response);
exit;
}
示例14: BuildWhereFromFields
public function BuildWhereFromFields($search_fields)
{
if (empty($search_fields['From'])) {
$from_stamp = GetConfig('InstallDate');
}
else {
$from_stamp = (int)$search_fields['From'];
}
if (empty($search_fields['To'])) {
$to_stamp = isc_gmmktime(isc_date("H"), isc_date("i"), isc_date("s"), isc_date("m"), isc_date("d"), isc_date("Y"));
}
else {
$to_stamp = (int)$search_fields['To'];
}
// Calculate the number of seconds from GMT +0 that we are in. We'll be adjusting
// the orddate in the query below so that it becomes timezone specific (remember, MySQL thinks we're +0)
$timezoneAdjustment = GetConfig('StoreTimeZone');
if(GetConfig('StoreDSTCorrection')) {
++$timezoneAdjustment;
}
$timezoneAdjustment *= 3600;
if (empty($search_fields['TaxListBy'])) {
$groupBy = 'Day';
}
else {
$groupBy = $search_fields['TaxListBy'];
}
$fieldSQL = '';
switch ($groupBy) {
case 'Day':
$fieldSQL = "DATE_FORMAT(FROM_UNIXTIME(orddate+".$timezoneAdjustment."), '%Y-%m-%d')";
$this->addDay = 1;
$this->taxDateFormat = GetConfig('ExportDateFormat');
break;
case 'Month':
$fieldSQL = "DATE_FORMAT(FROM_UNIXTIME(orddate+".$timezoneAdjustment."), '%Y-%m-1')";
$this->addMonth = 1;
$this->taxDateFormat = 'F Y';
break;
case 'Year':
$fieldSQL = "DATE_FORMAT(FROM_UNIXTIME(orddate+".$timezoneAdjustment."), '%Y')";
$this->taxDateFormat = 'Y';
$this->addYear = 1;
break;
}
$this->startStamp = $from_stamp;
$this->lastStamp = $from_stamp;
$this->endStamp = $to_stamp;
$this->dateField = $fieldSQL;
$where = "
orddate >= '" . $from_stamp . "' AND
orddate <= '" . $to_stamp . "'
";
return $where;
}
示例15: GeneratePerformanceIndicatorsTable
/**
* Generate the KPI table for orders, visitors, conversion rate etc.
* Will use the time period from the request if one exists (GET or COOKIE)
* or falls back to the last week.
*
* @return string The generated HTML for the performance indicators table.
*/
public function GeneratePerformanceIndicatorsTable()
{
if (!$this->auth->HasPermission(AUTH_Statistics_Overview)) {
return false;
}
// If we don't have a period coming in via the URL, use the default
if (!isset($_GET['period'])) {
// Is it set in a cookie?
if (isset($_COOKIE['DashboardPerformanceIndicatorsPeriod'])) {
$period = $_COOKIE['DashboardPerformanceIndicatorsPeriod'];
} else {
$period = 'week';
}
} else {
$period = $_GET['period'];
}
// Determine for which dates we need to fetch the statistics
switch ($period) {
case 'week':
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d') - 13, isc_date('y'));
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d') - 6, isc_date('y'));
break;
case 'month':
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m') - 2, isc_date('d'), isc_date('y'));
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m') - 1, isc_date('d'), isc_date('y'));
break;
case 'year':
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d'), isc_date('y') - 2);
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d'), isc_date('y') - 1);
break;
default:
$period = 'day';
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d') - 1, isc_date('y'));
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d'), isc_date('y'));
}
$this->template->Assign('LastPeriodHeader', GetLang('Last' . ucfirst($period)));
$this->template->Assign('ThisPeriodHeader', GetLang('This' . ucfirst($period)));
// Run up until 1 second before the current period. Subtracting 1 second allows us to generate displayable dates for the period.
$lastPeriodTo = $thisPeriodFrom - 1;
if ($period != 'day') {
$this->template->Assign('LastPeriodDateRange', CDate($lastPeriodFrom) . ' - ' . CDate($lastPeriodTo));
$this->template->Assign('ThisPeriodDateRange', CDate($thisPeriodFrom) . ' - ' . CDate(time()));
} else {
$this->template->Assign('LastPeriodDateRange', CDate($lastPeriodFrom));
$this->template->Assign('ThisPeriodDateRange', CDate($thisPeriodFrom));
}
// Calculate the number of orders and the total revenue
$vendorAdd = '';
if ($this->auth->GetVendorId()) {
$vendorAdd .= " AND ordvendorid='" . $this->auth->GetVendorId() . "'";
}
$query = "\n\t\t\tSELECT SUM(ordtotalamount) AS totalrevenue, COUNT(orderid) AS numorders\n\t\t\tFROM [|PREFIX|]orders\n\t\t\tWHERE ordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND orddate >= '" . $lastPeriodFrom . "' AND orddate <= '" . $lastPeriodTo . "' " . $vendorAdd . "\n\t\t";
$result = $this->db->Query($query);
$lastPeriodOrderStats = $this->db->Fetch($result);
$query = "\n\t\t\tSELECT SUM(ordtotalamount) AS totalrevenue, COUNT(orderid) AS numorders\n\t\t\tFROM [|PREFIX|]orders\n\t\t\tWHERE ordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND orddate >= '" . $thisPeriodFrom . "' " . $vendorAdd . "\n\t\t";
$result = $this->db->Query($query);
$thisPeriodOrderStats = $this->db->Fetch($result);
// Calculate the number of visitors
if (!$this->auth->GetVendorId()) {
$query = "\n\t\t\t\tSELECT SUM(numuniques)\n\t\t\t\tFROM [|PREFIX|]unique_visitors\n\t\t\t\tWHERE datestamp >= '" . $lastPeriodFrom . "' AND datestamp <= '" . $lastPeriodTo . "'\n\t\t\t";
$lastPeriodVisitorStats = $this->db->FetchOne($query);
$query = "\n\t\t\t\tSELECT SUM(numuniques)\n\t\t\t\tFROM [|PREFIX|]unique_visitors\n\t\t\t\tWHERE datestamp >= '" . $thisPeriodFrom . "'\n\t\t\t";
$thisPeriodVisitorStats = $this->db->FetchOne($query);
// Calculate the percentage change in visitors between the last period and the current period
$visitorChange = $thisPeriodVisitorStats - $lastPeriodVisitorStats;
$prefix = '';
if ($visitorChange == 0) {
$visitorChangePercent = 0;
} else {
if ($lastPeriodVisitorStats > 0) {
$visitorChangePercent = round($visitorChange / $lastPeriodVisitorStats * 100, 2);
} else {
$visitorChangePercent = 100;
}
}
if ($visitorChangePercent > 0) {
$prefix = '+';
$this->template->Assign('NumVisitorsChangeClass', 'Positive');
} else {
if ($visitorChangePercent < 0) {
$this->template->Assign('NumVisitorsChangeClass', 'Negative');
}
}
$visitorChangePercent = $prefix . number_format($visitorChangePercent, 2) . '%';
$this->template->Assign('LastPeriodNumVisitors', number_format($lastPeriodVisitorStats));
$this->template->Assign('ThisPeriodNumVisitors', number_format($thisPeriodVisitorStats));
$this->template->Assign('NumVisitorsChange', $visitorChangePercent);
$lastConversion = 0;
if ($lastPeriodVisitorStats > 0) {
$lastConversion = $lastPeriodOrderStats['numorders'] / $lastPeriodVisitorStats * 100;
}
$this->template->Assign('LastPeriodConversionRate', number_format(round($lastConversion, 2), 2));
$thisConversion = 0;
//.........这里部分代码省略.........