コード例 #1
0
/**
 * Mask for imageThumb for smarty (can be registered as a template function).
 * 
 * @param array<mixed> $params parameters from smarty tag.
 * @param Smarty_Internal_TemplateBase $smarty smarty reference.
 */
function smartyImageThumb($params, $smarty)
{
    if (isset($params['image'])) {
        $image = $params['image'];
        $width = isset($params['width']) ? intval($params['width']) : NULL;
        $height = isset($params['height']) ? intval($params['height']) : NULL;
        return imageThumb($image, $width, $height);
    }
    return '';
}
コード例 #2
0
ファイル: detail.php プロジェクト: huiralb/horestco-ci
<h1><?php 
echo $product->name;
?>
</h1>
<p><?php 
echo $product->description;
?>
</p>

<?php 
foreach ($product->images as $key => $image) {
    if ($image->sort_order == 1) {
        ?>
	<?php 
        imageThumb($image->id, '', '');
    }
    ?>
	<?php 
    imageThumb($image->id, 250, 188);
}
コード例 #3
0
ファイル: CartContent.php プロジェクト: hungnv0789/vhtm
	/**
	 * Generate the body of the 'CartContent' panel, including the list of
	 * products in the customer's shopping cart and the subtotal.
	 */
	public function generateCartContent()
	{
		if(!GetConfig('ShowThumbsInCart')) {
			$GLOBALS['HideThumbColumn'] = 'display: none';
			$GLOBALS['ProductNameSpan'] = 2;
		}
		else {
			$GLOBALS['HideThumbColumn'] = '';
			$GLOBALS['ProductNameSpan'] = 1;
		}

		$GLOBALS['SNIPPETS']['CartItems'] = "";

		$items = $this->quote->getItems();
		foreach($items as $item) {
			$name = $item->getName();
			$quantity = $item->getQuantity();

			$GLOBALS['CartItemId'] = $item->getId();

			if($item instanceof ISC_QUOTE_ITEM_GIFTCERTIFICATE) {
				$GLOBALS['GiftCertificateName'] = isc_html_escape($name);
				$GLOBALS['GiftCertificateAmount'] = CurrencyConvertFormatPrice($item->getPrice());
				$GLOBALS['GiftCertificateTo'] = isc_html_escape($item->getRecipientName());
				$GLOBALS["Quantity" . $quantity] = 'selected="selected"';
				$GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($item->getPrice());
				$GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($item->getTotal());
				$GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemGiftCertificate");
				continue;
			}

			$GLOBALS['ProductName'] = isc_html_escape($name);
			$GLOBALS['ProductLink'] = prodLink($name);
			$GLOBALS['ProductAvailability'] = $item->getAvailability();
			$GLOBALS['ItemId'] = $item->getProductId();
			$GLOBALS['VariationId'] = $item->getVariationId();
			$GLOBALS['ProductQuantity'] = $quantity;

			if(getConfig('ShowThumbsInCart')) {
				$GLOBALS['ProductImage'] = imageThumb($item->getThumbnail(), prodLink($name));
			}

			$GLOBALS['UpdateCartQtyJs'] = "Cart.UpdateQuantity(this.options[this.selectedIndex].value);";
			$GLOBALS['HideCartProductFields'] = 'display:none;';
			$GLOBALS['CartProductFields'] = '';
			$this->GetProductFieldDetails($item->getConfiguration(), $item->getId());

			$GLOBALS['EventDate'] = '';
			$eventDate = $item->getEventDate(true);
			if(!empty($eventDate)) {
				$GLOBALS['EventDate'] = '
					<div style="font-style: italic; font-size:10px; color:gray">(' .
						$item->getEventName() . ': ' . isc_date('M jS Y', $eventDate) .
					')</div>';
			}

			$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($item->allowsGiftWrapping()) {
				$wrapping = $item->getGiftWrapping();
				$GLOBALS['HideWrappingOptions'] = '';
				if(!empty($wrapping)) {
					$GLOBALS['GiftWrappingName'] = isc_html_escape($wrapping['wrapname']);
					$GLOBALS['HideGiftWrappingAdd'] = 'display: none';
					$GLOBALS['HideGiftWrappingEdit'] = '';
					$GLOBALS['HideGiftWrappingPrice'] = '';
					$GLOBALS['GiftWrappingPrice'] = CurrencyConvertFormatPrice($wrapping['wrapprice']);
					if(!empty($wrapping['wrapmessage'])) {
						if(isc_strlen($wrapping['wrapmessage']) > 30) {
							$wrapping['wrapmessage'] = substr($wrapping['wrapmessage'], 0, 27).'...';
						}
						$GLOBALS['GiftMessagePreview'] = isc_html_escape($wrapping['wrapmessage']);
						$GLOBALS['HideGiftMessagePreview'] = '';
					}
				}
				else {
					$GLOBALS['HideGiftWrappingAdd'] = '';
				}
			}

			$price = $item->getPrice($this->displayIncludingTax);
			$total = $item->getTotal($this->displayIncludingTax);

			$GLOBALS['ProductPrice'] = currencyConvertFormatPrice($price);
			$GLOBALS['ProductTotal'] = currencyConvertFormatPrice($total);

			// Don't allow the quantity of free items/parent restricted items to be changed
			$GLOBALS['HideCartItemRemove'] = '';
			if($item->getParentId()) {
				$GLOBALS['CartItemQty'] = number_format($item->getQuantity());
				$GLOBALS['HideCartItemRemove'] = 'display: none';
			}
			// If we're using a cart quantity drop down, load that
			else if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
				$GLOBALS["Quantity" . $quantity] = "selected=\"selected\"";
				if($quantity == 0) {
					$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 ($quantity > 30) {
					$GLOBALS["QtyOptionSelected"] = "<option ".$GLOBALS["Quantity" . $quantity]." value='" . $quantity . "'>" . $quantity . "</option>";
				}
				$GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
			}
			// Otherwise, load the textbox
			else {
				$GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
			}

			// 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['HideExpectedReleaseDate'] = 'display: none;';
			if($item->isPreOrder()) {
				$GLOBALS['ProductExpectedReleaseDate'] = $item->getPreOrderMessage();
				$GLOBALS['HideExpectedReleaseDate'] = '';
			}

			$GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
			$GLOBALS["Quantity" . $quantity] = "";
		}

		$GLOBALS['CartItemTotal'] = currencyConvertFormatPrice($this->quote->getSubTotal($this->displayIncludingTax));
		$GLOBALS['CartTotal'] = currencyConvertFormatPrice($this->quote->getGrandTotal());

		if($this->quote->getWrappingCost() > 0) {
			$GLOBALS['GiftWrappingTotal'] = currencyConvertFormatPrice($this->quote->getWrappingCost());
		}
		else {
			$GLOBALS['HideGiftWrappingTotal'] = 'display: none';
		}
		$script = "
			$('.quantityInput').live('change', function() {
				Cart.UpdateQuantity($(this).val());
			});
		";
		$GLOBALS['ISC_CLASS_TEMPLATE']->clientScript->registerScript($script,'ready');

	}
コード例 #4
0
    private function _getImage($resources)
    {
        $rId = $this->seachImagerId('<wp:docPr' , $resources);
        if(!empty($rId)) {
            $fileName = $this->getImgFileName($rId);
            if(!empty($fileName)) {
                $src = BACKEND_V2_TRASH_PATH . '/word/media/' . $fileName;

                $ext = pathinfo($src, PATHINFO_EXTENSION);
                $newFileName = uniqid(date('YmdHis')) . '.' . $ext;

                $desc = PATH_UPLOADS_NO_ROOT . 'images/' . $newFileName;
                if(file_exists($src)) {
                    $imgThumb = imageThumb($src, $desc);
                    $newPath = base_url() . 'public/uploads/images/' . $newFileName;
                    return "<img src='$newPath' /> ";
                }
            }
        }
        return '';
    }
コード例 #5
0
        if ($resize) {
            $ico = imageThumb($ico, $width, $height);
        }
        $w = imagesx($ico);
        $h = imagesy($ico);
        $css .= 'div.sysmap_iconid_' . $image['imageid'] . '{' . ' height: ' . $h . 'px;' . ' width: ' . $w . 'px;' . ' background: url("imgstore.php?iconid=' . $image['imageid'] . '&width=' . $w . '&height=' . $h . '") no-repeat center center;}' . "\n";
    }
    echo $css;
} elseif (isset($_REQUEST['iconid'])) {
    $iconid = get_request('iconid', 0);
    if ($iconid > 0) {
        $image = get_image_by_imageid($iconid);
        $image = $image['image'];
        $source = imageFromString($image);
    } else {
        $source = get_default_image();
    }
    if ($resize) {
        $source = imageThumb($source, $width, $height);
    }
    imageOut($source);
} elseif (isset($_REQUEST['imageid'])) {
    $imageid = get_request('imageid', 0);
    session_start();
    if (isset($_SESSION['image_id'][$imageid])) {
        echo $_SESSION['image_id'][$imageid];
        unset($_SESSION['image_id'][$imageid]);
    }
    session_write_close();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
コード例 #6
0
ファイル: class.checkout.php プロジェクト: hungnv0789/vhtm
	/**
	 * Build the contents for the order confirmation page. This function sets up everything to be used by
	 * the order confirmation on the express checkout page as well as the ConfirmOrder page when using a
	 * multi step checkout.
	 */
	public function BuildOrderConfirmation()
	{
		$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
		if(!GetConfig('ShowMailingListInvite')) {
			$GLOBALS['HideMailingListInvite'] = 'none';
		}

		// Do we need to show the special offers & discounts checkbox and should they
		// either of the newsletter checkboxes be ticked by default?
		if (GetConfig('MailAutomaticallyTickNewsletterBox')) {
			$GLOBALS['NewsletterBoxIsTicked'] = 'checked="checked"';
		}

		if (ISC_EMAILINTEGRATION::doOrderAddRulesExist()) {
			if (GetConfig('MailAutomaticallyTickOrderBox')) {
				$GLOBALS['OrderBoxIsTicked'] = 'checked="checked"';
			}
		}
		else {
			$GLOBALS['HideOrderCheckBox'] = "none";
		}

		if(isset($_REQUEST['ordercomments'])) {
			$GLOBALS['OrderComments'] = $_REQUEST['ordercomments'];
		}

		// Now we check if we have an incoming coupon or gift certificate code to apply
		if (isset($_REQUEST['couponcode']) && $_REQUEST['couponcode'] != '') {
			$code = trim($_REQUEST['couponcode']);

			// Were we passed a gift certificate code?
			if (self::isCertificateCode($code)) {
				try {
					$this->getQuote()->applyGiftCertificate($code);

					// If successful show a message
					$GLOBALS['CheckoutSuccessMsg'] = GetLang('GiftCertificateAppliedToCart');
				}
				catch(ISC_QUOTE_EXCEPTION $e) {
					$GLOBALS['CheckoutErrorMsg'] = $e->getMessage();
				}
			}
			// Otherwise, it must be a coupon code
			else {
				try {
					$this->getQuote()->applyCoupon($code);

					// Coupon code applied successfully
					$GLOBALS['CheckoutSuccessMsg'] = GetLang('CouponAppliedToCart');
				}
				catch(ISC_QUOTE_EXCEPTION $e) {
					$GLOBALS['CheckoutErrorMsg'] = $e->getMessage();
				}
			}
		}

		$GLOBALS['ISC_CLASS_ACCOUNT'] = GetClass('ISC_ACCOUNT');

		// Determine what we'll be showing for the redeem gift certificate/coupon code box
		if (gzte11(ISC_LARGEPRINT)) {
			$GLOBALS['RedeemTitle'] = GetLang('RedeemGiftCertificateOrCoupon');
			$GLOBALS['RedeemIntro'] = GetLang('RedeemGiftCertificateorCouponIntro');
		}
		else {
			$GLOBALS['RedeemTitle'] = GetLang('RedeemCouponCode');
			$GLOBALS['RedeemIntro'] = GetLang('RedeemCouponCodeIntro');
		}

		$GLOBALS['HideCheckoutError'] = "none";
		$GLOBALS['HidePaymentOptions'] = "";
		$GLOBALS['HideUseCoupon'] = '';
		$checkoutProviders = array();

		// if the provider list html is set in session then use it as the payment provider options.
		// it's normally set in payment modules when it's required.
		if(isset($_SESSION['CHECKOUT']['ProviderListHTML'])) {
			$GLOBALS['HidePaymentProviderList'] = "";
			$GLOBALS['HidePaymentOptions'] = "";
			$GLOBALS['PaymentProviders'] = $_SESSION['CHECKOUT']['ProviderListHTML'];
			$GLOBALS['StoreCreditPaymentProviders'] = $_SESSION['CHECKOUT']['ProviderListHTML'];
			$GLOBALS['CheckoutWith'] = "";
		} else {
			// Get a list of checkout providers
			$checkoutProviders = GetCheckoutModulesThatCustomerHasAccessTo(true);


			// If no checkout providers are set up, send an email to the store owner and show an error message
			if (empty($checkoutProviders)) {
				$GLOBALS['HideConfirmOrderPage'] = "none";
				$GLOBALS['HideCheckoutError'] = '';
				$GLOBALS['HideTopPaymentButton'] = "none";
				$GLOBALS['HidePaymentProviderList'] = "none";
				$GLOBALS['CheckoutErrorMsg'] = GetLang('NoCheckoutProviders');
				$GLOBALS['NoCheckoutProvidersError'] = sprintf(GetLang("NoCheckoutProvidersErrorLong"), $GLOBALS['ShopPath']);

				$GLOBALS['EmailHeader'] = GetLang("NoCheckoutProvidersSubject");
				$GLOBALS['EmailMessage'] = sprintf(GetLang("NoCheckoutProvidersErrorLong"), $GLOBALS['ShopPath']);

				$emailTemplate = FetchEmailTemplateParser();
				$emailTemplate->SetTemplate("general_email");
				$message = $emailTemplate->ParseTemplate(true);

				require_once(ISC_BASE_PATH . "/lib/email.php");
				$obj_email = GetEmailClass();
				$obj_email->Set('CharSet', GetConfig('CharacterSet'));
				$obj_email->From(GetConfig('OrderEmail'), GetConfig('StoreName'));
				$obj_email->Set("Subject", GetLang("NoCheckoutProvidersSubject"));
				$obj_email->AddBody("html", $message);
				$obj_email->AddRecipient(GetConfig('AdminEmail'), "", "h");
				$email_result = $obj_email->Send();
			}

			// We have more than one payment provider, hide the top button and build a list
			else if (count($checkoutProviders) > 1) {
				$GLOBALS['HideTopPaymentButton'] = "none";
				$GLOBALS['HideCheckoutError'] = "none";
			}

			// There's only one payment provider - hide the list
			else {
				$GLOBALS['HidePaymentProviderList'] = "none";
				$GLOBALS['HideCheckoutError'] = "none";
				$GLOBALS['HidePaymentOptions'] = "none";
				list(,$provider) = each($checkoutProviders);
				if(method_exists($provider['object'], 'ShowPaymentForm') && !isset($_SESSION['CHECKOUT']['ProviderListHTML'])) {
					$GLOBALS['ExpressCheckoutLoadPaymentForm'] = 'ExpressCheckout.ShowSingleMethodPaymentForm();';
				}
				if ($provider['object']->GetPaymentType() == PAYMENT_PROVIDER_OFFLINE) {
					$GLOBALS['PaymentButtonSwitch'] = "ShowContinueButton();";
				}
				$GLOBALS['CheckoutWith'] = $provider['object']->GetDisplayName();
			}

			// Build the list of payment provider options
			$GLOBALS['PaymentProviders'] = $GLOBALS['StoreCreditPaymentProviders'] =  "";
			foreach ($checkoutProviders as $provider) {
				$GLOBALS['ProviderChecked'] = '';
				if(count($checkoutProviders) == 1) {
					$GLOBALS['ProviderChecked'] = 'checked="checked"';
				}
				$GLOBALS['ProviderId'] = $provider['object']->GetId();
				$GLOBALS['ProviderName'] = isc_html_escape($provider['object']->GetDisplayName());
				$GLOBALS['ProviderType'] = $provider['object']->GetPaymentType("text");
				if(method_exists($provider['object'], 'ShowPaymentForm')) {
					$GLOBALS['ProviderPaymentFormClass'] = 'ProviderHasPaymentForm';
				}
				else {
					$GLOBALS['ProviderPaymentFormClass'] = '';
				}
				$GLOBALS['PaymentFieldPrefix'] = '';
				$GLOBALS['PaymentProviders'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutProviderOption");
				$GLOBALS['PaymentFieldPrefix'] = 'credit_';
				$GLOBALS['StoreCreditPaymentProviders'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutProviderOption");
			}

		}

		// Are we coming back to this page for a particular reason?
		if (isset($_SESSION['REDIRECT_TO_CONFIRMATION_MSG'])) {
			$GLOBALS['HideCheckoutError'] = '';
			$GLOBALS['CheckoutErrorMsg'] = $_SESSION['REDIRECT_TO_CONFIRMATION_MSG'];
			unset($_SESSION['REDIRECT_TO_CONFIRMATION_MSG']);
		}

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

		$items = $this->getQuote()->getItems();

		// Start building the summary of all of the items in the order
		$GLOBALS['SNIPPETS']['CartItems'] = '';
		foreach ($items as $item) {
			$GLOBALS['ProductQuantity'] = $item->getQuantity();

			$price = $item->getPrice($displayIncludingTax);
			$total = $item->getTotal($displayIncludingTax);
			$GLOBALS['ProductPrice'] = currencyConvertFormatPrice($price);
			$GLOBALS['ProductTotal'] = currencyConvertFormatPrice($total);

			if($item instanceof ISC_QUOTE_ITEM_GIFTCERTIFICATE) {
				$GLOBALS['GiftCertificateName'] = isc_html_escape($item->getName());
				$GLOBALS['GiftCertificateTo'] = isc_html_escape($item->getRecipientName());
				$GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutCartItemGiftCertificate");
				continue;
			}

			$GLOBALS['ProductAvailability'] = $item->getAvailability();
			$GLOBALS['ItemId'] = $item->getProductId();

			// 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['EventDate'] = '';
			$eventDate = $item->getEventDate(true);
			if(!empty($eventDate)) {
				$GLOBALS['EventDate'] = '
					<div style="font-style: italic; font-size:10px; color:gray">(' .
						$item->getEventName() . ': ' . isc_date('M jS Y', $eventDate) .
					')</div>';
			}

			$GLOBALS['HideGiftWrapping'] = 'display: none';
			$GLOBALS['GiftWrappingName'] = '';
			$GLOBALS['GiftMessagePreview'] = '';
			$GLOBALS['HideGiftMessagePreview'] = 'display: none';

			$wrapping = $item->getGiftWrapping();
			if($wrapping !== false) {
				$GLOBALS['HideGiftWrapping'] = '';
				$GLOBALS['GiftWrappingName'] = isc_html_escape($wrapping['wrapname']);
				if(!empty($wrapping['wrapmessage'])) {
					if(isc_strlen($wrapping['wrapmessage']) > 30) {
						$wrapping['wrapmessage'] = substr($wrapping['wrapmessage'], 0, 27).'...';
					}
					$GLOBALS['GiftMessagePreview'] = isc_html_escape($wrapping['wrapmessage']);
					$GLOBALS['HideGiftMessagePreview'] = '';
				}
			}

			//create configurable product fields on order confirmation page with the data posted from add to cart page
			$GLOBALS['CartProductFields'] = '';
			$configuration = $item->getConfiguration();
			if (!empty($configuration)) {
				require_once ISC_BASE_PATH.'/includes/display/CartContent.php';
				ISC_CARTCONTENT_PANEL::GetProductFieldDetails($configuration, $item->getId());
			}

			$GLOBALS['ProductName'] = isc_html_escape($item->getName());
			$GLOBALS['ProductImage'] = imageThumb($item->getThumbnail(), prodLink($item->getName()));

			$GLOBALS['HideExpectedReleaseDate'] = 'display: none;';
			if($item->isPreOrder()) {
				$GLOBALS['ProductExpectedReleaseDate'] = $item->getPreOrderMessage();
				$GLOBALS['HideExpectedReleaseDate'] = '';
			}

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

		// Do we have a shipping price to show?
		if(!$this->getQuote()->isDigital()) {
			$shippingAddresses = $this->getQuote()->getShippingAddresses();
			$numShippingAddresses = count($shippingAddresses);
			if($numShippingAddresses == 1) {
				$shippingAddress = $this->getQuote()->getShippingAddress();
				$GLOBALS['ShippingAddress'] = $GLOBALS['ISC_CLASS_ACCOUNT']->FormatShippingAddress($shippingAddress->getAsArray());
			}
			else {
				$GLOBALS['ShippingAddress'] = '<em>(Order will be shipped to multiple addresses)</em>';
			}

			// Show the shipping details
			$GLOBALS['HideShippingDetails'] = '';
		}
		// This is a digital order - no shipping applies
		else {
			$GLOBALS['HideShippingDetails'] = 'display: none';
			$GLOBALS['HideShoppingCartShippingCost'] = 'none';
			$GLOBALS['ShippingAddress'] = GetLang('NotRequiredForDigitalDownloads');
			$GLOBALS['ShippingMethod'] = GetLang('ShippingImmediateDownload');
		}

		$billingAddress = $this->getQuote()->getBillingAddress();
		$GLOBALS['BillingAddress'] = getClass('ISC_ACCOUNT')
			->formatShippingAddress($billingAddress->getAsArray());

		$totalRows = self::getQuoteTotalRows($this->getQuote());
		$templateTotalRows = '';
		foreach($totalRows as $id => $totalRow) {
			$GLOBALS['ISC_CLASS_TEMPLATE']->assign('label', $totalRow['label']);
			$GLOBALS['ISC_CLASS_TEMPLATE']->assign('classNameAppend', ucfirst($id));
			$value = currencyConvertFormatPrice($totalRow['value']);
			$GLOBALS['ISC_CLASS_TEMPLATE']->assign('value', $value);
			$templateTotalRows .= $GLOBALS['ISC_CLASS_TEMPLATE']->getSnippet('CheckoutCartTotal');
		}
		$GLOBALS['ISC_CLASS_TEMPLATE']->assign('totals', $templateTotalRows);

		$grandTotal = $this->getQuote()->getGrandTotal();
		$GLOBALS['GrandTotal'] = formatPrice($grandTotal);
		if($grandTotal == 0) {
			$GLOBALS['HidePaymentOptions'] = "none";
			$GLOBALS['HideUseCoupon'] = 'none';
			$GLOBALS['HidePaymentProviderList'] = "none";
			$GLOBALS['PaymentButtonSwitch'] = "ShowContinueButton(); ExpressCheckout.UncheckPaymentProvider();";
		}

		// Does the customer have any store credit they can use?
		$GLOBALS['HideUseStoreCredit'] = "none";
		$GLOBALS['HideRemainingStoreCredit'] = "none";
		$customer = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerDataByToken();
		if ($customer['custstorecredit'] > 0) {
			$GLOBALS['HidePaymentOptions'] = "";
			$GLOBALS['StoreCredit'] = CurrencyConvertFormatPrice($customer['custstorecredit']);
			$GLOBALS['HideUseStoreCredit'] = "";
			$GLOBALS['HidePaymentProviderList'] = "none";
			// The customer has enough store credit to pay for the entirity of this order
			if ($customer['custstorecredit'] >= $grandTotal) {
				$GLOBALS['PaymentButtonSwitch'] = "ShowContinueButton();";
				$GLOBALS['HideLimitedCreditWarning'] = "none";
				$GLOBALS['HideLimitedCreditPaymentOption'] = "none";
				$GLOBALS['HideCreditPaymentMethods'] = "none";
				$GLOBALS['RemainingCredit'] = $customer['custstorecredit'] - $grandTotal;
				if ($GLOBALS['RemainingCredit'] > 0) {
					$GLOBALS['HideRemainingStoreCredit'] = '';
					$GLOBALS['RemainingCredit'] = CurrencyConvertFormatPrice($GLOBALS['RemainingCredit']);
				}
			}
			// Customer doesn't have enough store credit to pay for the order
			else {
				$GLOBALS['Remaining'] = CurrencyConvertFormatPrice($grandTotal-$customer['custstorecredit']);

				if(count($checkoutProviders) == 1) {
					$GLOBALS['CheckoutStoreCreditWarning'] = sprintf(GetLang('CheckoutStoreCreditWarning2'), $GLOBALS['Remaining'], $GLOBALS['CheckoutWith']);
					$GLOBALS['HideLimitedCreditPaymentOption'] = "none";
				}
				else {
					$GLOBALS['CheckoutStoreCreditWarning'] = GetLang('CheckoutStoreCreditWarning');
				}
				$GLOBALS['ISC_LANG']['CreditPaymentMethod'] = sprintf(GetLang('CreditPaymentMethod'), $GLOBALS['Remaining']);
			}

			if (count($checkoutProviders) > 1) {
				$GLOBALS['CreditAlt'] = GetLang('CheckoutCreditAlt');
			}
			else if (count($checkoutProviders) <= 1 && isset($GLOBALS['CheckoutWith'])) {
				$GLOBALS['CreditAlt'] = sprintf(GetLang('CheckoutCreditAltOneMethod'), $GLOBALS['CheckoutWith']);
			}
			else {
				if ($customer['custstorecredit'] >= $grandTotal) {
					$GLOBALS['HideCreditAltOptionList'] = "none";
					$GLOBALS['HideConfirmOrderPage'] = "";
					$GLOBALS['HideTopPaymentButton'] = "none";
					$GLOBALS['HideCheckoutError'] = "none";
					$GLOBALS['CheckoutErrorMsg'] = '';
				}
			}
		}

		// Customer has hit this page before. Delete the existing pending order
		// The reason we do a delete is if they're hitting this page again, something
		// has changed with their order or something has become invalid with it along the way.
		if (isset($_COOKIE['SHOP_ORDER_TOKEN']) && IsValidPendingOrderToken($_COOKIE['SHOP_ORDER_TOKEN'])) {
			$query = "
				SELECT orderid
				FROM [|PREFIX|]orders
				WHERE ordtoken='".$GLOBALS['ISC_CLASS_DB']->Quote($_COOKIE['SHOP_ORDER_TOKEN'])."' AND ordstatus=0
			";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while($order = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$entity = new ISC_ENTITY_ORDER();
				/** @todo ISC-1141 check to see if this needs changing to ->purge() */
				/** @todo ISC-860 this is relying on another bugfix, I'm leaving this as ->delete() for now so that orders remain in the db somewhere at least -gwilym */
				if ($entity->delete($order['orderid'], true)) {
					$GLOBALS['ISC_CLASS_LOG']->LogSystemNotice('general', GetLang('OrderDeletedAutomatically', array('order' => $order['orderid'])));
				}
			}
		}

		// Are we showing an error message?
		if (isset($GLOBALS['CheckoutErrorMsg']) && $GLOBALS['CheckoutErrorMsg'] != '') {
			$GLOBALS['HideCheckoutError'] = '';
		}
		else {
			$GLOBALS['HideCheckoutError'] = "none";
		}

		// Is there a success message to show?
		if (isset($GLOBALS['CheckoutSuccessMsg']) && $GLOBALS['CheckoutSuccessMsg'] != '') {
			$GLOBALS['HideCheckoutSuccess'] = '';
		}
		else {
			$GLOBALS['HideCheckoutSuccess'] = "none";
		}

		if(GetConfig('EnableOrderComments') == 1) {
			$GLOBALS['HideOrderComments'] = "";
		} else {
			$GLOBALS['HideOrderComments'] = "none";
		}

		if(GetConfig('EnableOrderTermsAndConditions') == 1) {

			$GLOBALS['HideOrderTermsAndConditions'] = "";

			if(GetConfig('OrderTermsAndConditionsType') == "link") {
				$GLOBALS['AgreeTermsAndConditions'] = GetLang('YesIAgree');

				$GLOBALS['TermsAndConditionsLink'] = "<a href='".GetConfig('OrderTermsAndConditionsLink')."' target='_BLANK'>".strtolower(GetLang('TermsAndConditions'))."</a>.";

				$GLOBALS['HideTermsAndConditionsTextarea'] = "display:none;";

			} else {
				$GLOBALS['HideTermsAndConditionsTextarea']= '';
				$GLOBALS['OrderTermsAndConditions'] = GetConfig('OrderTermsAndConditions');
				$GLOBALS['AgreeTermsAndConditions'] = GetLang('AgreeTermsAndConditions');
				$GLOBALS['TermsAndConditionsLink'] = '';
			}
		} else {
			$GLOBALS['HideOrderTermsAndConditions'] = "display:none;";
		}

		// BCSIXBETA-372 - mail format preferences removed/disabled for now
		// %%SNIPPET_CheckoutMailFormatPreference%% references also need to be added back into the checkout panels/snippets to re-enable this if needed
//		$GLOBALS['MailFormatPreferenceOptions'] = $this->GenerateMailFormatPreferenceOptions();
//		$GLOBALS['SNIPPETS']['CheckoutMailFormatPreference'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CheckoutMailFormatPreference');
	}
コード例 #7
0
ファイル: class.cart.php プロジェクト: hungnv0789/vhtm
	private function _setupFastCartData($quote, $item)
	{
		// product info
		$name = $item->getName();
		$prodLink = '<a href="'.prodLink($name).'">'.$name.'</a>';
		$prodImg = imageThumb($item->getThumbnail(), prodLink($name));
		$prodTotal = CurrencyConvertFormatPrice($item->getTotal());

		// x item(s) has/have been added
		$quantity = $item->getQuantity();
		$quantityTxt = GetLang('OneItemAdded');
		if ($quantity > 1) {
			$quantityTxt = GetLang('XItemsAdded', array('count' => $quantity));
		}

		// your cart contains x item(s)
		$numItems = $quote->getNumItems();
		$numItemsTxt = GetLang('OneItem');
		if ($numItems > 1) {
			$numItemsTxt = GetLang('XItems', array('count' => $numItems));
		}

		// variation?
		$options = $item->getVariationOptions();
		if(!empty($options)) {
			$holder = array();
			foreach($options as $name => $value) {
				if(!trim($name) || !trim($value)) {
					continue;
				}

				$holder[] = isc_html_escape($name).': '.isc_html_escape($value);
			}

			$prodLink .= ' <small>('.implode(', ', $holder).')</small>';
		}

		// setup suggestive content
		$GLOBALS['HideSuggestiveCartContent'] = 'display:none';
		if (GetConfig('ShowCartSuggestions')) {
			$GLOBALS['HideSuggestiveCartContent'] = '';
			$GLOBALS['SuggestiveCartContentLimit'] = 4;
			$GLOBALS['ISC_CLASS_TEMPLATE']->GetPanelContent('SuggestiveCartContent');
		}

		// setup buttons
		ob_start();
			$this->showRegularCart();
		ob_end_clean();

		$GLOBALS['fastCartProdImg'] = $prodImg;
		$GLOBALS['fastCartProdLink'] = $prodLink;
		$GLOBALS['fastCartProdTotal'] = $prodTotal;
		$GLOBALS['fastCartQuantity'] = $quantity;
		$GLOBALS['fastCartQuantityTxt'] = $quantityTxt;
		$GLOBALS['fastCartNumItemsTxt'] = $numItemsTxt;
		$GLOBALS['fastCartSubtotal'] = CurrencyConvertFormatPrice($quote->getSubTotal());
	}