Exemplo n.º 1
0
		/**
		*	Show a list of orders and the ability to download the product if it's a digital download
		*/
		private function OrderStatus()
		{

			$GLOBALS['SNIPPETS']['AccountOrderStatus'] = "";
			$result = false;
			$this->GetCustomerOrders($result, false, true);

			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$order = $row;
				$GLOBALS['OrderDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['orddate']);
				$GLOBALS['OrderId'] = $row['orderid'];
				$GLOBALS['OrderTotal'] = CurrencyConvertFormatPrice($row['total_inc_tax'], $row['ordcurrencyid'], $row['ordcurrencyexchangerate'], true);
				$GLOBALS['OrderStatus'] = $row['ordstatustext'];

				$GLOBALS['TrackURL'] = "";

				$GLOBALS['HidePaymentInstructions'] = "none";
				$GLOBALS['OrderInstructions'] = "";

				// Is the order status "awaiting payment"? If so show the payment instructions
				if ($row['ordstatus'] == ORDER_STATUS_AWAITING_PAYMENT) {
					$checkout_object = false;
					if (GetModuleById('checkout', $checkout_object, $row['orderpaymentmodule']) && $checkout_object->getpaymenttype("text") == "PAYMENT_PROVIDER_OFFLINE") {
						$GLOBALS['HidePaymentInstructions'] = "";
						if (method_exists($checkout_object, 'GetOfflinePaymentMessage')) {
							// set the order data so any variables that are used in the GetOfflinePaymentMessage function are set correctly
							$paymentData = array(
								'orders' => array($row['orderid'] => $row)
							);
							$checkout_object->SetOrderData($paymentData);
							$GLOBALS['OrderInstructions'] = $checkout_object->GetOfflinePaymentMessage();
						}
						else {
							$GLOBALS['OrderInstructions'] = nl2br(GetModuleVariable($row['orderpaymentmodule'], "helptext"));
						}
					}
				}

				// Get a list of products in the order
				$prod_result = false;
				$products = $this->GetProductsInOrder($row['orderid'], $prod_result);
				$GLOBALS['AccountOrderItemList'] = '';
				while ($prod_row = $GLOBALS['ISC_CLASS_DB']->Fetch($prod_result)) {
					$GLOBALS['ItemName'] = isc_html_escape($prod_row['ordprodname']);
					$GLOBALS['ItemQty'] = $prod_row['ordprodqty'];

					// Is it a downloadable item?
					if ($prod_row['ordprodtype'] == "digital" && OrderIsComplete($row['ordstatus'])) {
						$GLOBALS['DownloadItemEncrypted'] = $this->EncryptDownloadKey($prod_row['orderprodid'], $prod_row['ordprodid'], $row['orderid'], $row['ordtoken']);
						$GLOBALS['DownloadLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemDownloadLink");
					}
					else {
						$GLOBALS['DownloadLink'] = "";
					}

					$GLOBALS['Refunded'] = '';
					if ($prod_row['ordprodrefunded'] > 0) {
						if ($prod_row['ordprodrefunded'] == $prod_row['ordprodqty']) {
							$GLOBALS['StrikeStart'] = "<s>";
							$GLOBALS['StrikeEnd'] = "</s>";
							$GLOBALS['Refunded'] = '<span class="Refunded">'.GetLang('OrderProductRefunded').'</span>';
						}
						else {
							$GLOBALS['Refunded'] = '<span class="Refunded">'.sprintf(GetLang('OrderProductsRefundedX'), $prod_row['ordprodrefunded']).'</span>';
						}
					}

					// Were there one or more options selected?
					$GLOBALS['ProductOptions'] = '';
					if($prod_row['ordprodoptions'] != '') {
						$options = @unserialize($prod_row['ordprodoptions']);
						if(!empty($options)) {
							$GLOBALS['ProductOptions'] = "<br /><small>(";
							$comma = '';
							foreach($options as $name => $value) {
								$GLOBALS['ProductOptions'] .= $comma.isc_html_escape($name).": ".isc_html_escape($value);
								$comma = ', ';
							}
							$GLOBALS['ProductOptions'] .= ")</small>";
						}
					}

					$GLOBALS['HideExpectedReleaseDate'] = 'display:none;';
					$GLOBALS['ExpectedReleaseDate'] = '';

					if ($prod_row['prodpreorder']) {
						if ($prod_row['prodreleasedate']) {
							$message = $prod_row['prodpreordermessage'];
							if (!$message) {
								$message = GetConfig('DefaultPreOrderMessage');
							}
							$GLOBALS['ExpectedReleaseDate'] = '(' . str_replace('%%DATE%%', isc_date(GetConfig('DisplayDateFormat'), $prod_row['prodreleasedate']), $message) . ')';
						} else {
							$GLOBALS['ExpectedReleaseDate'] = '(' . GetLang('PreOrderProduct') . ')';
						}
						$GLOBALS['HideExpectedReleaseDate'] = '';
					}

					$GLOBALS['AccountOrderItemList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemList");
				}

				$GLOBALS['SNIPPETS']['AccountOrderStatus'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderStatusItem");
			}

			if($GLOBALS['SNIPPETS']['AccountOrderStatus']) {
				$GLOBALS['HideNoOrderStatusMessage'] = "none";
			}
			else {
				$GLOBALS['HideOrderStatusList'] = "none";
			}

			$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(sprintf("%s - %s", GetConfig('StoreName'), GetLang('OrderStatus')));
			$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("account_orderstatus");
			$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
		}
Exemplo n.º 2
0
 /**
  *	Show a list of orders and the ability to download the product if it's a digital download
  */
 private function OrderStatus()
 {
     $GLOBALS['SNIPPETS']['AccountOrderStatus'] = "";
     $result = false;
     $this->GetCustomerOrders($result, false, true);
     if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $GLOBALS['OrderDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['orddate']);
             $GLOBALS['OrderId'] = $row['orderid'];
             $GLOBALS['OrderTotal'] = CurrencyConvertFormatPrice($row['ordtotalamount'], $row['ordcurrencyid'], $row['ordcurrencyexchangerate'], true);
             $GLOBALS['OrderStatus'] = $row['ordstatustext'];
             if ($row['ordshipmethod'] && $row['ordshipcost'] > 0) {
                 $GLOBALS['ShippedWith'] = GetLang('ShippedWith') . " <strong><em>" . $row['ordshipmethod'] . "</em></strong>";
             } else {
                 $GLOBALS['ShippedWith'] = Getlang('ShippedWithFreeShipping');
             }
             $GLOBALS['OrderShipper'] = $row['ordshipmethod'];
             $GLOBALS['TrackURL'] = "";
             $GLOBALS['HidePaymentInstructions'] = "none";
             $GLOBALS['OrderInstructions'] = "";
             // Is the order status "awaiting payment"? If so show the payment instructions
             if ($row['ordstatus'] == 7) {
                 $checkout_object = false;
                 if (GetModuleById('checkout', $checkout_object, $row['orderpaymentmodule']) && $checkout_object->getpaymenttype("text") == "PAYMENT_PROVIDER_OFFLINE") {
                     $GLOBALS['HidePaymentInstructions'] = "";
                     $GLOBALS['OrderInstructions'] = nl2br(GetModuleVariable($row['orderpaymentmodule'], "helptext"));
                 }
             }
             if ($row['ordtrackingno']) {
                 $GLOBALS['HideTrackingText'] = "";
                 $GLOBALS['OrderTrackingNo'] = isc_html_escape($row['ordtrackingno']);
                 // Let's instantiate an object for the shipper
                 $shipper_object = false;
                 if ($row['ordershipmodule'] != "" && GetModuleById('shipping', $shipper_object, $row['ordershipmodule'])) {
                     // Does it have a link to track the order?
                     if ($shipper_object->GetTrackingLink() != "") {
                         // Show the tracking link
                         $GLOBALS['TrackURL'] = $shipper_object->GetTrackingLink($row['ordtrackingno']);
                         $GLOBALS['HideTrackingLink'] = "";
                     } else {
                         // Hide the tracking link
                         $GLOBALS['HideTrackingLink'] = "none";
                     }
                 } else {
                     $GLOBALS['HideTrackingLink'] = "none";
                 }
             } else {
                 $GLOBALS['HideTrackingText'] = "none";
                 $GLOBALS['HideTrackingLink'] = "none";
             }
             // If it's a digital order then no shipping details will be set
             if ($row['ordisdigital'] == 0) {
                 $GLOBALS['Recipient'] = isc_html_escape($row['ordshipfirstname'] . ' ' . $row['ordshiplastname']);
             } else {
                 $GLOBALS['Recipient'] = isc_html_escape($row['ordbillfirstname'] . ' ' . $row['ordbilllastname']);
             }
             // Get a list of products in the order
             $prod_result = false;
             $products = $this->GetProductsInOrder($row['orderid'], $prod_result);
             $GLOBALS['AccountOrderItemList'] = '';
             while ($prod_row = $GLOBALS['ISC_CLASS_DB']->Fetch($prod_result)) {
                 $GLOBALS['ItemName'] = isc_html_escape($prod_row['ordprodname']);
                 $GLOBALS['ItemQty'] = $prod_row['ordprodqty'];
                 //var_dump($prod_row['orddateshipped']);
                 //ALANDY 2011-9-13 MODIFY DATA FORMAT.
                 if ($prod_row['orddateshipped'] != '01/01/1900' && !empty($prod_row['orddateshipped'])) {
                     $GLOBALS['ItemShipingDate'] = '<strong>' . GetLang('ShipingDate') . '</strong>' . $prod_row['orddateshipped'];
                 } else {
                     $GLOBALS['ItemShipingDate'] = '';
                 }
                 $GLOBALS['ItemTrackingNo'] = $prod_row['ordtrackingno'] ? '<strong>' . GetLang('TrackingNumber') . '</strong>' . $prod_row['ordtrackingno'] : '';
                 // Is it a downloadable item?
                 if ($prod_row['ordprodtype'] == "digital" && OrderIsComplete($row['ordstatus'])) {
                     $GLOBALS['DownloadItemEncrypted'] = $this->EncryptDownloadKey($prod_row['orderprodid'], $prod_row['ordprodid'], $row['orderid'], $row['ordtoken']);
                     $GLOBALS['DownloadLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemDownloadLink");
                 } else {
                     $GLOBALS['DownloadLink'] = "";
                 }
                 $GLOBALS['Refunded'] = '';
                 if ($prod_row['ordprodrefunded'] > 0) {
                     if ($prod_row['ordprodrefunded'] == $prod_row['ordprodqty']) {
                         $GLOBALS['StrikeStart'] = "<s>";
                         $GLOBALS['StrikeEnd'] = "</s>";
                         $GLOBALS['Refunded'] = '<span class="Refunded">' . GetLang('OrderProductRefunded') . '</span>';
                     } else {
                         $GLOBALS['Refunded'] = '<span class="Refunded">' . sprintf(GetLang('OrderProductsRefundedX'), $prod_row['ordprodrefunded']) . '</span>';
                     }
                 }
                 // Were there one or more options selected?
                 $GLOBALS['ProductOptions'] = '';
                 if ($prod_row['ordprodoptions'] != '') {
                     $options = @unserialize($prod_row['ordprodoptions']);
                     if (!empty($options)) {
                         $GLOBALS['ProductOptions'] = "<br /><small>(";
                         $comma = '';
                         foreach ($options as $name => $value) {
                             $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value);
                             $comma = ', ';
                         }
                         $GLOBALS['ProductOptions'] .= ")</small>";
                     }
                 }
                 $GLOBALS['AccountOrderItemList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemList");
             }
             if ($row['ordisdigital'] == "1") {
                 $GLOBALS['HidePhysicalShipmentInfo'] = "none";
                 $GLOBALS['HideDigitalShipmentInfo'] = "";
             } else {
                 $GLOBALS['HideDigitalShipmentInfo'] = "none";
                 $GLOBALS['HidePhysicalShipmentInfo'] = "";
             }
             if ($row['ordonlygiftcerts']) {
                 $GLOBALS['HideDigitalShipmentInfo'] = 'none';
             }
             // Hide the extra order information is the order isn't complete
             if (!OrderIsComplete($row['ordstatus'])) {
                 $GLOBALS['DisableViewButton'] = "none";
                 $GLOBALS['HideExtraOrderInfo'] = "none";
                 $GLOBALS['HidePhysicalShipmentInfo'] = "none";
                 $GLOBALS['HideDigitalShipmentInfo'] = "none";
             } else {
                 $GLOBALS['DisableViewButton'] = "";
                 $GLOBALS['HideExtraOrderInfo'] = "";
             }
             $GLOBALS['SNIPPETS']['AccountOrderStatus'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderStatusItem");
         }
         $GLOBALS['HideNoOrderStatusMessage'] = "none";
     } else {
         $GLOBALS['HideOrderStatusList'] = "none";
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(sprintf("%s - %s", GetConfig('StoreName'), GetLang('OrderStatus')));
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("account_orderstatus");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }