/** * Admin_Action_Create * Prints the create survey form * * @return Void Returns nothing */ public function Admin_Action_Create() { $this->GetTemplateSystem(); $tpl = $this->template_system; $surveyid = 0; if (isset($_REQUEST['id'])) { $surveyid = (int) $_REQUEST['id']; } $api = self::getApi(); $QuestionTypes = ''; $tpl->Assign('TitleLabel', Getlang('Addon_surveys_Question_Title')); $tpl->Assign('Heading', GetLang('Addon_surveys_Survey_Heading_Create')); $tpl->Assign('Intro', GetLang('Addon_surveys_Survey_Intro_Create')); $form["surveys_header_text"] = GetLang('Addon_surveys_Settings_Header'); $form["show_message"] = GetLang('Addon_surveys_Settings_ShowMessage'); $form["show_uri"] = GetLang('Addon_surveys_Settings_ShowUri'); $form["email"] = GetLang('Addon_surveys_Settings_Email'); $form["error_message"] = GetLang('Addon_surveys_Settings_ErrorMessage'); $form["submit_button_text"] = GetLang('Addon_surveys_Settings_Submit'); $tpl->Assign('form', $form); $tpl->ParseTemplate('survey_form'); }
private function DoPurchaseGiftCertificate() { $errors = array(); // Begin validation! if (GetConfig('GiftCertificateCustomAmounts') == 1) { // Is there a minimum and maximum limit? $minAmount = ConvertPriceToCurrency(GetConfig('GiftCertificateMinimum')); $maxAmount = ConvertPriceToCurrency(GetConfig('GiftCertificateMaximum')); if (!GetConfig('GiftCertificateCustomAmounts')) { $errors[] = GetLang('SelectValidGiftCertificateAmount'); } else { if (!isset($_POST['certificate_amount']) || !is_numeric($_POST['certificate_amount'])) { $errors[] = GetLang('EnterValidGiftCertificateAmount'); } else { if ($minAmount > 0 && $_POST['certificate_amount'] < $minAmount || $maxAmount > 0 && $_POST['certificate_amount'] > $maxAmount) { $errors[] = GetLang('EnterGiftCertificateValueBetween'); } else { $amount = ConvertPriceToDefaultCurrency($_POST['certificate_amount']); } } } } else { if (!in_array($_POST['selected_amount'], GetConfig('GiftCertificateAmounts'))) { $errors[] = GetLang('SelectValidGiftCertificateAmount'); } else { $amount = $_POST['selected_amount']; } } // Did they not enter who they wanted the certificate to be sent to? if (!isset($_POST['to_name']) || trim($_POST['to_name']) == "") { $errors[] = Getlang('EnterValidCertificateToName'); } if (!isset($_POST['to_email']) || !is_email_address($_POST['to_email'])) { $errors[] = GetLang('EnterValidCertificateToEmail'); } // Missing from details? if (!isset($_POST['from_name']) || trim($_POST['from_name']) == "") { $errors[] = GetLang('EnterValidCertificateFromName'); } if (!isset($_POST['from_email']) || !is_email_address($_POST['from_email'])) { $errors[] = GetLang('EnterValidCertificateFromEmail'); } $message = ''; if (isset($_POST['message']) && isc_strlen($_POST['message']) > 200) { $errors[] = GetLang('GiftCertificateMessageTooLong'); } else { if (isset($_POST['message'])) { $message = $_POST['message']; } } // Did they select a valid theme? //$enabledThemes = explode(",", GetConfig('GiftCertificateThemes')); $enabledThemes = $this->getEnabledThemes(); // Only one theme enabled, automagically select it if (count($enabledThemes) == 1) { $_POST['certificate_theme'] = $enabledThemes[0]; } else { if (count($enabledThemes) == 0) { $_POST['certificate_theme'] = 'General'; } else { if (!isset($_POST['certificate_theme']) || !in_array($_POST['certificate_theme'], $enabledThemes)) { $errors[] = GetLang('SelectValidGiftCertificateTheme'); } } } // Now the validation is all done, were there any errors? If yes, throw back to the purchase page if (count($errors) > 0) { $this->PurchaseGiftCertificate($errors); } else { $newCertificate = array("amount" => $amount, "to_name" => $_POST['to_name'], "to_email" => $_POST['to_email'], "from_name" => $_POST['from_name'], "from_email" => $_POST['from_email'], "message" => $_POST['message'], "theme" => $_POST['certificate_theme']); if (isset($_POST['cartitemid']) && $_POST['cartitemid'] >= 0) { $this->UpdateGiftCertificateInCart($_POST['cartitemid'], $newCertificate); $_SESSION['CART']['MESSAGE'] = GetLang('GiftCertificateUpdated'); } else { $this->AddGiftCertificateToCart($newCertificate); $_SESSION['CART']['MESSAGE'] = GetLang('GiftCertificateAddedToCart'); } // Redirect the user to their cart ob_end_clean(); header(sprintf("Location: %s/cart.php", $GLOBALS['ShopPath'])); die; } }
private function DoPurchaseGiftCertificate() { $errors = array(); // Begin validation! if(GetConfig('GiftCertificateCustomAmounts') == 1) { // Is there a minimum and maximum limit? $minAmount = ConvertPriceToCurrency(GetConfig('GiftCertificateMinimum')); $maxAmount = ConvertPriceToCurrency(GetConfig('GiftCertificateMaximum')); if(!GetConfig('GiftCertificateCustomAmounts')) { $errors[] = GetLang('SelectValidGiftCertificateAmount'); } else if(!isset($_POST['certificate_amount']) || !is_numeric($_POST['certificate_amount'])) { $errors[] = GetLang('EnterValidGiftCertificateAmount'); } else if(($minAmount > 0 && $_POST['certificate_amount'] < $minAmount) || ($maxAmount > 0 && $_POST['certificate_amount'] > $maxAmount)) { $errors[] = GetLang('EnterGiftCertificateValueBetween'); } else { $amount = ConvertPriceToDefaultCurrency($_POST['certificate_amount']); } } // Selected a gift certificate amount from the list else { if(!in_array($_POST['selected_amount'], GetConfig('GiftCertificateAmounts'))) { $errors[] = GetLang('SelectValidGiftCertificateAmount'); } else { $amount = $_POST['selected_amount']; } } // Did they not enter who they wanted the certificate to be sent to? if(!isset($_POST['to_name']) || trim($_POST['to_name']) == "") { $errors[] = Getlang('EnterValidCertificateToName'); } if(!isset($_POST['to_email']) || !is_email_address($_POST['to_email'])) { $errors[] = GetLang('EnterValidCertificateToEmail'); } // Missing from details? if(!isset($_POST['from_name']) ||trim($_POST['from_name']) == "") { $errors[] = GetLang('EnterValidCertificateFromName'); } if(!isset($_POST['from_email']) || !is_email_address($_POST['from_email'])) { $errors[] = GetLang('EnterValidCertificateFromEmail'); } $message = ''; if(isset($_POST['message']) && isc_strlen($_POST['message']) > 200) { $errors[] = GetLang('GiftCertificateMessageTooLong'); } else if(isset($_POST['message'])) { $message = $_POST['message']; } // Did they select a valid theme? $enabledThemes = explode(",", GetConfig('GiftCertificateThemes')); // Only one theme enabled, automagically select it if(count($enabledThemes) == 1) { $_POST['certificate_theme'] = $enabledThemes[0]; } else if(empty($enabledThemes)) { $_POST['certificate_theme'] = 'General'; } else if(!isset($_POST['certificate_theme']) || !in_array($_POST['certificate_theme'], $enabledThemes)) { $errors[] = GetLang('SelectValidGiftCertificateTheme'); } // Now the validation is all done, were there any errors? If yes, throw back to the purchase page if(!empty($errors)) { $this->PurchaseGiftCertificate($errors); } // Else, add the gift certificate to the cart else { $newCertificate = array( "amount" => $amount, "to_name" => $_POST['to_name'], "to_email" => $_POST['to_email'], "from_name" => $_POST['from_name'], "from_email" => $_POST['from_email'], "message" => $_POST['message'], "theme" => $_POST['certificate_theme'] ); if(isset($_POST['cartitemid']) && $_POST['cartitemid'] >= 0) { $this->UpdateGiftCertificateInCart($_POST['cartitemid'], $newCertificate); $message = getLang('GiftCertificateUpdated'); } else { $this->AddGiftCertificateToCart($newCertificate); $message = getLang('GiftCertificateAddedToCart'); } flashMessage($message, MSG_SUCCESS, 'cart.php'); } }
/** * 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(); }