Exemple #1
0
/**
 * Get a list of checkout modules that are enabled, configured and that the customer has access to.
 *
 * @param boolean Set to true if we're on the 'confirm order' page.
 * @return array An array of available modules.
 */
function GetCheckoutModulesThatCustomerHasAccessTo($confirmPage=false)
{
	$modules = GetAvailableModules('checkout', true, true);
	$availableModules = array();

	foreach($modules as $module) {
		// Is the module accessible and supported?
		if(!$module['object']->IsAccessible() || !$module['object']->IsSupported()) {
			$module['object']->ResetErrors();
			continue;
		}

		// If we have a vendor order, does the module support these?
		if(!defined('ISC_ADMIN_CP')) {
			// Maybe we're on the "Confirm Order" page
			if($confirmPage && !$module['object']->showOnConfirmPage) {
				continue;
			}
		}

		// Otherwise, the module is available soo add it to the list
		$availableModules[] = $module;
		$module['object']->ResetErrors();
	}
	return $availableModules;
}
Exemple #2
0
	/**
	* Display the store-wide GWO tests list
	*
	*/
	private function manageOptimizer()
	{
		$Tests = GetAvailableModules('optimizer');
		$Output = "";
		$EnabledModules = array();

		$GLOBALS['Message'] = GetFlashMessageBoxes();

		$EnabledModules = GetConfig('OptimizerMethods');

		$GLOBALS['OptimizerRow'] = '';
		foreach ($Tests as $Test) {
			$GLOBALS['ModuleName'] = isc_html_escape($Test['name']);
			$GLOBALS['ModuleId'] = $Test['id'];
			$GLOBALS['ConfiguredIcon'] = 'cross';
			$GLOBALS['ConfiguredDate'] = 'N/A';
			$GLOBALS['ActiveReset'] = 'inactive';

			if($Test['enabled']) {
				$GLOBALS['ActiveReset'] = 'active';
				$GLOBALS['ConfiguredIcon'] = 'tick';
				if(isset($EnabledModules[$Test['id']]) && $EnabledModules[$Test['id']] != '') {
					$GLOBALS['ConfiguredDate'] = isc_date('jS M Y',$EnabledModules[$Test['id']]);
				}
			}
			$GLOBALS['OptimizerRow'] .= $this->template->render('Snippets/OptimizerRow.html');

		}

		$this->template->display('optimizer.manage.tpl');
	}
	private function manageCommentSystemSettings()
	{
		$GLOBALS['BreadcrumEntries'][GetLang('CommentSettingsTitle')] = '';
		$this->template->assign('Message', GetFlashMessageBoxes());

		$tabs = array('general' => GetLang('GeneralSettings'));
		$moduleTabContent = '';

		$systemModules = GetAvailableModules('comments');
		$commentSystems = array();
		foreach ($systemModules as $module) {
			$commentSystems[] = array('label' => $module['name'], 'value' => $module['id'], 'selected' => $module['enabled']);

			// add the module to the list of tabs so it can be configured
			if ($module['enabled']) {
				$tabs[$module['id']] = $module['name'];
				$moduleTabContent .= sprintf('<div id="%s" style="padding-top: 10px;" class="tabContent">%s</div>', $module['id'], $module['object']->GetPropertiesSheet($module['id']));
			}
		}

		$currentTab = 0;
		if (isset($_GET['tab'])) {
			$currentTab = $_GET['tab'];
		}
		$this->template->assign('currentTab', $currentTab);
		$this->template->assign('tabs', $tabs);
		$this->template->assign('commentSystems', $commentSystems);
		$this->template->assign('moduleTabContent', $moduleTabContent);

		$this->engine->PrintHeader();
		$this->template->display('settings.comments.manage.tpl');
		$this->engine->PrintFooter();
	}
 public function SetPanelSettings()
 {
     // Setup the cart values
     $total = $count = 0;
     $GLOBALS['SNIPPETS']['SideCartItems'] = '';
     if (!isset($_SESSION['CART']['ITEMS']) || empty($_SESSION['CART']['ITEMS'])) {
         $this->DontDisplay = true;
         return;
     }
     if (isset($_SESSION['CART']['ITEMS'])) {
         foreach ($_SESSION['CART']['ITEMS'] as $item) {
             $total += $item['product_price'] * $item['quantity'];
             $count += $item['quantity'];
             if (!isset($item['type']) || $item['type'] != "giftcertificate") {
                 $GLOBALS['ProductName'] = "<a href=\"" . ProdLink($item['product_name']) . "\">" . isc_html_escape($item['product_name']) . "</a>";
             } else {
                 $GLOBALS['ProductName'] = isc_html_escape($item['product_name']);
             }
             // Is this product a variation?
             $GLOBALS['ProductOptions'] = '';
             if (isset($item['options']) && !empty($item['options'])) {
                 $GLOBALS['ProductOptions'] .= "<br /><small>(";
                 $comma = '';
                 foreach ($item['options'] as $name => $value) {
                     if (!trim($name) || !trim($value)) {
                         continue;
                     }
                     $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value);
                     $comma = ', ';
                 }
                 $GLOBALS['ProductOptions'] .= ")</small>";
             }
             $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($item['product_price'] * $item['quantity']);
             $GLOBALS['ProductQuantity'] = $item['quantity'];
             $GLOBALS['SNIPPETS']['SideCartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCartItem");
         }
     }
     if ($count == 1) {
         $GLOBALS['SideCartItemCount'] = GetLang('SideCartYouHave1Item');
     } else {
         $GLOBALS['SideCartItemCount'] = sprintf(GetLang('SideCartYouHaveXItems'), $count);
     }
     $GLOBALS['ISC_LANG']['SideCartTotalCost'] = sprintf(GetLang('SideCartTotalCost'), CurrencyConvertFormatPrice($total));
     // Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined
     $GLOBALS['AdditionalCheckoutButtons'] = '';
     $HideCheckout = false;
     foreach (GetAvailableModules('checkout', true, true) as $module) {
         if (method_exists($module['object'], 'GetSidePanelCheckoutButton')) {
             $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetSidePanelCheckoutButton();
         }
         if ($module['object']->disableNonCartCheckoutButtons) {
             $HideCheckout = true;
         }
     }
     if ($HideCheckout) {
         $GLOBALS['SNIPPETS']['SideCartContentsCheckoutLink'] = '';
     } else {
         $GLOBALS['SNIPPETS']['SideCartContentsCheckoutLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SideCartContentsCheckoutLink');
     }
 }
Exemple #5
0
/**
 * Get a list of checkout modules that are enabled, configured and that the customer has access to.
 *
 * @param boolean Set to true if we're on the 'confirm order' page.
 * @return array An array of available modules.
 */
function GetCheckoutModulesThatCustomerHasAccessTo($confirmPage = false)
{
    $modules = GetAvailableModules('checkout', true, true);
    $availableModules = array();
    foreach ($modules as $module) {
        // Is the module accessible and supported?
        if (!$module['object']->IsAccessible() || !$module['object']->IsSupported()) {
            $module['object']->ResetErrors();
            continue;
        }
        // If we have a vendor order, does the module support these?
        if (!defined('ISC_ADMIN_CP')) {
            $cart = GetClass('ISC_CART');
            $cartVendors = $cart->api->GetCartVendorIds();
            if (count($cartVendors) > 1 && $module['object']->IsVendorCompatible() == false) {
                continue;
            }
            // Compatible with split shipping?
            $checkout = GetClass('ISC_CHECKOUT');
            $shippingAddresses = $checkout->GetOrderShippingAddresses();
            if (count($shippingAddresses) > 1 && $module['object']->IsMultiShippingCompatible() == false) {
                continue;
            }
            // Maybe we're on the "Confirm Order" page
            if ($confirmPage && !$module['object']->showOnConfirmPage) {
                continue;
            }
        }
        // Otherwise, the module is available soo add it to the list
        $availableModules[] = $module;
        $module['object']->ResetErrors();
    }
    return $availableModules;
}
Exemple #6
0
		public function SetPanelSettings()
		{
			$numItems = getCustomerQuote()->getNumItems();
			$ShowCheckoutButton = false;
			if($numItems > 0) {
				foreach (GetAvailableModules('checkout', true, true) as $module) {
					if ($module['object']->disableNonCartCheckoutButtons) {
						$GLOBALS['HideCheckoutButton'] = 'display: none';
						$ShowCheckoutButton = false;
						break;
					}
					if (!method_exists($module['object'], 'GetCheckoutButton')) {
						$ShowCheckoutButton = true;
					}
				}
			}

			$GLOBALS['HideCheckoutButton'] = '';

			if (!$ShowCheckoutButton) {
				$GLOBALS['HideCheckoutButton'] = 'display: none';
			}
			$this->insertOptimizerLinkScript();

		}
Exemple #7
0
/**
 * Return the tracking code for all of the enabled analytics modules.
 *
 * @return string The tracking code to be inserted on pages.
 */
function GetTrackingCodeForAllPackages()
{
    $packages = GetAvailableModules('analytics', true, true);
    $code = "";
    foreach ($packages as $package) {
        if (GetModuleById('analytics', $module, $package['id'])) {
            $trackingCode = $module->GetTrackingCode();
        }
        $code .= "<!-- Start Tracking Code for " . $package['id'] . " -->\n\n" . $trackingCode . "\n\n<!-- End Tracking Code for " . $package['id'] . " -->\n\n";
    }
    return $code;
}
Exemple #8
0
 public function SetPanelSettings()
 {
     $ShowCheckoutButton = false;
     if (isset($_SESSION['CART']['NUM_ITEMS']) && $_SESSION['CART']['NUM_ITEMS'] != 0) {
         foreach (GetAvailableModules('checkout', true, true) as $module) {
             if ($module['object']->disableNonCartCheckoutButtons) {
                 $GLOBALS['HideCheckoutButton'] = 'display: none';
                 $ShowCheckoutButton = false;
                 break;
             }
             if (!method_exists($module['object'], 'GetCheckoutButton')) {
                 $ShowCheckoutButton = true;
             }
         }
     }
     $GLOBALS['HideCheckoutButton'] = '';
     if (!$ShowCheckoutButton) {
         $GLOBALS['HideCheckoutButton'] = 'display: none';
     }
 }
	private function manageShippingManagerSettings()
	{
		$GLOBALS['BreadcrumEntries'][GetLang('ShippingManagerSettings')] = '';
		$this->template->assign('Message', GetFlashMessageBoxes());

		$tabs = array('general' => GetLang('GeneralSettings'));
		$moduleTabContent = '';

		$managerModules = GetAvailableModules('shippingmanager');

		$shippingManagers = array();
		$enabledShippingManagers = array();

		foreach ($managerModules as $module) {
			$shippingManagers[$module['id']] = $module['name'];

			// add the module to the list of tabs so it can be configured
			if ($module['enabled']) {
				$tabs[$module['id'] ] = $module['name'];
				$moduleTabContent .= sprintf('<div id="%s" style="padding-top: 10px;" class="tabContent">%s</div>', $module['id'], $module['object']->GetPropertiesSheet($module['id']));
				$enabledShippingManagers[] = $module['id'];
			}
		}

		$currentTab = 'general';
		if (isset($_GET['tab'])) {
			$currentTab = $_GET['tab'];
		}
		$this->template->assign('currentTab', $currentTab);

		$this->template->assign('tabs', $tabs);
		$this->template->assign('shippingManagers', $shippingManagers);
		$this->template->assign('enabledShippingManagers', $enabledShippingManagers);
		$this->template->assign('moduleTabContent', $moduleTabContent);

		$this->engine->PrintHeader();
		$this->template->display('settings.shippingmanager.manage.tpl');
		$this->engine->PrintFooter();
	}
 public function SetPanelSettings()
 {
     $_SESSION['you_save'] = 0;
     //blessen
     $GLOBALS['SNIPPETS']['CartItems'] = "";
     $count = 0;
     $subtotal = 0;
     $_SESSION['CHECKOUT'] = array();
     // Get a list of all products in the cart
     $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
     $product_array = $GLOBALS['ISC_CLASS_CART']->api->GetProductsInCart();
     $GLOBALS['AdditionalCheckoutButtons'] = '';
     // Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined
     $ShowCheckoutButton = false;
     if (!empty($product_array)) {
         foreach (GetAvailableModules('checkout', true, true) as $module) {
             if (isset($module['object']->_showBothButtons) && $module['object']->_showBothButtons) {
                 $ShowCheckoutButton = true;
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } elseif (method_exists($module['object'], 'GetCheckoutButton')) {
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } else {
                 $ShowCheckoutButton = true;
             }
         }
     }
     $GLOBALS['HideMultipleAddressShipping'] = 'display: none';
     if (gzte11(ISC_MEDIUMPRINT) && $GLOBALS['ISC_CLASS_CART']->api->GetNumPhysicalProducts() > 1 && $ShowCheckoutButton && GetConfig("MultipleShippingAddresses")) {
         $GLOBALS['HideMultipleAddressShipping'] = '';
     }
     $GLOBALS['HideCheckoutButton'] = '';
     if (!$ShowCheckoutButton) {
         $GLOBALS['HideCheckoutButton'] = 'display: none';
         $GLOBALS['HideMultipleAddressShippingOr'] = 'display: none';
     }
     $wrappingOptions = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('GiftWrapping');
     if (empty($wrappingOptions)) {
         $publicWrappingOptions = false;
     } else {
         $publicWrappingOptions = true;
     }
     if (!GetConfig('ShowThumbsInCart')) {
         $GLOBALS['HideThumbColumn'] = 'display: none';
         $GLOBALS['ProductNameSpan'] = 2;
     } else {
         $GLOBALS['HideThumbColumn'] = '';
         $GLOBALS['ProductNameSpan'] = 1;
     }
     $wrappingAdjustment = 0;
     $itemTotal = 0;
     foreach ($product_array as $k => $product) {
         $GLOBALS['CartItemId'] = (int) $product['cartitemid'];
         // If the item in the cart is a gift certificate, we need to show a special type of row
         if (isset($product['type']) && $product['type'] == "giftcertificate") {
             $GLOBALS['GiftCertificateName'] = isc_html_escape($product['data']['prodname']);
             $GLOBALS['GiftCertificateAmount'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['GiftCertificateTo'] = isc_html_escape($product['certificate']['to_name']);
             $GLOBALS["Quantity" . $product['quantity']] = 'selected="selected"';
             $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($product['giftamount'] * $product['quantity']);
             $itemTotal += $product['giftamount'] * $product['quantity'];
             $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemGiftCertificate");
         } else {
             $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']);
             $GLOBALS['ProductAvailability'] = isc_html_escape($product['data']['prodavailability']);
             $GLOBALS['ItemId'] = (int) $product['data']['productid'];
             $GLOBALS['VariationId'] = (int) $product['variation_id'];
             $GLOBALS['ProductQuantity'] = (int) $product['quantity'];
             //blessen
             $GLOBALS['prodretailprice'] = CurrencyConvertFormatPrice($product['data']['prodretailprice']);
             if ($product['data']['prodretailprice'] > $product['data']['prodcalculatedprice']) {
                 $_SESSION['you_save'] += ($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']) * $product['quantity'];
             }
             //$GLOBALS['saveprice'] =  CurrencyConvertFormatPrice($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']);
             //blessen
             // Should we show thumbnails in the cart?
             if (GetConfig('ShowThumbsInCart')) {
                 $GLOBALS['ProductImage'] = ImageThumb($product['data']['imagefile'], ProdLink($product['data']['prodname']));
             }
             $GLOBALS['UpdateCartQtyJs'] = "Cart.UpdateQuantity(this.options[this.selectedIndex].value);";
             $GLOBALS['HideCartProductFields'] = 'display:none;';
             $GLOBALS['CartProductFields'] = '';
             $this->GetProductFieldDetails($product['product_fields'], $k);
             $GLOBALS['EventDate'] = '';
             if (isset($product['event_date'])) {
                 $GLOBALS['EventDate'] = '<div style="font-style: italic; font-size:10px; color:gray">(' . $product['event_name'] . ': ' . isc_date('M jS Y', $product['event_date']) . ')</div>';
             }
             // Can this product be wrapped?
             $GLOBALS['GiftWrappingName'] = '';
             $GLOBALS['HideGiftWrappingAdd'] = '';
             $GLOBALS['HideGiftWrappingEdit'] = 'display: none';
             $GLOBALS['HideGiftWrappingPrice'] = 'display: none';
             $GLOBALS['GiftWrappingPrice'] = '';
             $GLOBALS['GiftMessagePreview'] = '';
             $GLOBALS['HideGiftMessagePreview'] = 'display: none';
             $GLOBALS['HideWrappingOptions'] = 'display: none';
             if ($product['data']['prodtype'] == PT_PHYSICAL && $product['data']['prodwrapoptions'] != -1 && $publicWrappingOptions == true) {
                 $GLOBALS['HideWrappingOptions'] = '';
                 if (isset($product['wrapping'])) {
                     $GLOBALS['GiftWrappingName'] = isc_html_escape($product['wrapping']['wrapname']);
                     $GLOBALS['HideGiftWrappingAdd'] = 'display: none';
                     $GLOBALS['HideGiftWrappingEdit'] = '';
                     $GLOBALS['HideGiftWrappingPrice'] = '';
                     $wrappingAdjustment += $product['wrapping']['wrapprice'] * $product['quantity'];
                     $GLOBALS['GiftWrappingPrice'] = CurrencyConvertFormatPrice($product['wrapping']['wrapprice']);
                     if (isset($product['wrapping']['wrapmessage'])) {
                         if (isc_strlen($product['wrapping']['wrapmessage']) > 30) {
                             $product['wrapping']['wrapmessage'] = substr($product['wrapping']['wrapmessage'], 0, 27) . '...';
                         }
                         $GLOBALS['GiftMessagePreview'] = isc_html_escape($product['wrapping']['wrapmessage']);
                         if ($product['wrapping']['wrapmessage']) {
                             $GLOBALS['HideGiftMessagePreview'] = '';
                         }
                     }
                 }
             }
             $subtotalPrice = 0;
             if (isset($product['discount_price'])) {
                 $subtotalPrice = $product['discount_price'];
             } else {
                 $subtotalPrice = $product['product_price'];
             }
             if (isset($product['discount_price']) && $product['discount_price'] != $product['original_price']) {
                 $GLOBALS['ProductPrice'] = sprintf("<s class='CartStrike'>%s</s> %s", CurrencyConvertFormatPrice($product['original_price']), CurrencyConvertFormatPrice($subtotalPrice));
             } else {
                 $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($subtotalPrice);
             }
             $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($subtotalPrice * $product['quantity']);
             $itemTotal += $subtotalPrice * $product['quantity'];
             // If we're using a cart quantity drop down, load that
             if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
                 $GLOBALS["Quantity" . $product['quantity']] = "selected=\"selected\"";
                 if (isset($GLOBALS["Quantity0"])) {
                     $GLOBALS['QtyOptionZero'] = "<option " . $GLOBALS["Quantity0"] . " value='0'>0</option>";
                 } else {
                     $GLOBALS['QtyOptionZero'] = "<option value='0'>0</option>";
                 }
                 // Fixes products being displayed with '0' quantity when the quantity is greater than 30 (hard coded limit in snippet)
                 if ($product['quantity'] > 30) {
                     $GLOBALS["QtyOptionSelected"] = "<option " . $GLOBALS["Quantity" . $product['quantity']] . " value='" . $product['quantity'] . "'>" . $product['quantity'] . "</option>";
                 }
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
             } else {
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
             }
             // Is this product a variation?
             $GLOBALS['ProductOptions'] = '';
             if (isset($product['options']) && !empty($product['options'])) {
                 $GLOBALS['ProductOptions'] .= "<br /><small>(";
                 $comma = '';
                 foreach ($product['options'] as $name => $value) {
                     if (!trim($name) || !trim($value)) {
                         continue;
                     }
                     $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value);
                     $comma = ', ';
                 }
                 $GLOBALS['ProductOptions'] .= ")</small>";
             }
             $GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']);
             //blessen
             $withoutdollar = str_replace("\$", "", $GLOBALS['prodretailprice']);
             if (intval($withoutdollar) <= 0) {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
             } else {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem1");
             }
             //blessen
             // original $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
         }
         $GLOBALS["Quantity" . $product['quantity']] = "";
     }
     if ($wrappingAdjustment > 0) {
         $GLOBALS['GiftWrappingTotal'] = CurrencyConvertFormatPrice($wrappingAdjustment);
     } else {
         $GLOBALS['HideGiftWrappingTotal'] = 'display: none';
     }
     $GLOBALS['HideAdjustedTotal'] = "none";
     $GLOBALS['AdjustedCartSubTotal'] = $GLOBALS['CartSubTotal'] - $GLOBALS['CartSubTotalDiscount'];
     $GLOBALS['CartItemTotal'] = CurrencyConvertFormatPrice($itemTotal);
     $GLOBALS['SNIPPETS']['Coupons'] = '';
     $coupons = $GLOBALS['ISC_CLASS_CART']->api->GetAppliedCouponCodes();
     if (count($coupons)) {
         foreach ($coupons as $coupon) {
             $GLOBALS['CouponId'] = $coupon['couponid'];
             $GLOBALS['CouponCode'] = $coupon['couponcode'];
             // percent coupon
             if ($coupon['coupontype'] == 1) {
                 $discount = $coupon['discount'] . "%";
             } else {
                 $discount = CurrencyConvertFormatPrice($coupon['discount']);
             }
             $GLOBALS['CouponDiscount'] = $discount;
             $GLOBALS['SNIPPETS']['Coupons'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartCoupon");
         }
     }
     $GLOBALS['SNIPPETS']['GiftCertificates'] = '';
     // Has the customer chosen one or more gift certificates to apply to this order? We need to show them
     if (isset($_SESSION['CART']['GIFTCERTIFICATES']) && is_array($_SESSION['CART']['GIFTCERTIFICATES'])) {
         $certificates = $_SESSION['CART']['GIFTCERTIFICATES'];
         uasort($certificates, "GiftCertificateSort");
         foreach ($certificates as $certificate) {
             $GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['giftcertcode']);
             $GLOBALS['GiftCertificateId'] = $certificate['giftcertid'];
             $GLOBALS['GiftCertificateBalance'] = $certificate['giftcertbalance'];
             if ($GLOBALS['GiftCertificateBalance'] > $GLOBALS['AdjustedCartSubTotal']) {
                 $GLOBALS['GiftCertificateRemaining'] = $certificate['giftcertbalance'] - $GLOBALS['AdjustedCartSubTotal'];
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'] - $GLOBALS['GiftCertificateRemaining'];
             } else {
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'];
                 $GLOBALS['GiftCertificateRemaining'] = 0;
             }
             // Subtract this amount from the adjusted total
             $GLOBALS['AdjustedCartSubTotal'] -= $GLOBALS['GiftCertificateBalance'];
             if ($GLOBALS['AdjustedCartSubTotal'] <= 0) {
                 $GLOBALS['AdjustedCartSubTotal'] = 0;
             }
             $GLOBALS['GiftCertificateBalance'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateBalance']);
             $GLOBALS['GiftCertificateRemaining'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateRemaining']);
             $GLOBALS['CertificateAmountUsed'] = CurrencyConvertFormatPrice($GLOBALS['CertificateAmountUsed']);
             $GLOBALS['SNIPPETS']['GiftCertificates'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartGiftCertificate");
         }
         if ($GLOBALS['SNIPPETS']['GiftCertificates']) {
             $GLOBALS['HideAdjustedTotal'] = '';
             if ($GLOBALS['AdjustedCartSubTotal'] == 0) {
                 $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
             }
         }
     }
     if ($GLOBALS['AdjustedCartSubTotal'] != $GLOBALS['CartSubTotal']) {
         $GLOBALS['HideAdjustedTotal'] = "";
         $GLOBALS['AdjustedCartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['AdjustedCartSubTotal']);
     }
     $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal']);
     $GLOBALS['CartSaveTotal'] = CurrencyConvertFormatPrice($_SESSION['you_save']);
     //blessen
     if (!gzte11(ISC_LARGEPRINT)) {
         $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
     }
     // Are there any products in the cart?
     if ($GLOBALS['ISC_CLASS_CART']->api->GetNumProductsInCart() == 0) {
         $GLOBALS['HideShoppingCartGrid'] = "none";
     } else {
         $GLOBALS['HideShoppingCartEmptyMessage'] = "none";
     }
 }
	/**
	* Displays the settings for this module type
	*
	* @return void
	*/
	protected function handleViewEmailIntegrationSettings()
	{
		if (isset($_REQUEST['currentTab'])) {
			$this->template->assign('tab', $_REQUEST['currentTab']);
		}

		$this->engine->addBreadcrumb(GetLang('EmailMarketing'), 'index.php?ToDo=viewEmailIntegrationSettings');

		$this->engine->stylesheets[] = 'Styles/settings.emailintegration.manage.css';
		$this->engine->bodyScripts[] = '../javascript/json2.js';
		$this->engine->bodyScripts[] = 'script/linker.js';
		$this->engine->bodyScripts[] = '../javascript/ajaxDataProvider.js';
		$this->engine->bodyScripts[] = 'script/emailintegration.js';
		$this->engine->bodyScripts[] = 'script/settings.emailintegration.manage.js';

		// full list of modules; for tabs, divs and js
		$modules = GetAvailableModules('emailintegration');

		// for visual purposes, place the export only module at the end
		foreach ($modules as $index => $module) {
			if ($module['id'] == 'emailintegration_exportonly') {
				array_splice($modules, $index, 1);
				$modules[] = $module;
				break;
			}
		}

		// flag to store whether or not there are selectable modules which are enabled -- used to show/hide some form elements
		$enabledSelectableModules = false;

		// add some data to the array returned by GetAvailableModules for display purposes
		foreach ($modules as &$module) {
			$module['provider'] = str_replace('emailintegration_', '', $module['id']);
		}
		unset($module);

		$this->template->assign('modules', $modules);

		// for the twig form builder; a list of selectable modules
		$selectableModules = array();
		foreach ($modules as $module) {
			if ($module['object']->isSelectable()) {
				$selectableModules[$module['id']] = $module['name'];
			}
		}
		$this->template->assign('selectableModules', $selectableModules);

		// for the twig form builder; a list of module tab id / labels and selected modules
		$tabs = array('modules' => GetLang('GeneralSettings'));
		$selectedModules = array();
		foreach ($modules as $module) {
			if (!$module['enabled']) {
				continue;
			}
			$tabs[$module['id']] = $module['name'];
			if ($module['object']->isSelectable()) {
				$enabledSelectableModules = true;
				$selectedModules[] = $module['id'];
			}

			if ($module['object']->getSettingsJavascript()) {
				$this->engine->bodyScripts[] = '../modules/emailintegration/' . $module['provider'] . '/javascript/' . $module['object']->getSettingsJavascript();
			}
		}

		$this->template->assign('enabledSelectableModules', $enabledSelectableModules);
		$this->template->assign('tabs', $tabs);
		$this->template->assign('selectedModules', $selectedModules);

		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
		$this->template->display('settings.emailintegration.manage.tpl');
		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
	}
Exemple #12
0
	/**
	 * Return a list of the enabled live chat modules.
	 *
	 * @return array An array containing the enabled live chat modules.
	 */
	public function GetEnabledModules()
	{
		return GetAvailableModules('livechat', true);
	}
 /**
  * Update the tracking number of an order from the manage orders page
  *
  * @return void
  **/
 private function UpdateTrackingNo()
 {
     if (isset($_REQUEST['o']) && isset($_REQUEST['tn'])) {
         $order_id = (int) $_REQUEST['o'];
         $order = GetOrder($order_id);
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $order['ordvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             echo 0;
             exit;
         }
         $trackingno = $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['tn']);
         $updatedOrder = array("ordtrackingno" => $_REQUEST['tn']);
         if ($GLOBALS['ISC_CLASS_DB']->UpdateQuery("orders", $updatedOrder, "orderid='" . $GLOBALS['ISC_CLASS_DB']->Quote($order_id) . "'")) {
             echo "1";
         } else {
             echo "0";
         }
         // If the checkout module that was used for an order is still enabled and has a function
         // to handle a status change, then call that function
         $valid_checkout_modules = GetAvailableModules('checkout', true, true);
         $valid_checkout_module_ids = array();
         foreach ($valid_checkout_modules as $valid_module) {
             $valid_checkout_module_ids[] = $valid_module['id'];
         }
         $query = "SELECT *\n\t\t\t\tFROM [|PREFIX|]orders\n\t\t\t\tWHERE orderid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($order_id) . "'";
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $order = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         if (in_array($order['orderpaymentmodule'], $valid_checkout_module_ids)) {
             GetModuleById('checkout', $checkout_module, $order['orderpaymentmodule']);
             if (method_exists($checkout_module, 'HandleUpdateTrackingNum')) {
                 call_user_func(array($checkout_module, 'HandleUpdateTrackingNum'), $order_id, $trackingno);
             }
         }
         // Log this action
         $GLOBALS['ISC_CLASS_LOG']->LogAdminAction($order_id, $trackingno);
     }
 }
Exemple #14
0
		/**
		*	Create a view for orders. Uses the same form as searching but puts the
		*	name of the view at the top and it's mandatory instead of optional.
		*/
		protected function CreateView()
		{
			$GLOBALS['OrderPaymentOptions'] = "";
			$GLOBALS['OrderShippingOptions'] = "";
			$GLOBALS['OrderTypeOptions'] = "";

			if (GetConfig('CurrencyLocation') == 'right') {
				$GLOBALS['CurrencyTokenLeft'] = '';
				$GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
			} else {
				$GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
				$GLOBALS['CurrencyTokenRight'] = '';
			}


			$checkout_providers = GetCheckoutModulesThatCustomerHasAccessTo();
			$shipping_providers = GetAvailableModules('shipping', false, true, false);

			foreach($checkout_providers as $provider) {
				$GLOBALS['OrderPaymentOptions'] .= sprintf("<option value='%s'>%s</option>", $provider['object']->GetId(), $provider['object']->GetName());
			}

			if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Ebay_Selling) && gzte11(ISC_LARGEPRINT)) {
				$GLOBALS['OrderTypeOptions'] = $this->GetOrderTypeOptions();
			}

			foreach($shipping_providers as $provider) {
				$GLOBALS['OrderShippingOptions'] .= sprintf("<option value='%s'>%s</option>", $provider['object']->GetId(), $provider['object']->GetName());
			}

			$GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions();
			$this->template->display('orders.view.tpl');
		}
 /**
  *	Create a view for orders. Uses the same form as searching but puts the
  *	name of the view at the top and it's mandatory instead of optional.
  */
 private function CreateView()
 {
     $GLOBALS['OrderPaymentOptions'] = "";
     $GLOBALS['OrderShippingOptions'] = "";
     if (GetConfig('CurrencyLocation') == 'right') {
         $GLOBALS['CurrencyTokenLeft'] = '';
         $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
     } else {
         $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
         $GLOBALS['CurrencyTokenRight'] = '';
     }
     $checkout_providers = GetCheckoutModulesThatCustomerHasAccessTo();
     $shipping_providers = GetAvailableModules('shipping', false, true, false);
     foreach ($checkout_providers as $provider) {
         $GLOBALS['OrderPaymentOptions'] .= sprintf("<option value='%s'>%s</option>", $provider['object']->GetId(), $provider['object']->GetName());
     }
     foreach ($shipping_providers as $provider) {
         $GLOBALS['OrderShippingOptions'] .= sprintf("<option value='%s'>%s</option>", $provider['object']->GetId(), $provider['object']->GetName());
     }
     $GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions();
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("orders.view");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
 /**
  * Create a service request for each configured module
  *
  * Method will initialise each configured module and call the method for creating the service request
  *
  * @access public
  * @param string $type The service request type (customer, product, etc)
  * @param string $service The server to preform (add, edit, etc)
  * @param mixed $nodeid The node ID OR an array containing information about the node
  * @param string $permission The optional permission string needed for this service to work (customer_create, product_edit, etc). Default will not check for permission
  * @return array A array containing the module id as the key and the accountingspoolid on success or FALSE on failure as the value
  */
 public function createServiceRequest($type, $service, $nodeid, $permission = '')
 {
     $rtn = array();
     foreach (GetAvailableModules($this->type, false, true) as $module) {
         if ($permission !== '' && !$module['object']->hasPermission($permission)) {
             continue;
         }
         $rtn[$module['object']->getid()] = $module['object']->createServiceRequest($type, $service, $nodeid);
     }
     return $rtn;
 }
 public function GetCheckoutProvidersAsOptions()
 {
     // Get a list of all available checkout providers as <option> tags
     $checkouts = GetAvailableModules('checkout');
     $output = "";
     foreach ($checkouts as $checkout) {
         $sel = '';
         if ($checkout['enabled']) {
             $sel = 'selected="selected"';
         }
         $output .= sprintf("<option %s value='%s'>%s</option>", $sel, $checkout['id'], $checkout['name']);
     }
     return $output;
 }
Exemple #18
0
		/**
		*	Show the "Thanks for Your Order" page and email an invoice to the customer.
		*	Also clear the outstanding order cookies and related data
		*/
		private function ThanksForYourOrder()
		{
			// Reload all fo the information about the order as there's a good chance
			// a fair bit of it has changed now
			$this->SetOrderData();

			$GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
			$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');

			$GLOBALS['HideError'] = "none";
			$GLOBALS['HidePaidOrderConfirmation'] = '';
			$GLOBALS['HideAwaitingPayment'] = "none";

			$GLOBALS['HideStoreCreditUse'] = 'none';

			if($this->pendingData['storecreditamount'] > 0) {
				$GLOBALS['HideStoreCreditUse'] = '';
				$GLOBALS['StoreCreditUsed'] = CurrencyConvertFormatPrice($this->pendingData['storecreditamount']);

				$GLOBALS['StoreCreditBalance'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerStoreCredit($this->pendingData['customerid']));
				$GLOBALS['ISC_LANG']['OrderCreditDeducted'] = sprintf(GetLang('OrderCreditDeducted'), GetConfig('CurrencyToken') . $GLOBALS['StoreCreditUsed']);
			}

			// If it was an offline payment method, show the post-purchase message and hide other messages
			if(is_object($this->paymentProvider) && $this->paymentProvider->GetPaymentType() == PAYMENT_PROVIDER_OFFLINE && method_exists($this->paymentProvider, 'GetOfflinePaymentMessage')) {
				$defaultCurrency = GetDefaultCurrency();
				$GLOBALS['OrderTotal'] = FormatPrice($this->pendingData['gatewayamount'], false, true, false, $defaultCurrency, true);

				$GLOBALS['HidePaidOrderConfirmation'] = "none";
				$GLOBALS['PaymentMessage'] = $this->paymentProvider->GetOfflinePaymentMessage();
				$GLOBALS['SNIPPETS']['OfflinePaymentMessage'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("OfflinePaymentMessage");
			}
			else {
				// Was the order declined?
				if($this->pendingData['status'] == 6) {
					$GLOBALS['HideError'] = '';
					$GLOBALS['ErrorMessage'] = sprintf(GetLang('ErroOrderDeclined'), GetConfig('OrderEmail'), GetConfig('OrderEmail'));
					$GLOBALS['HidePaidOrderConfirmation'] = 'none';
					$GLOBALS['ISC_LANG']['ThanksForYourOrder'] = GetLang('YourPaymentWasDeclined');
				}
				// Order is still awaiting payment
				else if($this->pendingData['status'] == 7) {
					$GLOBALS['HidePaidOrderConfirmation'] = "none";
					$GLOBALS['HideAwaitingPayment'] = "";
				}
				// Otherwise, order was successful
				else {
					// Is it a physical or digital order?
					if($this->pendingData['isdigital'] == 1) {

						// If this order has no customer ID associated with it (guest checkout with no account creation) then display an alternative text with no download link
						if (!isId($this->pendingData['customerid'])) {
							$GLOBALS['DigitalOrderConfirmation'] = GetLang('DigitalOrderConfirmationGuestCheckout');
							$GLOBALS['HideDigitalOrderDownloadLink'] = 'none';
						}
						// Otherwise display nthe normal text with the download link in it
						else {
							$GLOBALS['DigitalOrderConfirmation'] = GetLang('DigitalOrderConfirmation');
							$GLOBALS['HideDigitalOrderDownloadLink'] = '';
						}

						$GLOBALS['HidePhysicalOrderConfirmation'] = "none";
						$GLOBALS['HidePhysicalViewOrderLink'] = "none";
					}
					else {

						// If this order has no customer ID associated with it (guest checkout with no account creation) then display an alternative text with no view order link
						if (!isId($this->pendingData['customerid'])) {
							$GLOBALS['PhysicalOrderConfirmation'] = GetLang('PhysicalOrderConfirmationGuestCheckout');
							$GLOBALS['HidePhysicalViewOrderLink'] = 'none';
						}
						// Otherwise display nthe normal text with the download link in it
						else {
							$GLOBALS['PhysicalOrderConfirmation'] = GetLang('PhysicalOrderConfirmation');
							$GLOBALS['HidePhysicalViewOrderLink'] = '';
						}

						$GLOBALS['HideDigitalOrderConfirmation'] = "none";
						$GLOBALS['HideDigitalOrderDownloadLink'] = "none";
					}
				}
			}

			// Include the conversion code for each analytics module
			$GLOBALS['ConversionCode'] = '';
			$analyticsModules = GetAvailableModules('analytics', true, true);
			foreach($analyticsModules as $module) {
				$module['object']->SetOrderData($this->pendingData);
				$trackingCode = $module['object']->GetConversionCode();
				if($trackingCode != '') {
					$GLOBALS['ConversionCode'] .= "
						<!-- Start conversion code for ".$module['id']." -->
						".$trackingCode."
						<!-- End conversion code for ".$module['id']." -->
					";
				}
			}

			// Include the conversion tracking code for affiliates
			foreach($this->pendingData['orders'] as $order) {
				if(strlen(GetConfig('AffiliateConversionTrackingCode')) > 0) {
					$converted_code = GetConfig('AffiliateConversionTrackingCode');
					$subTotalColumn = 'subtotal_ex_tax';
					$totalColumn = 'total_inc_tax';
					if(getConfig('taxDefaultTaxDisplayOrders') == TAX_PRICES_DISPLAY_INCLUSIVE) {
						$subTotalColumn = 'subtotal_inc_tax';
					}

					$discountedSubTotal = $_SESSION['LAST_ORDER_DISCOUNTED_SUBTOTAL'];
					unset($_SESSION['LAST_ORDER_DISCOUNTED_SUBTOTAL']);

					$replacements = array(
						'%%ORDER_SUBTOTAL%%' => $order[$subTotalColumn] / 1,
						'%%ORDER_SUBTOTAL_IN_CENTS%%' => ($order[$subTotalColumn] / 1) * 100,
						'%%ORDER_SUBTOTAL_DISCOUNTED%%' => $discountedSubTotal / 1,
						'%%ORDER_SUBTOTAL_DISCOUNTED_IN_CENTS%%' => ($discountedSubTotal / 1) * 100,
						'%%ORDER_AMOUNT%%' => $order['total_inc_tax'] / 1,
						'%%ORDER_AMOUNT_IN_CENTS%%' => ($order['total_inc_tax'] / 1) * 100,
						'%%ORDER_ID%%' => $order['orderid'],
					);
					$converted_code = str_ireplace(array_keys($replacements), $replacements, $converted_code);
					$GLOBALS['ConversionCode'] .= $converted_code;
				}
			}

			// leave this in for outdated templates: hide the product updates div
			$GLOBALS['HideProductUpdates'] = "none";

			if(method_exists($this->paymentProvider, 'ShowOrderConfirmation')) {
				$GLOBALS['OrderConfirmationDetails'] = $this->paymentProvider->ShowOrderConfirmation($this->pendingData);
			}

			// Show the order confirmation screen
			$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(GetLang('ThanksForYourOrder'));
			$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("order");
			$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
		}
Exemple #19
0
		private function EditDiscountStep1()
		{
			$GLOBALS['Title'] = GetLang('EditDiscount');
			$GLOBALS['Intro'] = GetLang('EditDiscountIntro');
			$GLOBALS['Enabled'] = 'checked="checked"';
			$GLOBALS['FormAction'] = "editDiscount2";
			$GLOBALS['DiscountTypes'] = '';
			$GLOBALS['Edit'] = 'display : none;';
			$GLOBALS['DiscountJavascriptValidation'] = '';
			$GLOBALS['DiscountEnabledCheck'] = 'checked="checked"';

			$rules = GetAvailableModules('rule', false, false, false);

			$GLOBALS['RuleList'] = '';

			$GLOBALS['MaxUses'] = '';
			$GLOBALS['DiscountExpiryFields'] = 'display : none';
			$GLOBALS['DiscountMaxUsesDisabled'] = 'readonly="readonly"';
			$GLOBALS['DiscountExpiryDateDisabled'] = 'readonly="readonly"';

			require_once(ISC_BASE_PATH.'/lib/api/discount.api.php');
			$discountAPI = new API_DISCOUNT();

			$discountId = (int) $_GET['discountId'];

			if ($discountAPI->DiscountExists($discountId)) {

				$discount = $this->GetDiscountData($discountId);
				$freeShippingMessageLocations = unserialize($discount['free_shipping_message_location']);
				$GLOBALS['DiscountId'] = $discountId;
				$GLOBALS['DiscountName'] = isc_html_escape($discount['discountname']);

				$module = explode('_',$discount['discountruletype']);

				if (isset($module[1])) {
					GetModuleById('rule', $ruleModule, $module[1]);
					if(!is_object($ruleModule)) {
						// Something really bad went wrong >_<
						exit;
					}
				}
				else {
					die('Can\'t find the module');
				}

				$cd = unserialize($discount['configdata']);

				if (!empty($cd)) {
					foreach ($cd as $var => $data) {

						if (isc_substr($var,0,5) == "varn_") {
							$data = FormatPrice($data, false, false);
						}

						$GLOBALS[$var] = $data;
					}
				}

				$ruleModule->initialize($discount);
				$ruleModule->initializeAdmin();

				$GLOBALS['RuleList'] = '';

				$GLOBALS['Vendor'] = '0';
				if(gzte11(ISC_HUGEPRINT)) {
					$GLOBALS['Vendor'] = 1;
				}

				foreach ($rules as $rule) {
					$rulesSorted[$rule['object']->getRuleType()][] = $rule;
				}

				$first = true;
				$GLOBALS['CurrentRule'] = 'null';

				foreach ($rulesSorted as $type => $ruleType) {

					if ($first) {
						$GLOBALS['RuleList'] .= '<h4 style="margin-top:5px; margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>';
					} else {
						$GLOBALS['RuleList'] .= '<h4 style="margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>';
					}
					$first = false;

					foreach ($ruleType as $rule) {

						$GLOBALS['RuleList'] .= '<label><input type="radio" class="discountRadio" onClick="UpdateModule(this.id,'.(int)$rule['object']->vendorSupport().')" name="RuleType" value="'.$rule['id'].'" ';
						if ($rule['id'] == $discount['discountruletype']) {
							$GLOBALS['RuleList'] .= ' checked="checked" ';
							$GLOBALS['CurrentRule'] = "'".$rule['id']."'";
						}

						$GLOBALS['RuleList'] .= 'id="'.$rule['id'].'"> ';

						if (!(int)$rule['object']->vendorSupport() && $GLOBALS['Vendor'] == 1) {
							$GLOBALS['RuleList'] .= '<span class="aside">'.$rule['object']->getDisplayName().'</span>';
						} else {
							$GLOBALS['RuleList'] .= '<span>'.$rule['object']->getDisplayName().'</span>';
						}

						$GLOBALS['RuleList'] .= '</input></label><br /><div id="ruleWrapper'.$rule['id'].'" class="ruleWrapper"';

						if ($rule['id'] != $discount['discountruletype'])
							$GLOBALS['RuleList'] .= 'style="display : none; "';

						$GLOBALS['RuleList'] .= '><img src="images/nodejoin.gif" style="vertical-align: middle; float:left; padding-right : 10px;" /><span class="ruleSettings" id="ruleSettings'.$rule['id'].'">';

						if ($rule['id'] == $discount['discountruletype'])
							$GLOBALS['RuleList'] .= $ruleModule->getTemplateClass()->render('module.'.$module[1].'.tpl');

						$GLOBALS['RuleList'] .= '</span><br /></div>';
						$GLOBALS['DiscountJavascriptValidation'] .= $rule['object']->getJavascriptValidation();

					}
				}

				$GLOBALS['DiscountMaxUses'] = isc_html_escape($discount['discountmaxuses']);

				if ($discount['discountexpiry'] != 0) {
					$GLOBALS['DiscountExpiryDate'] = date("m/d/Y", isc_html_escape($discount['discountexpiry']));
				} else {
					$GLOBALS['DiscountExpiryDate'] = '';
				}

				$GLOBALS['DiscountExpiryFields'] = 'display : none';
				$GLOBALS['DiscountMaxUsesDisabled'] = 'readonly="readonly"';
				$GLOBALS['DiscountDisabled'] = 'readonly="readonly"';

				if (!empty($GLOBALS['DiscountMaxUses']) || !empty($GLOBALS['DiscountExpiryDate'])) {
					$GLOBALS['DiscountExpiryCheck'] = 'checked="checked"';
					$GLOBALS['DiscountExpiryFields'] = '';
				}

				if (!empty($GLOBALS['DiscountMaxUses'])) {
					$GLOBALS['DiscountMaxUsesCheck'] = 'checked="checked"';
					$GLOBALS['DiscountMaxUsesDisabled'] = '';
				}
				if (!empty($GLOBALS['DiscountExpiryDate'])) {
					$GLOBALS['DiscountExpiryDateCheck'] = 'checked="checked"';
					$GLOBALS['DiscountExpiryDateDisabled'] = '';
				}

				$GLOBALS['DiscountEnabled'] = isc_html_escape($discount['discountenabled']);

				if (empty($GLOBALS['DiscountEnabled'])) {
					$GLOBALS['DiscountEnabledCheck'] = '';
				}

				$GLOBALS['DiscountCurrentUses'] = isc_html_escape($discount['discountcurrentuses']);

				$GLOBALS['MaxUses'] = (int) $discount['discountmaxuses'];
				if($GLOBALS['MaxUses'] > 0) {
					$GLOBALS['MaxUsesChecked'] = 'checked="checked"';
				}
				else {
					$GLOBALS['DiscountMaxUses'] = 1;
					$GLOBALS['MaxUsesHide'] = 'none';
				}
				$this->template->assign('freeShippingMessage', $discount['free_shipping_message']);
				$this->template->assign('freeShippingMessageLocations', $freeShippingMessageLocations);

				$this->template->display('discount.form.tpl');

			}
			else {
				// The discount doesn't exist
				if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Discounts)) {
					$this->ManageDiscounts(GetLang('DiscountDoesntExist'), MSG_ERROR);
				} else {
					$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
				}
			}
		}
Exemple #20
0
 /**
  * GoogleAnalytics:  Google Analytics
  * @author: Wirror Yin
  * @param Int $orderid
  * @return void;
  */
 private function GetGoogleAnalyticsScript($orderid)
 {
     $tracker = GetClass('ISC_VISITOR');
     $TrackingCode .= $tracker->GetTrackingJavascript();
     $TrackingCode .= GetTrackingCodeForAllPackages();
     $ConversionCode = '';
     $query = "\n\t\t\t\tSELECT *\n\t\t\t\tFROM [|PREFIX|]orders\n\t\t\t\tWHERE orderid='{$orderid}'\n\t\t\t";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $pendingArray = array();
     $pendingArray['orders'] = array();
     $orders = array();
     while ($order = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         $orders[] = $order;
         $pendingArray['orders'][$order['orderid']] = $order;
         $pendingArray['total'] += $order['ordtotalamount'];
         if (!$pendingArray['gatewayamount']) {
             $pendingArray['gatewayamount'] = $order['ordgatewayamount'];
         }
         if (!$pendingArray['storecreditamount']) {
             $pendingArray['storecreditamount'] = $order['ordstorecreditamount'];
         }
         if (!$pendingArray['giftcertificateamount']) {
             $pendingArray['giftcertificateamount'] = $order['ordgiftcertificateamount'];
         }
         if (!$pendingArray['companygiftcertificateamount']) {
             $pendingArray['companygiftcertificateamount'] = $order['ordcompanygiftcertificateamount'];
         }
         if ($order['orderpaymentmodule'] != 'giftcertificate' && $order['orderpaymentmodule'] != 'storecredit' && $order['orderpaymentmodule'] != '') {
             $pendingArray['paymentmodule'] = $order['orderpaymentmodule'];
         }
         $pendingArray['paymentmethod'] = $order['orderpaymentmethod'];
         $pendingArray['status'] = $order['ordstatus'];
         $pendingArray['ipaddress'] = $order['ordipaddress'];
         $pendingArray['currencyid'] = $order['ordcurrencyid'];
         $pendingArray['customerid'] = $order['ordcustid'];
         $pendingArray['isdigital'] = $order['ordisdigital'];
     }
     $analyticsModules = GetAvailableModules('analytics', true, true);
     foreach ($analyticsModules as $module) {
         $module['object']->SetOrderData($pendingArray);
         $trackingCode = $module['object']->GetConversionCode();
         if ($trackingCode != '') {
             $ConversionCode .= "\n\t\t\t\t\t\t<!-- Start conversion code for " . $module['id'] . " -->\n\t\t\t\t\t\t" . $trackingCode . "\n\t\t\t\t\t\t<!-- End conversion code for " . $module['id'] . " -->\n\t\t\t\t\t";
         }
     }
     // Include the conversion tracking code for affiliates
     foreach ($orders as $order) {
         if (strlen(GetConfig('AffiliateConversionTrackingCode')) > 0) {
             $converted_code = GetConfig('AffiliateConversionTrackingCode');
             $converted_code = str_ireplace('%%ORDER_AMOUNT%%', $order['ordsubtotal'], $converted_code);
             $converted_code = str_ireplace('%%ORDER_ID%%', $order['orderid'], $converted_code);
             $ConversionCode .= '\\n\\n' . $converted_code;
         }
     }
     $ConversionCode .= $this->GetCampaignCode($orderid);
     return $TrackingCode . $ConversionCode;
 }
Exemple #21
0
/**
 * Update the exchange rates for currencies automatically. (Called via a cron script)
 */
function UpdateCurrenciesFromCron()
{
    /**
     * Just get the first available converter for the time being
     */
    $converters = GetAvailableModules('currency');
    $converter = $converters[0]['object'];
    $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]currencies WHERE currencyisdefault='0'");
    $currencies = array();
    while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
        $currencies[] = $row;
    }
    foreach ($currencies as $row) {
        if (($rate = $converter->GetExchangeRateUsingBase($row['currencycode'])) !== false) {
            $data = array('currencyexchangerate' => $rate, 'currencylastupdated' => time());
            // If for some reason the rate returned 0, then we don't do the update at all
            if ($rate == 0) {
                continue;
            }
            $GLOBALS['ISC_CLASS_DB']->UpdateQuery("currencies", $data, "currencyid='" . $GLOBALS['ISC_CLASS_DB']->Quote((int) $row['currencyid']) . "'");
        }
    }
    // Update the currency cache
    $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateCurrencies();
}
Exemple #22
0
/**
 *	Return a list of notification providers that are enabled but not necessarily configured
 */
function GetEnabledNotificationModules()
{
    $notification_modules = GetAvailableModules('notification', true);
    return $notification_modules;
}
 /**
  * Returns the checkout button for this specific module. Google checkout requires that a
  * seperate button be used for checking out using them
  *
  * @return string The html to show for the button
  **/
 public function GetCheckoutButton()
 {
     $this->BuildCart();
     $ShowNormalCheckoutButton = false;
     foreach (GetAvailableModules('checkout', true, true) as $module) {
         if (!method_exists($module['object'], 'GetCheckoutButton')) {
             $ShowNormalCheckoutButton = true;
             break;
         }
     }
     if ($ShowNormalCheckoutButton) {
         if (stripos($_SERVER["REQUEST_URI"], 'checkout.php') > 0) {
             $GLOBALS['GoogleCheckoutOrUse'] = GetLang('GoogleCheckoutOrUse');
         } else {
             $GLOBALS['GoogleCheckoutOrUse'] = GetLang('GoogleCheckoutOrUse2');
         }
     } else {
         $GLOBALS['GoogleCheckoutOrUse'] = '';
     }
     $GLOBALS['GoogleCheckoutButton'] = $this->cart->CheckoutButtonCode('large', true, 'en_US', false, 'white');
     return $this->ParseTemplate('googlecheckout.button', true);
 }
 public function SetPanelSettings()
 {
     // Setup the cart values
     $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
     $GLOBALS['ISC_CLASS_CART']->SetCartValues();
     $GLOBALS['SNIPPETS']['MiniCartProductAdded'] = "";
     $GLOBALS['SNIPPETS']['MiniCartOtherProduct'] = "";
     foreach (GetAvailableModules('checkout', true, true) as $module) {
         if ($module['object']->disableNonCartCheckoutButtons) {
             $GLOBALS['HideCheckoutButton'] = 'none';
             break;
         }
     }
     $GLOBALS['AdditionalCheckoutButtons'] = '';
     $HideCheckout = false;
     foreach (GetAvailableModules('checkout', true, true) as $module) {
         if (method_exists($module['object'], 'GetSidePanelCheckoutButton')) {
             $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetSidePanelCheckoutButton();
         }
         if ($module['object']->disableNonCartCheckoutButtons) {
             $HideCheckout = true;
         }
     }
     $count = 0;
     $subtotal = 0;
     // Get a list of all products in the cart
     $product_array = $GLOBALS['ISC_CLASS_CART']->api->GetProductsInCart();
     foreach ($product_array as $itemId => $product) {
         $GLOBALS['ProductName'] = isc_html_escape($product['product_name']);
         // Is this product a variation?
         $GLOBALS['ProductOptions'] = '';
         if (isset($product['options']) && !empty($product['options'])) {
             $GLOBALS['ProductOptions'] .= "<small class='CartProductOptionList'>(";
             $comma = '';
             foreach ($product['options'] as $name => $value) {
                 if (!trim($name) || !trim($value)) {
                     continue;
                 }
                 $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value);
                 $comma = ', ';
             }
             $GLOBALS['ProductOptions'] .= ")</small>";
         }
         $GLOBALS['ProductLink'] = '';
         if (!isset($product['type']) || $product['type'] != "giftcertificate") {
             $GLOBALS['ProductImage'] = ImageThumb($product['data']['imagefile'], ProdLink($product['data']['prodname']));
         }
         $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']);
         $GLOBALS['ProductQuantity'] = $product['quantity'];
         if (isset($product['discount_price'])) {
             $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['discount_price']);
             $price = $product['discount_price'];
         } else {
             if (isset($product['type']) && $product['type'] == "giftcertificate") {
                 $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['giftamount']);
                 $price = $product['giftamount'];
             } else {
                 $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['product_price']);
                 $price = $product['product_price'];
             }
         }
         // Update the subtotal
         $subtotal += (int) $product['quantity'] * $price;
         if ($GLOBALS['ISC_CLASS_CART']->newCartItem == $itemId) {
             $GLOBALS['SNIPPETS']['MiniCartProductAdded'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MiniCartProductAdded");
         } else {
             $GLOBALS['SNIPPETS']['MiniCartOtherProduct'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MiniCartOtherProduct");
         }
     }
     $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal']);
     // Should we hide extra info on the mini cart panel?
     if ($GLOBALS['ISC_CLASS_CART']->api->GetNumProductsInCart() < 2) {
         $GLOBALS['HideExtraMiniCartInfo'] = "none";
     }
 }
 public function SetPanelSettings()
 {
     $_SESSION['you_save'] = 0;
     //blessen
     $GLOBALS['SNIPPETS']['CartItems'] = "";
     $count = 0;
     $subtotal = 0;
     $_SESSION['CHECKOUT'] = array();
     // Get a list of all products in the cart
     $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
     $product_array = $GLOBALS['ISC_CLASS_CART']->api->GetProductsInCart();
     /* $cprint = print_r($product_array, true);     
        $q      = "INSERT INTO isc_orderlogs (`ordervalue`) VALUES ('$cprint')";
        $r      = $GLOBALS["ISC_CLASS_DB"]->Query($q); */
     $GLOBALS['AdditionalCheckoutButtons'] = '';
     // Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined
     $ShowCheckoutButton = false;
     if (!empty($product_array)) {
         foreach (GetAvailableModules('checkout', true, true) as $module) {
             if (isset($module['object']->_showBothButtons) && $module['object']->_showBothButtons) {
                 $ShowCheckoutButton = true;
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } elseif (method_exists($module['object'], 'GetCheckoutButton')) {
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } else {
                 $ShowCheckoutButton = true;
             }
         }
     }
     $GLOBALS['HideMultipleAddressShipping'] = 'display: none';
     if (gzte11(ISC_MEDIUMPRINT) && $GLOBALS['ISC_CLASS_CART']->api->GetNumPhysicalProducts() > 1 && $ShowCheckoutButton && GetConfig("MultipleShippingAddresses")) {
         $GLOBALS['HideMultipleAddressShipping'] = '';
     }
     $GLOBALS['HideCheckoutButton'] = '';
     if (!$ShowCheckoutButton) {
         $GLOBALS['HideCheckoutButton'] = 'display: none';
         $GLOBALS['HideMultipleAddressShippingOr'] = 'display: none';
     }
     $wrappingOptions = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('GiftWrapping');
     if (empty($wrappingOptions)) {
         $publicWrappingOptions = false;
     } else {
         $publicWrappingOptions = true;
     }
     if (!GetConfig('ShowThumbsInCart')) {
         $GLOBALS['HideThumbColumn'] = 'display: none';
         $GLOBALS['ProductNameSpan'] = 2;
     } else {
         $GLOBALS['HideThumbColumn'] = '';
         $GLOBALS['ProductNameSpan'] = 1;
     }
     $wrappingAdjustment = 0;
     $itemTotal = 0;
     $comptotal = 0;
     # To get all the complementary product total -- Baskaran
     $compprice = 0;
     foreach ($product_array as $k => $product) {
         $GLOBALS['CartItemId'] = (int) $product['cartitemid'];
         // If the item in the cart is a gift certificate, we need to show a special type of row
         if (isset($product['type']) && $product['type'] == "giftcertificate") {
             $GLOBALS['GiftCertificateName'] = isc_html_escape($product['data']['prodname']);
             $GLOBALS['GiftCertificateAmount'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['GiftCertificateTo'] = isc_html_escape($product['certificate']['to_name']);
             $GLOBALS["Quantity" . $product['quantity']] = 'selected="selected"';
             $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($product['giftamount'] * $product['quantity']);
             $itemTotal += $product['giftamount'] * $product['quantity'];
             $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemGiftCertificate");
         } else {
             $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']);
             $GLOBALS['ProductAvailability'] = isc_html_escape($product['data']['prodavailability']);
             $GLOBALS['ItemId'] = (int) $product['data']['productid'];
             $GLOBALS['VariationId'] = (int) $product['variation_id'];
             $GLOBALS['ProductQuantity'] = (int) $product['quantity'];
             //blessen
             $GLOBALS['prodretailprice'] = CurrencyConvertFormatPrice($product['data']['prodretailprice']);
             if ($product['data']['prodretailprice'] > $product['data']['prodcalculatedprice']) {
                 $_SESSION['you_save'] += ($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']) * $product['quantity'];
             }
             //$GLOBALS['saveprice'] =  CurrencyConvertFormatPrice($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']);
             //blessen
             // Should we show thumbnails in the cart?
             if (GetConfig('ShowThumbsInCart')) {
                 $GLOBALS['ProductImage'] = ImageThumb($product['data']['imagefile'], ProdLink($product['data']['prodname']));
             }
             $GLOBALS['UpdateCartQtyJs'] = "Cart.UpdateQuantity(this.options[this.selectedIndex].value);";
             $GLOBALS['HideCartProductFields'] = 'display:none;';
             $GLOBALS['CartProductFields'] = '';
             $this->GetProductFieldDetails($product['product_fields'], $k);
             $GLOBALS['EventDate'] = '';
             if (isset($product['event_date'])) {
                 $GLOBALS['EventDate'] = '<div style="font-style: italic; font-size:10px; color:gray">(' . $product['event_name'] . ': ' . isc_date('M jS Y', $product['event_date']) . ')</div>';
             }
             // Can this product be wrapped?
             $GLOBALS['GiftWrappingName'] = '';
             $GLOBALS['HideGiftWrappingAdd'] = '';
             $GLOBALS['HideGiftWrappingEdit'] = 'display: none';
             $GLOBALS['HideGiftWrappingPrice'] = 'display: none';
             $GLOBALS['GiftWrappingPrice'] = '';
             $GLOBALS['GiftMessagePreview'] = '';
             $GLOBALS['HideGiftMessagePreview'] = 'display: none';
             $GLOBALS['HideWrappingOptions'] = 'display: none';
             if ($product['data']['prodtype'] == PT_PHYSICAL && $product['data']['prodwrapoptions'] != -1 && $publicWrappingOptions == true) {
                 $GLOBALS['HideWrappingOptions'] = '';
                 if (isset($product['wrapping'])) {
                     $GLOBALS['GiftWrappingName'] = isc_html_escape($product['wrapping']['wrapname']);
                     $GLOBALS['HideGiftWrappingAdd'] = 'display: none';
                     $GLOBALS['HideGiftWrappingEdit'] = '';
                     $GLOBALS['HideGiftWrappingPrice'] = '';
                     $wrappingAdjustment += $product['wrapping']['wrapprice'] * $product['quantity'];
                     $GLOBALS['GiftWrappingPrice'] = CurrencyConvertFormatPrice($product['wrapping']['wrapprice']);
                     if (isset($product['wrapping']['wrapmessage'])) {
                         if (isc_strlen($product['wrapping']['wrapmessage']) > 30) {
                             $product['wrapping']['wrapmessage'] = substr($product['wrapping']['wrapmessage'], 0, 27) . '...';
                         }
                         $GLOBALS['GiftMessagePreview'] = isc_html_escape($product['wrapping']['wrapmessage']);
                         if ($product['wrapping']['wrapmessage']) {
                             $GLOBALS['HideGiftMessagePreview'] = '';
                         }
                     }
                 }
             }
             $subtotalPrice = 0;
             if (isset($product['discount_price'])) {
                 $subtotalPrice = $product['discount_price'];
             } else {
                 $subtotalPrice = $product['product_price'];
             }
             $GLOBALS['ShowOnSaleImage'] = '';
             if (isset($product['discount_price']) && $product['discount_price'] != $product['original_price'] && GetConfig('ShowOnSale')) {
                 $GLOBALS['ProductPrice'] = sprintf("<s class='CartStrike'>%s</s> %s", CurrencyConvertFormatPrice($product['original_price']), CurrencyConvertFormatPrice($subtotalPrice));
                 if (isset($product['discount']) && isset($product['couponcode'])) {
                     $GLOBALS['ShowOnSaleImage'] = "Coupon Applied";
                 } else {
                     $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                 }
             } else {
                 $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($subtotalPrice);
             }
             $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($subtotalPrice * $product['quantity']);
             $itemTotal += $subtotalPrice * $product['quantity'];
             // If we're using a cart quantity drop down, load that
             if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
                 $GLOBALS["Quantity" . $product['quantity']] = "selected=\"selected\"";
                 if (isset($GLOBALS["Quantity0"])) {
                     $GLOBALS['QtyOptionZero'] = "<option " . $GLOBALS["Quantity0"] . " value='0'>0</option>";
                 } else {
                     $GLOBALS['QtyOptionZero'] = "<option value='0'>0</option>";
                 }
                 // Fixes products being displayed with '0' quantity when the quantity is greater than 30 (hard coded limit in snippet)
                 if ($product['quantity'] > 30) {
                     $GLOBALS["QtyOptionSelected"] = "<option " . $GLOBALS["Quantity" . $product['quantity']] . " value='" . $product['quantity'] . "'>" . $product['quantity'] . "</option>";
                 }
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
             } else {
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
             }
             // Is this product a variation?
             $GLOBALS['ProductOptions'] = '';
             if (isset($product['options']) && !empty($product['options'])) {
                 $GLOBALS['ProductOptions'] .= "<br /><small>(";
                 $comma = '';
                 foreach ($product['options'] as $name => $value) {
                     if (!trim($name) || !trim($value)) {
                         continue;
                     }
                     $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value);
                     $comma = ', ';
                 }
                 $GLOBALS['ProductOptions'] .= ")</small>";
             }
             //temp script to shortern the product name
             $pid = $product['data']['productid'];
             $pcode = $product['data']['prodcode'];
             $querytemp = "SELECT prodbrandid FROM  [|PREFIX|]products where productid = " . $pid . "  ";
             $resulttemp = $GLOBALS['ISC_CLASS_DB']->Query($querytemp);
             $brand = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp);
             if ($brand['prodbrandid'] == 37) {
                 $querytemp1 = "SELECT c.catname, c.catcombine FROM [|PREFIX|]categories \tc left join [|PREFIX|]categoryassociations ca on c.categoryid = ca.categoryid  left join [|PREFIX|]products p on ca.productid = p.productid where p.productid =  '" . $pid . "' ";
                 $resulttemp1 = $GLOBALS['ISC_CLASS_DB']->Query($querytemp1);
                 $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp1);
                 if ($cat['catcombine'] != "") {
                     $GLOBALS['ProductName'] = $cat['catcombine'] . " Part Number " . $pcode;
                 } else {
                     $GLOBALS['ProductName'] = $cat['catname'] . " Part Number " . $pcode;
                 }
             } else {
                 $GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']);
             }
             //temp script to shortern the product name
             //temp script to shortern the product name
             $GLOBALS['complementaryrow'] = '';
             $compitem = $product['compitem'];
             if ($compitem == 1) {
                 for ($y = 0; $y < count($product['complementary']); $y++) {
                     /* Added for to display the complementary product in the cart -- Baskaran */
                     $compproductid = $product['complementary'][$y]['comp_productid'];
                     $compmainproductid = $product['complementary'][$y]['comp_mainproductid'];
                     $mainproductid = $product['product_id'];
                     $GLOBALS['CompCartItemId'] = $y;
                     if ($mainproductid == $compmainproductid) {
                         $GLOBALS['CompProdName'] = $compprodname = isc_html_escape($product['complementary'][$y]['comp_product_name']);
                         $compsku = isc_html_escape($product['complementary'][$y]['comp_product_code']);
                         $compprice = $product['complementary'][$y]['comp_original_price'];
                         $GLOBALS['CompProductPrice'] = $comppriceformat = CurrencyConvertFormatPrice($product['complementary'][$y]['comp_original_price']);
                         $query = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT imagefile FROM [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' where p.productid = '{$compproductid}' AND p.prodvisible = '1' ");
                         $path = '';
                         if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($query)) {
                             $path = $row['imagefile'];
                         }
                         if ($path != '') {
                             $GLOBALS['ProdImage'] = GetConfig('ShopPath') . "/product_images/{$path}";
                         } else {
                             $GLOBALS['ProdImage'] = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
                         }
                         //Added for complementary products - By Simha..
                         // If we're using a cart quantity drop down, load that
                         if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
                             $GLOBALS["CompQuantity" . $product['complementary'][$y]['quantity']] = "selected=\"selected\"";
                             if (isset($GLOBALS["Quantity0"])) {
                                 $GLOBALS['CompCartQtyOptionZero'] = "<option " . $GLOBALS["Quantity0"] . " value='0'>0</option>";
                             } else {
                                 $GLOBALS['CompCartQtyOptionZero'] = "<option value='0'>0</option>";
                             }
                             // Fixes products being displayed with '0' quantity when the quantity is greater than 30 (hard coded limit in snippet)
                             if ($product['quantity'] > 30) {
                                 //Needed to be changed for the complementary
                                 $GLOBALS["CompCartQtyOptionSelected"] = "<option " . $GLOBALS["Quantity" . $product['complementary'][$y]['quantity']] . " value='" . $product['complementary'][$y]['quantity'] . "'>" . $product['complementary'][$y]['quantity'] . "</option>";
                             }
                             $GLOBALS['CompCartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompItemQtySelect");
                         } else {
                             $GLOBALS['CompCartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompItemQtyText");
                         }
                         //Added for complementary products Ends - By Simha..
                         $GLOBALS['CompProductTotal'] = CurrencyConvertFormatPrice($compprice * $product['complementary'][$y]['quantity']);
                         $GLOBALS['complementaryrow'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ComplementaryItem");
                         $comptotal += $compprice * $product['complementary'][$y]['quantity'];
                     }
                     $GLOBALS["CompQuantity" . $product['complementary'][$y]['quantity']] = "";
                 }
             }
             /* Code Ends */
             //$GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']);
             //blessen
             $withoutdollar = str_replace("\$", "", $GLOBALS['prodretailprice']);
             if (intval($withoutdollar) <= 0) {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
             } else {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem1");
             }
             //blessen
             // original $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
         }
         $GLOBALS["Quantity" . $product['quantity']] = "";
     }
     if ($wrappingAdjustment > 0) {
         $GLOBALS['GiftWrappingTotal'] = CurrencyConvertFormatPrice($wrappingAdjustment);
     } else {
         $GLOBALS['HideGiftWrappingTotal'] = 'display: none';
     }
     $GLOBALS['HideAdjustedTotal'] = "none";
     $GLOBALS['AdjustedCartSubTotal'] = $GLOBALS['CartSubTotal'] - $GLOBALS['CartSubTotalDiscount'];
     $itemTotal += $comptotal;
     # Baskaran
     $GLOBALS['CartItemTotal'] = CurrencyConvertFormatPrice($itemTotal);
     $GLOBALS['SNIPPETS']['Coupons'] = '';
     $coupons = $GLOBALS['ISC_CLASS_CART']->api->GetAppliedCouponCodes();
     if (count($coupons)) {
         foreach ($coupons as $coupon) {
             $GLOBALS['CouponId'] = $coupon['couponid'];
             $GLOBALS['CouponCode'] = $coupon['couponcode'];
             // percent coupon
             if ($coupon['coupontype'] == 1) {
                 $discount = $coupon['discount'] . "%";
             } else {
                 $discount = CurrencyConvertFormatPrice($coupon['discount']);
             }
             $GLOBALS['CouponDiscount'] = $discount;
             $GLOBALS['SNIPPETS']['Coupons'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartCoupon");
         }
     }
     $GLOBALS['SNIPPETS']['GiftCertificates'] = '';
     // Has the customer chosen one or more gift certificates to apply to this order? We need to show them
     if (isset($_SESSION['CART']['GIFTCERTIFICATES']) && is_array($_SESSION['CART']['GIFTCERTIFICATES'])) {
         $certificates = $_SESSION['CART']['GIFTCERTIFICATES'];
         uasort($certificates, "GiftCertificateSort");
         foreach ($certificates as $certificate) {
             $GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['giftcertcode']);
             $GLOBALS['GiftCertificateId'] = $certificate['giftcertid'];
             $GLOBALS['GiftCertificateBalance'] = $certificate['giftcertbalance'];
             if ($GLOBALS['GiftCertificateBalance'] > $GLOBALS['AdjustedCartSubTotal']) {
                 $GLOBALS['GiftCertificateRemaining'] = $certificate['giftcertbalance'] - $GLOBALS['AdjustedCartSubTotal'];
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'] - $GLOBALS['GiftCertificateRemaining'];
             } else {
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'];
                 $GLOBALS['GiftCertificateRemaining'] = 0;
             }
             // Subtract this amount from the adjusted total
             $GLOBALS['AdjustedCartSubTotal'] -= $GLOBALS['GiftCertificateBalance'];
             if ($GLOBALS['AdjustedCartSubTotal'] <= 0) {
                 $GLOBALS['AdjustedCartSubTotal'] = 0;
             }
             $GLOBALS['GiftCertificateBalance'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateBalance']);
             $GLOBALS['GiftCertificateRemaining'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateRemaining']);
             $GLOBALS['CertificateAmountUsed'] = CurrencyConvertFormatPrice($GLOBALS['CertificateAmountUsed']);
             $GLOBALS['SNIPPETS']['GiftCertificates'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartGiftCertificate");
         }
         if ($GLOBALS['SNIPPETS']['GiftCertificates']) {
             $GLOBALS['HideAdjustedTotal'] = '';
             if ($GLOBALS['AdjustedCartSubTotal'] == 0) {
                 $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
             }
         }
     }
     if ($GLOBALS['AdjustedCartSubTotal'] != $GLOBALS['CartSubTotal']) {
         $GLOBALS['HideAdjustedTotal'] = "";
         $GLOBALS['AdjustedCartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['AdjustedCartSubTotal']);
     }
     //            $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal']);
     $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal'] + $comptotal);
     # To add the subtotal in the cart -- Baskaran
     $GLOBALS['CartSaveTotal'] = CurrencyConvertFormatPrice($_SESSION['you_save']);
     //blessen
     if (!gzte11(ISC_LARGEPRINT)) {
         $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
     }
     // Are there any products in the cart?
     if ($GLOBALS['ISC_CLASS_CART']->api->GetNumProductsInCart() == 0) {
         $GLOBALS['HideShoppingCartGrid'] = "none";
     } else {
         $GLOBALS['HideShoppingCartEmptyMessage'] = "none";
     }
 }
Exemple #26
0
	public function UpdateReturnStatus(&$return, $status, $crediting = false)
	{

		// Start a transaction
		$GLOBALS['ISC_CLASS_DB']->Query("START TRANSACTION");

		// Changing the status of this return to "Refunded", so we need to perform some additional things
		if($status == 5 && $return['retstatus'] != 5) {
			$refundAmount = $return['retprodcost'] * $return['retprodqty'];
			$updatedProduct = array(
				"ordprodrefundamount" => $return['retprodcost'],
				"ordprodrefunded" => $return['retprodqty'],
				"ordprodreturnid" => $return['returnid']
			);

			$order = getOrder($return['retorderid']);
			if (!$order) {
				return false;
			}

			$GLOBALS['ISC_CLASS_DB']->UpdateQuery("order_products", $updatedProduct, "orderprodid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['retordprodid'])."'");

			$query = "
				UPDATE [|PREFIX|]orders
				SET ordrefundedamount = ordrefundedamount + ".$refundAmount."
				WHERE orderid='".$return['retorderid']."'
			";
			$this->db->query($query);

			// Have all items in this order been refunded? Mark the order as refunded.
			$query = sprintf("SELECT SUM(ordprodqty-ordprodrefunded) FROM [|PREFIX|]order_products WHERE orderorderid=%d", $return['retorderid']);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$remainingItems = $GLOBALS['ISC_CLASS_DB']->FetchOne($result);
			if($remainingItems == 0) {
				$updatedOrder = array(
					'ordstatus' => 4
				);
				$GLOBALS['ISC_CLASS_DB']->UpdateQuery("orders", $updatedOrder, "orderid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['retorderid'])."'");
			}

			// Update the status of this return
			$updatedReturn = array(
				"retstatus" => 5,
				"retuserid" => $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUserId()
			);
			$GLOBALS['ISC_CLASS_DB']->UpdateQuery("returns", $updatedReturn, "returnid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['returnid'])."'");

			// Update the product inventory for this returned item
			$query = sprintf("SELECT * FROM [|PREFIX|]order_products WHERE ordprodid='%d'", $return['retordprodid']);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);

			UpdateInventoryOnReturn($return['retordprodid']);

			// dont send a refund through the checkout module if a store credit was issued
			if (!$crediting) {
				// If the checkout module that was used for an order is still enabled and has a function
				// to handle a status change, then call that function
				$valid_checkout_modules = GetAvailableModules('checkout', true, true);
				$valid_checkout_module_ids = array();
				foreach ($valid_checkout_modules as $valid_module) {
					$valid_checkout_module_ids[] = $valid_module['id'];
				}

				$newStatus = $order['ordstatus'];
				if (isset($updatedOrder['ordstatus'])) {
					$newStatus = $updatedOrder['ordstatus'];
				}

				// attempt to refund this amount with the checkout provider
				$order = GetOrder($return['retorderid'], false);
				if (in_array($order['orderpaymentmodule'], $valid_checkout_module_ids)) {
					GetModuleById('checkout', $checkout_module, $order['orderpaymentmodule']);
					if (method_exists($checkout_module, 'HandleStatusChange')) {
						call_user_func(array($checkout_module, 'HandleStatusChange'), $return['retorderid'], $order['ordstatus'], $newStatus, $refundAmount);
					}
				}
			}
		}
		else {
			// Update the status of this return
			$updatedReturn = array(
				"retstatus" => $status
			);
			$GLOBALS['ISC_CLASS_DB']->UpdateQuery("returns", $updatedReturn, "returnid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['returnid'])."'");
		}

		$return['retstatus'] = $status;

		if(GetConfig('NotifyOnReturnStatusChange') == 1) {
			$this->EmailReturnStatusChange($return);
		}

		if($GLOBALS['ISC_CLASS_DB']->GetErrorMsg() == "") {
			$GLOBALS['ISC_CLASS_DB']->Query("COMMIT");
			return true;
		}
		else {
			return false;
		}
	}
 private function GetAnalyticsPackagesAsOptions()
 {
     // Get a list of all available analytics modules as <option> tags
     $analytics = GetAvailableModules('analytics');
     $output = "";
     foreach ($analytics as $package) {
         $sel = '';
         if ($package['enabled']) {
             $sel = 'selected="selected"';
         }
         $output .= sprintf("<option %s value='%s'>%s</option>", $sel, $package['id'], $package['name']);
     }
     return $output;
 }
 /**
  * Returns the checkout button for this specific module. Paypal website payment pro requires that a
  * seperate button be used for checking out using them
  *
  * @return string The html to show for the button
  **/
 public function GetCheckoutButton()
 {
     $ShowNormalCheckoutButton = false;
     foreach (GetAvailableModules('checkout', true, true) as $module) {
         if (!method_exists($module['object'], 'GetCheckoutButton')) {
             $ShowNormalCheckoutButton = true;
             break;
         }
     }
     if ($ShowNormalCheckoutButton) {
         $GLOBALS['PayPalPaymentsProOrUse'] = GetLang('PayPalPaymentsProOrUse');
     } else {
         $GLOBALS['PayPalPaymentsProOrUse'] = '';
     }
     return $this->ParseTemplate('paypalpaymentsprouk.button', true);
 }
Exemple #29
0
	public function SetPanelSettings()
	{
		$GLOBALS['SNIPPETS']['SideCartItems'] = '';

		// We check $_SESSION['QUOTE'] directly here as to not
		// instantiate the quote if it doesn't already exist.
		if(!isset($_SESSION['QUOTE']) && getCustomerQuote()->getNumItems() == 0) {
			$this->DontDisplay = true;
			return;
		}

		$incTax = false;
		if(getConfig('taxDefaultTaxDisplayCart') != TAX_PRICES_DISPLAY_EXCLUSIVE) {
			$incTax = true;
		}

		$quote = getCustomerQuote();
		$items = $quote->getItems();
		foreach($items as $item) {
			if($item->getProductId()) {
				$GLOBALS['ProductName'] = "<a href=\"".ProdLink($item->getName())."\">".isc_html_escape($item->getName())."</a>";
			}
			else {
				$GLOBALS['ProductName'] = isc_html_escape($item->getName());
			}

			// Is this product a variation?
			$GLOBALS['ProductOptions'] = '';
			$options = $item->getVariationOptions();
			if(!empty($options)) {
				$GLOBALS['ProductOptions'] .= "<br /><small>(";
				$comma = '';
				foreach($options as $name => $value) {
					if(!trim($name) || !trim($value)) {
						continue;
					}
					$GLOBALS['ProductOptions'] .= $comma.isc_html_escape($name).": ".isc_html_escape($value);
					$comma = ', ';
				}
				$GLOBALS['ProductOptions'] .= ")</small>";
			}

			$GLOBALS['ProductPrice'] = currencyConvertFormatPrice($item->getTotal($incTax));
			$GLOBALS['ProductQuantity'] = $item->getQuantity();
			$GLOBALS['SNIPPETS']['SideCartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCartItem");
		}

		$numItems = $quote->getNumItems();
		if($numItems == 1) {
			$GLOBALS['SideCartItemCount'] = GetLang('SideCartYouHave1Item');
		} else {
			$GLOBALS['SideCartItemCount'] = sprintf(GetLang('SideCartYouHaveXItems'), $numItems);
		}

		$total = $quote->getSubTotal($incTax);
		$GLOBALS['ISC_LANG']['SideCartTotalCost'] = sprintf(GetLang('SideCartTotalCost'), CurrencyConvertFormatPrice($total));

		// Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined
		$GLOBALS['AdditionalCheckoutButtons'] = '';
		$HideCheckout = false;
		foreach (GetAvailableModules('checkout', true, true) as $module) {
			if (method_exists($module['object'], 'GetSidePanelCheckoutButton')) {
				$GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetSidePanelCheckoutButton();
			}

			if ($module['object']->disableNonCartCheckoutButtons) {
				$HideCheckout = true;
			}

		}

		if ($HideCheckout) {
			$GLOBALS['SNIPPETS']['SideCartContentsCheckoutLink'] = '';
		} else {
			require_once ISC_BASE_PATH.'/includes/display/CartHeader.php';

			$cartPanel = getClass('ISC_CARTHEADER_PANEL');
			$cartPanel -> insertOptimizerLinkScript();
			$GLOBALS['SNIPPETS']['SideCartContentsCheckoutLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SideCartContentsCheckoutLink');
		}

	}
Exemple #30
0
/**
 * Update the status of an order.
 *
 * @param mixed Either an array of order IDs to update, or an integer for a single order ID.
 * @param int The new status of the order.
 * @param boolean Should emails be sent out if the email on status change feature is enabled?
 * @param boolean Set to true if this status update is in a pingback from a payment module and payment modules should not be notified of the change.
 * @return boolean True if successful.
 */
function UpdateOrderStatus($orderIds, $status, $email=true, $preventModuleUpdateCallback=false)
{
	if(!is_array($orderIds)) {
		$orderIds = array($orderIds);
	}

	foreach($orderIds as $orderId) {
		$order = GetOrder($orderId, false);

		if (!$order || !$order['orderid']) {
			return false;
		}

		// Start transaction
		$GLOBALS['ISC_CLASS_DB']->Query("START TRANSACTION");

		$existing_status = $order['ordstatus'];

		// If the order is incomplete, it needs to be completed first
		if($existing_status == 0) {
			CompletePendingOrder($order['ordtoken'], $status, $email);
		}

		$updatedOrder = array(
			"ordstatus" => (int)$status,
			"ordlastmodified" => time(),
		);

		// If the order status is 2 or 10 (completed, shipped) then set the orddateshipped timestamp
		if (OrderIsComplete($status)) {
			$updatedOrder['orddateshipped'] = time();
		}

		// Update the status for this order
		if ($GLOBALS['ISC_CLASS_DB']->UpdateQuery("orders", $updatedOrder, "orderid=" . (int)$orderId)) {
			// Fetch the name of the status this order was changed to
			$query = sprintf("SELECT statusdesc FROM [|PREFIX|]order_status WHERE statusid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($status));
			$result2 = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$statusName = $GLOBALS['ISC_CLASS_DB']->FetchOne($result2);

			// Log this action if we are in the control panel
			if (defined('ISC_ADMIN_CP')) {
				$GLOBALS['ISC_CLASS_LOG']->LogAdminAction($orderId, $statusName);
			}

			// This order was marked as refunded or cancelled
			if ($status == ORDER_STATUS_REFUNDED || $status == ORDER_STATUS_CANCELLED) {
				// If the inventory levels for products in this order have previously been changed, we need to
				// return the inventory too
				if ($order['ordinventoryupdated'] == 1) {
					UpdateInventoryOnReturn($orderId);
				}

				// Marked as refunded or cancelled, need to cancel the gift certificates in this order too if there are any
				$updatedCertificates = array(
					"giftcertstatus" => 3
				);
				$GLOBALS['ISC_CLASS_DB']->UpdateQuery("gift_certificates", $updatedCertificates, "giftcertorderid='" . $GLOBALS['ISC_CLASS_DB']->Quote($orderId) . "'");
			}
			// This order was marked as completed/shipped as long as the inventory hasn't been adjusted previously
			else if (OrderIsComplete($status)) {
				if ($order['ordinventoryupdated'] == 0) {
					DecreaseInventoryFromOrder($orderId);
				}

				// Send out gift certificates if the order wasn't already complete
				if (!OrderIsComplete($existing_status)) {
					$GLOBALS['ISC_CLASS_GIFT_CERTIFICATES'] = GetClass('ISC_GIFTCERTIFICATES');
					$GLOBALS['ISC_CLASS_GIFT_CERTIFICATES']->ActivateGiftCertificates($orderId);
				}
			}
		}

		// Was there an error? If not, commit
		if ($GLOBALS['ISC_CLASS_DB']->Error() == "") {
			$GLOBALS['ISC_CLASS_DB']->Query("COMMIT");

			// Does the customer now need to be notified for this status change?
			$statuses = explode(",", GetConfig('OrderStatusNotifications'));
			if (in_array($status, $statuses) && $email == true) {
				foreach($orderIds as $orderId) {
					EmailOnStatusChange($orderId, $status);
				}
			}

			// If the checkout module that was used for an order is still enabled and has a function
			// to handle a status change, then call that function
			if($preventModuleUpdateCallback == false) {
				$valid_checkout_modules = GetAvailableModules('checkout', true, true);
				$valid_checkout_module_ids = array();
				foreach ($valid_checkout_modules as $valid_module) {
					$valid_checkout_module_ids[] = $valid_module['id'];
				}

				foreach($orderIds as $orderId) {
					$order = GetOrder($orderId, false);

					if (in_array($order['orderpaymentmodule'], $valid_checkout_module_ids)) {
						GetModuleById('checkout', $checkout_module, $order['orderpaymentmodule']);
						if (method_exists($checkout_module, 'HandleStatusChange')) {
							call_user_func(array($checkout_module, 'HandleStatusChange'), $orderId, $existing_status, $status, 0);
						}
					}
				}
			}

			return true;
		}
		else {
			return false;
		}
	}

	return false;
}