Jump to content

Illegal Offset type error


bret_chels

Recommended Posts

Hello there!

I'm getting an "Illegal Offset type error" in my code. Please help me with the following code

 

The default code, when no error occurs

<?php

CLASS ISC_PRODUCTDETAILS_PANEL extends PANEL
{
	function SetPanelSettings()
	{
		$GLOBALS['ProductCartQuantity'] = '';
		if(isset($GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) {
			$GLOBALS['ProductCartQuantity'] = (int)$GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()];
		}

		$GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
		$GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
		$wishLists = $this->LoadCustomerWishLists();
		$GLOBALS['WishLists'] = '';
		$GLOBALS['ProductPrice'] = '';

		$i=0;
		foreach ($wishLists as $wishlist) {
			if ($i == 0) {
				$checked = 'checked';
			} else {
				$checked = '';
			}
			$GLOBALS['WishLists'] .= '<input type="radio" name="wishlistid" id="wishlistid'.(int)$wishlist['wishlistid'].'" value="'.(int)$wishlist['wishlistid'].'" '.$checked.' /> <label for="wishlistid'.(int)$wishlist['wishlistid'].'">'. isc_html_escape($wishlist['wishlistname']).'</label><br />';
			++$i;
		}

		$thumb = '';
		$GLOBALS['ImagePopupJavascript'] = "showProductImage('".GetConfig('ShopPath')."/productimage.php', ".$GLOBALS['ProductId'].");";

		$GLOBALS['AdditionalStylesheets'] = array(
			GetConfig('ShopPath').'/javascript/jquery/plugins/lightbox/lightbox.css'
		);

		// If we're showing images as a lightbox, we need to load up the URLs for the other images for this product
		if(GetConfig('ProductImageMode') == 'lightbox') {
			$GLOBALS['LightBoxImageList'] = '';
			$query = "
				SELECT imagefile
				FROM [|PREFIX|]product_images
				WHERE imageprodid='".$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."' AND imageisthumb=0
				ORDER BY imagesort ASC
			";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while($image = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$GLOBALS['LightBoxImageList'] .= '<a ';
				$GLOBALS['LightBoxImageList'] .= 'href="'.$GLOBALS['ShopPath'].'/'.GetConfig('ImageDirectory').'/'.$image['imagefile'].'" ';
				$GLOBALS['LightBoxImageList'] .= 'title="'.addslashes($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()).'"';
				$GLOBALS['LightBoxImageList'] .= '> </a>';
			}
			$GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox();";
			$GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
		}

		// Is there a thumbnail image?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetThumb() != "") {
			$thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
			$GLOBALS['ThumbImage'] = sprintf('<a href="#" onclick="'.$GLOBALS['ImagePopupJavascript'].'"><img src="%s" alt="" /></a>', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
		}

		// Is there more than one image? If not, hide the "See more pictures" link

		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 0) {
			$GLOBALS['HideMorePicturesLink'] = "none";
			$GLOBALS['ThumbImage'] = sprintf('<img src="%s" alt="" />', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
		} else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
			$GLOBALS['HideMorePicturesLink'] = "";
			$GLOBALS['SeeMorePictures'] = GetLang('SeeLargerImage');
		}
		else {
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1 == 1) {
				$var = "MorePictures1";
			} else {
				$var = "MorePictures2";
			}
			$GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
		}

		if($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost() != 0) {
				// Is there a fixed shipping cost?
				$GLOBALS['ShippingPrice'] = sprintf("%s %s", CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost()), GetLang('FixedShippingCost'));
			}
			else if ($GLOBALS['ISC_CLASS_PRODUCT']->HasFreeShipping()) {
				// Does this product have free shipping?
				$GLOBALS['ShippingPrice'] = GetLang('FreeShipping');
			}
			else {
				// Shipping calculated at checkout
				$GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
			}

			// Is tax already included in this price?
			if(GetConfig('TaxTypeSelected') > 0) {
				if(GetConfig('PricesIncludeTax')) {
					if(GetConfig('TaxTypeSelected') == 2 && GetConfig('DefaultTaxRateName')) { //not included
						$GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
					}
					else {
						$GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
					}
				}
				else {
					if(GetConfig('TaxTypeSelected') == 2) {
						if(GetConfig('DefaultTaxRateName')) {
							$GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
						}
						else {
							$GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
						}
					}
					else {
						$GLOBALS['IncludingExcludingTax'] = GetLang('ProductExcludingTax2');
					}
				}
			}

			$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();

			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
				$GLOBALS['RetailPrice'] = "<strike>".CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice())."</strike>";
				$GLOBALS['PriceLabel'] = GetLang('YourPrice');
				$savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
				$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), CurrencyConvertFormatPrice($savings))."</span>";
			} else {
				$GLOBALS['PriceLabel'] = GetLang('Price');
				$GLOBALS['HideRRP'] = "none";
			}
		}
		else {
			$GLOBALS['PriceLabel'] = GetLang('Price');
			$GLOBALS['HideShipping'] = 'none';
			if($GLOBALS['ISC_CLASS_PRODUCT']->ArePricesHidden() || !GetConfig('ShowProductPrice')) {
				if($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()) {
					$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel();
				}
				else {
					$GLOBALS['HidePrice'] = "display: none;";
				}
			} else {
				$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
			}

			$GLOBALS['HideRRP'] = 'none';
		}

		// Is this product linked to a brand?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName() != "" && GetConfig('ShowProductBrand')) {
			$GLOBALS['BrandName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
			$GLOBALS['BrandLink'] = BrandLink($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
		}
		else {
			$GLOBALS['HideBrandLink'] = "none";
		}

		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) {
			// It's a physical product
			$GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();

		}
		else {
			// It's a digital product
			$GLOBALS['HideWeight'] = "none";
			$GLOBALS['HideShipping'] = "none";
		}




		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWidth')) {
			// It's a physical product
			$GLOBALS['ProductWidth'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWidth();

		}
		else {
			// It's a digital product
			$GLOBALS['HideWeight'] = "none";
			$GLOBALS['HideShipping'] = "none";
		}


		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductHeight')) {
			// It's a physical product
			$GLOBALS['ProductHeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetHeight();

		}
		else {
			// It's a digital product
			$GLOBALS['HideWeight'] = "none";
			$GLOBALS['HideShipping'] = "none";
		}


		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductDepth')) {
			// It's a physical product
			$GLOBALS['ProductDepth'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetDepth();

		}
		else {
			// It's a digital product
			$GLOBALS['HideWeight'] = "none";
			$GLOBALS['HideShipping'] = "none";
		}





		// Are reviews disabled? Then don't show anything related to reviews
		if(GetConfig('EnableProductReviews') == 0) {
			$GLOBALS['HideReviewLink'] = "none";
			$GLOBALS['HideRating'] = "none";
			$GLOBALS['HideReviews'] = "none";
		}
		else {
			// How many reviews are there?
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) {
				$GLOBALS['HideReviewLink'] = "none";
			}
			else {
				$GLOBALS['HideNoReviewsMessage'] = "none";
				if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 1) {
					$GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1');
				} else {
					$GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews());
				}
			}
		}

		// Has a product availability been given?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability() != "") {
			$GLOBALS['Availability'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability());
		} else {
			$GLOBALS['HideAvailability'] = "none";
		}

		// Is there an SKU for this product?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU() != "" && GetConfig('ShowProductSKU')) {
			$GLOBALS['SKU'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
		}
		else {
			$GLOBALS['HideSKU'] = "none";
		}

		if(!GetConfig('ShowProductRating')) {
			$GLOBALS['HideRating'] = "none";
		}

		$GLOBALS['Rating'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetRating();
		$GLOBALS['CartLink'] = CartLink();

		$GLOBALS['ProductDesc'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetDesc();
		if(!trim($GLOBALS['ProductDesc'])) {
			$GLOBALS['HidePanels'][] = 'ProductDescription';
		}

		$GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;

		$GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);

		$GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();

		// Are there any custom fields for this product? If so, load them
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumCustomFields() > 0) {
			$this->LoadProductCustomFields();
		}
		else {
			$GLOBALS['HideCustomFields'] = "none";
		}

		if (GetConfig('ShowInventory') == 1 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() > 0) {
			$GLOBALS['InventoryList'] = '';
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 2) {
				$variations = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVariations();
				if (empty($options)) {
					$GLOBALS['HideCurrentStock'] = "display: none;";
				}
			}
			else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 1) {
				$currentStock = $GLOBALS['ISC_CLASS_PRODUCT']->GetInventoryLevel();
				if ($currentStock <= 0) {
					$GLOBALS['InventoryList'] = GetLang('SoldOut');
				}
				else {
					$GLOBALS['InventoryList'] = $currentStock;
				}
			}
		}
		else {
			$GLOBALS['HideCurrentStock'] = "display: none;";
		}

		if(GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
			require_once ISC_BASE_PATH.'/includes/display/SideProductAddToCart.php';
			ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
			$GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
		}

		$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
	}

	function LoadProductCustomFields()
	{

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

		$query = sprintf("select * from [|PREFIX|]product_customfields where fieldprodid='%d' order by fieldid asc", $GLOBALS['ISC_CLASS_DB']->Quote($GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()));
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$GLOBALS['CustomFieldName'] = isc_html_escape($row['fieldname']);
			$GLOBALS['CustomFieldValue'] = $row['fieldvalue'];
			$GLOBALS['SNIPPETS']['ProductCustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductCustomFieldItem");
		}
	}

	function LoadCustomerWishLists()
	{
		$wishLists = array();
		if(CustomerIsSignedIn()) {
			$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
			$customer_id = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();

			// get customer's wish list from database
			$query = "SELECT * FROM [|PREFIX|]wishlists WHERE customerid = ".$customer_id;
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$wishLists[] = $row;
			}
		}
		return $wishLists;
	}
}

?>

 

Now, this code is an addon code that i have to insert it into the above code to show up the dimensions of the products.

 

$product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
$dimensions = array(
     'ProductHeight' => 'prodheight',
     'ProductWidth' => 'prodwidth',
     'ProductDepth' => 'proddepth'
);
foreach($dimensions as $global => $field) {
     if($product[$dimensions] > 0) {
         $GLOBALS[$global] = FormatWeight($product[$field], false);
         $hasDimensions = true;
     }
    else {
         $GLOBALS['Hide'.$global] = 'display: none';
     }
}


if(!isset($hasDimensions)) {
     $GLOBALS['HideDimensions'] = 'display: none';
}

 

 

Now when i try to add the addon code to the default code, i get this error:-

 

Warning: Illegal offset type in /homepages/10/d264080461/htdocs/includes/display/ProductDetails.php on line 10

 

Warning: Illegal offset type in /homepages/10/d264080461/htdocs/includes/display/ProductDetails.php on line 10

 

Warning: Illegal offset type in /homepages/10/d264080461/htdocs/includes/display/ProductDetails.php on line 10

 

 

Please help me guyz because the application company asks me to contact your php developer where as i don't have any programmer with me who could solve this problem and i'm in a urgent need of it. I have a very less knowledge of PHP. So, please help me guys correcting this code.

 

Thanks in advance

Link to comment
Share on other sites

First of all u get a warning and not an error. This means that ur code will continue to run till the end of the script, tough something seems to went wrong.

 

Getting the illegal offset type - warning comes around when u try to acces an item in an array that is not there. Give me a minute to look into ur code and try to find a solution on why its not working.

 

Can u enlighten me on what spot exact ur pushing ur addon into ur upper code? So that i can check with the error on what line exact he generates the warning. U can also just paste a new code example.

 

Gtrz

Link to comment
Share on other sites

Thanks peddel for helping!

 

This is the exact code where i get this warning. The code in pink color is the code that i pasted.

 

<?php

[color=pink]$product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
$dimensions = array(
    'ProductHeight' => 'prodheight',
    'ProductWidth' => 'prodwidth',
    'ProductDepth' => 'proddepth'
);
foreach($dimensions as $global => $field) {
    if($product[$dimensions] > 0) {
        $GLOBALS[$global] = FormatWeight($product[$field], false);
        $hasDimensions = true;
    }
    else {
        $GLOBALS['Hide'.$global] = 'display: none';
    }
}


if(!isset($hasDimensions)) {
    $GLOBALS['HideDimensions'] = 'display: none';
}
[/color]
CLASS ISC_PRODUCTDETAILS_PANEL extends PANEL
{


	function SetPanelSettings()
	{



		$GLOBALS['ProductCartQuantity'] = '';
		if(isset($GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) {
			$GLOBALS['ProductCartQuantity'] = (int)$GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()];
		}

		$GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
		$GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
		$wishLists = $this->LoadCustomerWishLists();
		$GLOBALS['WishLists'] = '';
		$GLOBALS['ProductPrice'] = '';

		$i=0;
		foreach ($wishLists as $wishlist) {
			if ($i == 0) {
				$checked = 'checked';
			} else {
				$checked = '';
			}
			$GLOBALS['WishLists'] .= '<input type="radio" name="wishlistid" id="wishlistid'.(int)$wishlist['wishlistid'].'" value="'.(int)$wishlist['wishlistid'].'" '.$checked.' /> <label for="wishlistid'.(int)$wishlist['wishlistid'].'">'. isc_html_escape($wishlist['wishlistname']).'</label><br />';
			++$i;
		}

		$thumb = '';
		$GLOBALS['ImagePopupJavascript'] = "showProductImage('".GetConfig('ShopPath')."/productimage.php', ".$GLOBALS['ProductId'].");";

		$GLOBALS['AdditionalStylesheets'] = array(
			GetConfig('ShopPath').'/javascript/jquery/plugins/lightbox/lightbox.css'
		);

		// If we're showing images as a lightbox, we need to load up the URLs for the other images for this product
		if(GetConfig('ProductImageMode') == 'lightbox') {
			$GLOBALS['LightBoxImageList'] = '';
			$query = "
				SELECT imagefile
				FROM [|PREFIX|]product_images
				WHERE imageprodid='".$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."' AND imageisthumb=0
				ORDER BY imagesort ASC
			";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while($image = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$GLOBALS['LightBoxImageList'] .= '<a ';
				$GLOBALS['LightBoxImageList'] .= 'href="'.$GLOBALS['ShopPath'].'/'.GetConfig('ImageDirectory').'/'.$image['imagefile'].'" ';
				$GLOBALS['LightBoxImageList'] .= 'title="'.addslashes($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()).'"';
				$GLOBALS['LightBoxImageList'] .= '> </a>';
			}
			$GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox();";
			$GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
		}


		// Is there a thumbnail image?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetThumb() != "") {
			$thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
			$GLOBALS['ThumbImage'] = sprintf('<a href="#" onclick="'.$GLOBALS['ImagePopupJavascript'].'"><img src="%s" alt="" /></a>', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
		}

		// Is there more than one image? If not, hide the "See more pictures" link

		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 0) {
			$GLOBALS['HideMorePicturesLink'] = "none";
			$GLOBALS['ThumbImage'] = sprintf('<img src="%s" alt="" />', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
		} else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
			$GLOBALS['HideMorePicturesLink'] = "";
			$GLOBALS['SeeMorePictures'] = GetLang('SeeLargerImage');
		}
		else {
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1 == 1) {
				$var = "MorePictures1";
			} else {
				$var = "MorePictures2";
			}
			$GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
		}

		if($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost() != 0) {
				// Is there a fixed shipping cost?
				$GLOBALS['ShippingPrice'] = sprintf("%s %s", CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost()), GetLang('FixedShippingCost'));
			}
			else if ($GLOBALS['ISC_CLASS_PRODUCT']->HasFreeShipping()) {
				// Does this product have free shipping?
				$GLOBALS['ShippingPrice'] = GetLang('FreeShipping');
			}
			else {
				// Shipping calculated at checkout
				$GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
			}

			// Is tax already included in this price?
			if(GetConfig('TaxTypeSelected') > 0) {
				if(GetConfig('PricesIncludeTax')) {
					if(GetConfig('TaxTypeSelected') == 2 && GetConfig('DefaultTaxRateName')) { //not included
						$GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
					}
					else {
						$GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
					}
				}
				else {
					if(GetConfig('TaxTypeSelected') == 2) {
						if(GetConfig('DefaultTaxRateName')) {
							$GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
						}
						else {
							$GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
						}
					}
					else {
						$GLOBALS['IncludingExcludingTax'] = GetLang('ProductExcludingTax2');
					}
				}
			}

			$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();

			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
				$GLOBALS['RetailPrice'] = "<strike>".CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice())."</strike>";
				$GLOBALS['PriceLabel'] = GetLang('YourPrice');
				$savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
				$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), CurrencyConvertFormatPrice($savings))."</span>";
			} else {
				$GLOBALS['PriceLabel'] = GetLang('Price');
				$GLOBALS['HideRRP'] = "none";
			}
		}
		else {
			$GLOBALS['PriceLabel'] = GetLang('Price');
			$GLOBALS['HideShipping'] = 'none';
			if($GLOBALS['ISC_CLASS_PRODUCT']->ArePricesHidden() || !GetConfig('ShowProductPrice')) {
				if($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()) {
					$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel();
				}
				else {
					$GLOBALS['HidePrice'] = "display: none;";
				}
			} else {
				$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
			}

			$GLOBALS['HideRRP'] = 'none';
		}

		// Is this product linked to a brand?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName() != "" && GetConfig('ShowProductBrand')) {
			$GLOBALS['BrandName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
			$GLOBALS['BrandLink'] = BrandLink($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
		}
		else {
			$GLOBALS['HideBrandLink'] = "none";
		}

		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) {
			// It's a physical product
			$GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
		}
		else {
			// It's a digital product
			$GLOBALS['HideWeight'] = "none";
			$GLOBALS['HideShipping'] = "none";
		}

		// Are reviews disabled? Then don't show anything related to reviews
		if(GetConfig('EnableProductReviews') == 0) {
			$GLOBALS['HideReviewLink'] = "none";
			$GLOBALS['HideRating'] = "none";
			$GLOBALS['HideReviews'] = "none";
		}
		else {
			// How many reviews are there?
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) {
				$GLOBALS['HideReviewLink'] = "none";
			}
			else {
				$GLOBALS['HideNoReviewsMessage'] = "none";
				if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 1) {
					$GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1');
				} else {
					$GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews());
				}
			}
		}

		// Has a product availability been given?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability() != "") {
			$GLOBALS['Availability'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability());
		} else {
			$GLOBALS['HideAvailability'] = "none";
		}

		// Is there an SKU for this product?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU() != "" && GetConfig('ShowProductSKU')) {
			$GLOBALS['SKU'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
		}
		else {
			$GLOBALS['HideSKU'] = "none";
		}

		if(!GetConfig('ShowProductRating')) {
			$GLOBALS['HideRating'] = "none";
		}

		$GLOBALS['Rating'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetRating();
		$GLOBALS['CartLink'] = CartLink();

		$GLOBALS['ProductDesc'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetDesc();
		if(!trim($GLOBALS['ProductDesc'])) {
			$GLOBALS['HidePanels'][] = 'ProductDescription';
		}

		$GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;

		$GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);

		$GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();

		// Are there any custom fields for this product? If so, load them
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumCustomFields() > 0) {
			$this->LoadProductCustomFields();
		}
		else {
			$GLOBALS['HideCustomFields'] = "none";
		}

		if (GetConfig('ShowInventory') == 1 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() > 0) {
			$GLOBALS['InventoryList'] = '';
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 2) {
				$variations = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVariations();
				if (empty($options)) {
					$GLOBALS['HideCurrentStock'] = "display: none;";
				}
			}
			else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 1) {
				$currentStock = $GLOBALS['ISC_CLASS_PRODUCT']->GetInventoryLevel();
				if ($currentStock <= 0) {
					$GLOBALS['InventoryList'] = GetLang('SoldOut');
				}
				else {
					$GLOBALS['InventoryList'] = $currentStock;
				}
			}
		}
		else {
			$GLOBALS['HideCurrentStock'] = "display: none;";
		}

		if(GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
			require_once ISC_BASE_PATH.'/includes/display/SideProductAddToCart.php';
			ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
			$GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
		}

		$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
	}

	function LoadProductCustomFields()
	{

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

		$query = sprintf("select * from [|PREFIX|]product_customfields where fieldprodid='%d' order by fieldid asc", $GLOBALS['ISC_CLASS_DB']->Quote($GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()));
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$GLOBALS['CustomFieldName'] = isc_html_escape($row['fieldname']);
			$GLOBALS['CustomFieldValue'] = $row['fieldvalue'];
			$GLOBALS['SNIPPETS']['ProductCustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductCustomFieldItem");
		}
	}

	function LoadCustomerWishLists()
	{
		$wishLists = array();
		if(CustomerIsSignedIn()) {
			$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
			$customer_id = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();

			// get customer's wish list from database
			$query = "SELECT * FROM [|PREFIX|]wishlists WHERE customerid = ".$customer_id;
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$wishLists[] = $row;
			}
		}
		return $wishLists;
	}
}


?>

 

Right now i'm getting this warning

Warning: Illegal offset type in /homepages/10/d264080461/htdocs/includes/display/ProductDetails.php on line 10

 

Warning: Illegal offset type in /homepages/10/d264080461/htdocs/includes/display/ProductDetails.php on line 10

 

Warning: Illegal offset type in /homepages/10/d264080461/htdocs/includes/display/ProductDetails.php on line 10

Link to comment
Share on other sites

Exact code, when warning is showed

 

<?php

$product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
$dimensions = array(
    'ProductHeight' => 'prodheight',
    'ProductWidth' => 'prodwidth',
    'ProductDepth' => 'proddepth'
);
foreach($dimensions as $global => $field) {
    if($product[$dimensions] > 0) {
        $GLOBALS[$global] = FormatWeight($product[$field], false);
        $hasDimensions = true;
    }
    else {
        $GLOBALS['Hide'.$global] = 'display: none';
    }
}


if(!isset($hasDimensions)) {
    $GLOBALS['HideDimensions'] = 'display: none';
}

CLASS ISC_PRODUCTDETAILS_PANEL extends PANEL
{


	function SetPanelSettings()
	{



		$GLOBALS['ProductCartQuantity'] = '';
		if(isset($GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) {
			$GLOBALS['ProductCartQuantity'] = (int)$GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()];
		}

		$GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
		$GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
		$wishLists = $this->LoadCustomerWishLists();
		$GLOBALS['WishLists'] = '';
		$GLOBALS['ProductPrice'] = '';

		$i=0;
		foreach ($wishLists as $wishlist) {
			if ($i == 0) {
				$checked = 'checked';
			} else {
				$checked = '';
			}
			$GLOBALS['WishLists'] .= '<input type="radio" name="wishlistid" id="wishlistid'.(int)$wishlist['wishlistid'].'" value="'.(int)$wishlist['wishlistid'].'" '.$checked.' /> <label for="wishlistid'.(int)$wishlist['wishlistid'].'">'. isc_html_escape($wishlist['wishlistname']).'</label><br />';
			++$i;
		}

		$thumb = '';
		$GLOBALS['ImagePopupJavascript'] = "showProductImage('".GetConfig('ShopPath')."/productimage.php', ".$GLOBALS['ProductId'].");";

		$GLOBALS['AdditionalStylesheets'] = array(
			GetConfig('ShopPath').'/javascript/jquery/plugins/lightbox/lightbox.css'
		);

		// If we're showing images as a lightbox, we need to load up the URLs for the other images for this product
		if(GetConfig('ProductImageMode') == 'lightbox') {
			$GLOBALS['LightBoxImageList'] = '';
			$query = "
				SELECT imagefile
				FROM [|PREFIX|]product_images
				WHERE imageprodid='".$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."' AND imageisthumb=0
				ORDER BY imagesort ASC
			";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while($image = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$GLOBALS['LightBoxImageList'] .= '<a ';
				$GLOBALS['LightBoxImageList'] .= 'href="'.$GLOBALS['ShopPath'].'/'.GetConfig('ImageDirectory').'/'.$image['imagefile'].'" ';
				$GLOBALS['LightBoxImageList'] .= 'title="'.addslashes($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()).'"';
				$GLOBALS['LightBoxImageList'] .= '> </a>';
			}
			$GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox();";
			$GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
		}


		// Is there a thumbnail image?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetThumb() != "") {
			$thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
			$GLOBALS['ThumbImage'] = sprintf('<a href="#" onclick="'.$GLOBALS['ImagePopupJavascript'].'"><img src="%s" alt="" /></a>', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
		}

		// Is there more than one image? If not, hide the "See more pictures" link

		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 0) {
			$GLOBALS['HideMorePicturesLink'] = "none";
			$GLOBALS['ThumbImage'] = sprintf('<img src="%s" alt="" />', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
		} else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
			$GLOBALS['HideMorePicturesLink'] = "";
			$GLOBALS['SeeMorePictures'] = GetLang('SeeLargerImage');
		}
		else {
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1 == 1) {
				$var = "MorePictures1";
			} else {
				$var = "MorePictures2";
			}
			$GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
		}

		if($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost() != 0) {
				// Is there a fixed shipping cost?
				$GLOBALS['ShippingPrice'] = sprintf("%s %s", CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost()), GetLang('FixedShippingCost'));
			}
			else if ($GLOBALS['ISC_CLASS_PRODUCT']->HasFreeShipping()) {
				// Does this product have free shipping?
				$GLOBALS['ShippingPrice'] = GetLang('FreeShipping');
			}
			else {
				// Shipping calculated at checkout
				$GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
			}

			// Is tax already included in this price?
			if(GetConfig('TaxTypeSelected') > 0) {
				if(GetConfig('PricesIncludeTax')) {
					if(GetConfig('TaxTypeSelected') == 2 && GetConfig('DefaultTaxRateName')) { //not included
						$GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
					}
					else {
						$GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
					}
				}
				else {
					if(GetConfig('TaxTypeSelected') == 2) {
						if(GetConfig('DefaultTaxRateName')) {
							$GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
						}
						else {
							$GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
						}
					}
					else {
						$GLOBALS['IncludingExcludingTax'] = GetLang('ProductExcludingTax2');
					}
				}
			}

			$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();

			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
				$GLOBALS['RetailPrice'] = "<strike>".CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice())."</strike>";
				$GLOBALS['PriceLabel'] = GetLang('YourPrice');
				$savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
				$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), CurrencyConvertFormatPrice($savings))."</span>";
			} else {
				$GLOBALS['PriceLabel'] = GetLang('Price');
				$GLOBALS['HideRRP'] = "none";
			}
		}
		else {
			$GLOBALS['PriceLabel'] = GetLang('Price');
			$GLOBALS['HideShipping'] = 'none';
			if($GLOBALS['ISC_CLASS_PRODUCT']->ArePricesHidden() || !GetConfig('ShowProductPrice')) {
				if($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()) {
					$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel();
				}
				else {
					$GLOBALS['HidePrice'] = "display: none;";
				}
			} else {
				$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
			}

			$GLOBALS['HideRRP'] = 'none';
		}

		// Is this product linked to a brand?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName() != "" && GetConfig('ShowProductBrand')) {
			$GLOBALS['BrandName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
			$GLOBALS['BrandLink'] = BrandLink($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
		}
		else {
			$GLOBALS['HideBrandLink'] = "none";
		}

		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) {
			// It's a physical product
			$GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
		}
		else {
			// It's a digital product
			$GLOBALS['HideWeight'] = "none";
			$GLOBALS['HideShipping'] = "none";
		}

		// Are reviews disabled? Then don't show anything related to reviews
		if(GetConfig('EnableProductReviews') == 0) {
			$GLOBALS['HideReviewLink'] = "none";
			$GLOBALS['HideRating'] = "none";
			$GLOBALS['HideReviews'] = "none";
		}
		else {
			// How many reviews are there?
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) {
				$GLOBALS['HideReviewLink'] = "none";
			}
			else {
				$GLOBALS['HideNoReviewsMessage'] = "none";
				if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 1) {
					$GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1');
				} else {
					$GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews());
				}
			}
		}

		// Has a product availability been given?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability() != "") {
			$GLOBALS['Availability'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability());
		} else {
			$GLOBALS['HideAvailability'] = "none";
		}

		// Is there an SKU for this product?
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU() != "" && GetConfig('ShowProductSKU')) {
			$GLOBALS['SKU'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
		}
		else {
			$GLOBALS['HideSKU'] = "none";
		}

		if(!GetConfig('ShowProductRating')) {
			$GLOBALS['HideRating'] = "none";
		}

		$GLOBALS['Rating'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetRating();
		$GLOBALS['CartLink'] = CartLink();

		$GLOBALS['ProductDesc'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetDesc();
		if(!trim($GLOBALS['ProductDesc'])) {
			$GLOBALS['HidePanels'][] = 'ProductDescription';
		}

		$GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;

		$GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);

		$GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();

		// Are there any custom fields for this product? If so, load them
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumCustomFields() > 0) {
			$this->LoadProductCustomFields();
		}
		else {
			$GLOBALS['HideCustomFields'] = "none";
		}

		if (GetConfig('ShowInventory') == 1 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() > 0) {
			$GLOBALS['InventoryList'] = '';
			if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 2) {
				$variations = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVariations();
				if (empty($options)) {
					$GLOBALS['HideCurrentStock'] = "display: none;";
				}
			}
			else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 1) {
				$currentStock = $GLOBALS['ISC_CLASS_PRODUCT']->GetInventoryLevel();
				if ($currentStock <= 0) {
					$GLOBALS['InventoryList'] = GetLang('SoldOut');
				}
				else {
					$GLOBALS['InventoryList'] = $currentStock;
				}
			}
		}
		else {
			$GLOBALS['HideCurrentStock'] = "display: none;";
		}

		if(GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
			require_once ISC_BASE_PATH.'/includes/display/SideProductAddToCart.php';
			ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
			$GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
		}

		$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
	}

	function LoadProductCustomFields()
	{

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

		$query = sprintf("select * from [|PREFIX|]product_customfields where fieldprodid='%d' order by fieldid asc", $GLOBALS['ISC_CLASS_DB']->Quote($GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()));
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$GLOBALS['CustomFieldName'] = isc_html_escape($row['fieldname']);
			$GLOBALS['CustomFieldValue'] = $row['fieldvalue'];
			$GLOBALS['SNIPPETS']['ProductCustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductCustomFieldItem");
		}
	}

	function LoadCustomerWishLists()
	{
		$wishLists = array();
		if(CustomerIsSignedIn()) {
			$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
			$customer_id = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();

			// get customer's wish list from database
			$query = "SELECT * FROM [|PREFIX|]wishlists WHERE customerid = ".$customer_id;
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$wishLists[] = $row;
			}
		}
		return $wishLists;
	}
}


?>

Link to comment
Share on other sites

Maybe this could help you to identify the problem. The following code is a class.product.php file which has something to do with FormatWeight stuff.

 

<?php

class ISC_PRODUCT
{

	var $_product = array();

	var $_prodid = 0;
	var $_prodprice = 0;
	var $_prodcalculatedprice = 0;
	var $_prodretailprice = 0;
	var $_prodsaleprice = 0;
	var $_prodimages = 0;
	var $_prodfixedshippingcost = 0;
	var $_prodtype = 0;
	var $_prodweight = 0;
	var $_prodavgrating = 0;
	var $_prodoptionsrequired = 0;
	var $_prodnumreviews = 0;
	var $_prodnumcustomfields = 0;
	var $_prodinvtrack = 0;
	var $_prodcurrentinv = 0;

	var $_prodallowpurchases = 1;
	var $_prodhideprice = 0;
	var $_prodcallforpricinglabel = '';

	var $_prodname = "";
	var $_prodthumb = "";
	var $_proddesc = "";
	var $_prodbrandname = "";
	var $_prodavailability = "";
	var $_prodrelatedproducts = "";
	var $_prodlayoutfile = "";
	var $_prodsku = "";

	var $_prodpagetitle = '';
	var $_prodmetakeywords = '';
	var $_prodmetadesc = '';

	var $_prodfreeshipping = false;
	var $_prodvariations = array();
	var $_prodvariationcombinations = array();
	var $_prodvariationoptions = array();

	var $_currencyrecord = null;

	function __construct($productid=0)
	{
		// Load the data for this product
		$this->_SetProductData($productid);

		// Add it to the list of recently viewed products
		if($productid == 0) {
			$this->_AddToRecentlyViewedProducts();

			// Workout the breadcrumb(s)
			$this->_BuildBreadCrumbs();

			// Track a view for this page
			$this->_TrackView();
		}
	}

	function _SetProductData($productid=0)
	{

		if ($productid == 0) {
			// Retrieve the query string variables. Can't use the $_GET array
			// because of SEO friendly links in the URL
			SetPGQVariablesManually();
			if (isset($_REQUEST['product'])) {
				$product = $_REQUEST['product'];
			}
			else if(isset($GLOBALS['PathInfo'][1])) {
				$product = preg_replace('#\.html$#i', '', $GLOBALS['PathInfo'][1]);
			}
			else {
				$product = '';
			}

			$product = $GLOBALS['ISC_CLASS_DB']->Quote(MakeURLNormal($product));
			$productSQL = sprintf("p.prodname='%s'", $product);
		}
		else {
			$productSQL = sprintf("p.productid='%s'", (int)$productid);
		}

		$query = "
			SELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, ".GetProdCustomerGroupPriceSQL().",
			(SELECT COUNT(fieldid) FROM [|PREFIX|]product_customfields WHERE fieldprodid=p.productid) AS numcustomfields,
			(SELECT COUNT(reviewid) FROM [|PREFIX|]reviews WHERE revstatus='1' AND revproductid=p.productid AND revstatus='1') AS numreviews,
			(SELECT brandname FROM [|PREFIX|]brands WHERE brandid=p.prodbrandid) AS prodbrandname,
			(SELECT COUNT(imageid) FROM [|PREFIX|]product_images WHERE imageprodid=p.productid AND imageisthumb=0) AS numimages
			FROM [|PREFIX|]products p
			LEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)
			WHERE ".$productSQL." AND p.prodvisible='1' AND (imageisthumb=1 OR ISNULL(imageisthumb))
		";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$this->_product = $row;
			$this->_prodid = $row['productid'];
			$this->_prodname = $row['prodname'];
			$this->_prodsku = $row['prodcode'];
			$this->_prodthumb = $row['imagefile'];
			$this->_proddesc = $row['proddesc'];
			$this->_prodimages = $row['numimages'];
			$this->_prodprice = $row['prodprice'];
			$this->_prodretailprice = $row['prodretailprice'];
			$this->_prodsaleprice = $row['prodsaleprice'];
			$this->_prodfixedshippingcost = $row['prodfixedshippingcost'];
			$this->_prodbrandname = $row['prodbrandname'];
			$this->_prodweight = $row['prodweight'];
			$this->_prodavgrating = (int)$row['prodavgrating'];
			$this->_prodcalculatedprice = $row['prodcalculatedprice'];
			$this->_prodoptionsrequired = $row['prodoptionsrequired'];
			$this->_prodnumreviews = $row['numreviews'];
			$this->_prodavailability = $row['prodavailability'];
			$this->_prodnumcustomfields = $row['numcustomfields'];
			$this->_prodrelatedproducts = $row['prodrelatedproducts'];
			if($row['prodlayoutfile'] != '') {
				$File = str_replace(array(".html", ".htm"), "", $row['prodlayoutfile']);
				if(!file_exists(ISC_BASE_PATH."/templates/".GetConfig('template')."/".$row['prodlayoutfile'])) {
					$this->_prodlayoutfile = 'product';
				}
				else {
					$this->_prodlayoutfile = $File;
				}
			}
			else {
				$this->_prodlayoutfile = 'product';
			}
			$this->_prodpagetitle = $row['prodpagetitle'];
			$this->_prodmetakeywords = $row['prodmetakeywords'];
			$this->_prodmetadesc = $row['prodmetadesc'];
			$this->_prodinvtrack = $row['prodinvtrack'];
			$this->_prodcurrentinv = $row['prodcurrentinv'];

			if ($row['prodtype'] == 1) {
				$this->_prodtype = PT_PHYSICAL;
			} else {
				$this->_prodtype = PT_DIGITAL;
			}

			if ($row['prodfreeshipping'] == 0) {
				$this->_prodfreeshipping = false;
			} else {
				$this->_prodfreeshipping = true;
			}

			$this->_prodallowpurchases = $row['prodallowpurchases'];
			$this->_prodhideprice = $row['prodhideprice'];
			$this->_prodcallforpricinglabel = $row['prodcallforpricinglabel'];

			// If there are product variations, set them up
			if($row['prodvariationid'] > 0) {
				$this->SetupProductVariations();
			}
		}
	}

	/**
	*	Track a view for this product by updating the prodnumviews field in the products table
	*/
	function _TrackView()
	{
		$query = sprintf("update [|PREFIX|]products set prodnumviews=prodnumviews+1 where productid='%d'", $this->_prodid);
		$GLOBALS['ISC_CLASS_DB']->Query($query);
	}

	function _AddToRecentlyViewedProducts()
	{
		/*
			Store this product's ID in a persistent cookie
			that will be used to remember the last 5 products
			that this person has viewed
		*/

		$viewed_products = array();

		if (isset($_COOKIE['RECENTLY_VIEWED_PRODUCTS'])) {
			$viewed_products = explode(",", $_COOKIE['RECENTLY_VIEWED_PRODUCTS']);
		}

		if (in_array($this->GetProductId(), $viewed_products)) {
			// Remove it from the array
			foreach ($viewed_products as $k=>$v) {
				if ($v == $this->GetProductId()) {
					unset($viewed_products[$k]);
				}
			}
		}

		// Add it to the list
		$viewed_products[] = $this->GetProductId();

		// Only store the 5 most recent product Id's
		if (sizeof($viewed_products) > 5) {
			$reverse_viewed_products = array_reverse($viewed_products);
			$viewed_products = array();

			for ($i = 0; $i < 5; $i++) {
				$viewed_products[] = $reverse_viewed_products[$i];
			}

			// Reverse the array so the oldest products show first
			$viewed_products = array_reverse($viewed_products);
		}

		$new_viewed_products = implode(",", $viewed_products);

		// Persist the cookie for 30 days
		ISC_SetCookie("RECENTLY_VIEWED_PRODUCTS", $new_viewed_products, time() + (3600*24*30));

		// Persist the cookie session-wide for use on the cart page
		$_SESSION['RECENTLY_VIEWED_PRODUCTS'] = $new_viewed_products;
	}

	function SetupProductVariations()
	{
		// Get a list of product variations for this product from the database
		$optionList = array();
		$query = "
			SELECT *
			FROM [|PREFIX|]product_variation_combinations
			WHERE vcproductid='".$GLOBALS['ISC_CLASS_DB']->Quote($this->GetProductId())."' AND vcenabled='1'
		";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		while ($combination = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$variationOptions = explode(",", $combination['vcoptionids']);

			// Product options must be sorted numerically for the javascript selections to work
			sort($variationOptions);

			$combination['vcoptionids'] = implode(",", $variationOptions);
			$this->_prodvariationcombinations[] = $combination;

			// Add the list of options available to the list we'll be selecting below
			$optionList = array_merge($optionList, $variationOptions);
		}

		if(!empty($optionList)) {
			// Fetch the list of option names and values
			$optionList = implode(",", array_unique($optionList));
			$query = "
				SELECT *
				FROM [|PREFIX|]product_variation_options
				WHERE voptionid IN (".$optionList.")
				ORDER BY voptionid
			";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$variationNames = array();
			$count = 0;
			while($option = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				if(!isset($variationNames[$option['voname']])) {
					++$count;
					$variationNames[$option['voname']] = $count;
				}
				else {
					$count = $variationNames[$option['voname']];
				}
				if(!isset($this->_prodvariations[$option['voname']])) {
					$this->_prodvariations[$option['voname']] = array();
				}
				$this->_prodvariations[$option['voname']][] = $option;
				$this->_prodvariationslookup[$option['voptionid']] = $count;
				$this->_prodvariationoptions[$option['voptionid']] = $option;
			}
		}
	}
	function GetVariationCombination($combination)
	{
		if(!is_array($combination)) {
			$combination = explode(",", $combination);
		}

		// Sort it numerically
		sort($combination, SORT_NUMERIC);
		$combination = implode(",", $combination);

		foreach($this->_prodvariationcombinations as $variation) {
			// Sort this combination numerically too
			$vcombination = explode(",", $variation['vcoptionids']);
			sort($vcombination, SORT_NUMERIC);
			$vcombination = implode(",", $vcombination);
			if($vcombination == $combination) {
				return $variation['combinationid'];
			}
		}

		// Nothing found, return false
		return false;
	}

	function GetProductVariationCombinationJavascript()
	{
		if(empty($this->_prodvariationcombinations)) {
			return '';
		}
		$script = "<script type=\"text/javascript\">\n";
		$script .= " var VariationList = new Array();\n";

		foreach($this->_prodvariationcombinations as $variation) {
			$variationPrice = CurrencyConvertFormatPrice(CalcProductVariationPrice($this->_prodcalculatedprice, $variation['vcpricediff'], $variation['vcprice'], $this->_product));
			$variationWeight = FormatWeight(CalcProductVariationWeight($this->_prodweight, $variation['vcweightdiff'], $variation['vcweight']), true);

			if($variation['vcthumb'] != '') {
				$thumb = $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$variation['vcthumb'];
			}
			else {
				$thumb = '';
			}
			if($variation['vcimage'] != '') {
				$image = $GLOBALS['ShopPath'].'/'.GetConfig('ImageDirectory').'/'.$variation['vcimage'];
			}
			else {
				$image = '';
			}

			$ids = explode(",", $variation['vcoptionids']);
			$optionList = array();
			foreach($ids as $id) {
				$key = $this->_prodvariationslookup[$id];
				$optionList[$key] = $id;
			}
			ksort($optionList);
			$optionList = implode(",", $optionList);

			$script .= " VariationList[".$variation['combinationid']."] = {";
			$script .= " combination: '".$optionList."', ";
			$script .= " price: '".$variationPrice."', ";
			$script .= " sku: '".isc_html_escape($variation['vcsku'])."', ";
			$script .= " weight: '".$variationWeight."', ";
			$script .= " thumb: '".$thumb."', ";
			$script .= " image: '".$image."', ";
			// Tracking inventory on a product variation level
			if($this->_prodinvtrack == 2) {
				if(GetConfig('ShowInventory') == 1) {
					$script .= "stock: '".$variation['vcstock']."', ";
				}
				if($variation['vcstock'] <= 0) {
					$script .= " instock: false";
				}
				else {
					$script .= " instock: true";
				}
			}
			else {
				$script .= " instock: true";
			}
			$script .= "};\n";
		}

		$script .= "</script>";
		return $script;

	}

	function GetProductVariations()
	{
		return $this->_prodvariations;
	}

	function GetProductInventoryTracking()
	{
		return $this->_prodinvtrack;
	}

	function GetInventoryLevel()
	{
		return $this->_prodcurrentinv;
	}

	function IsOptionRequired()
	{
		if ($this->_prodoptionsrequired == 1) {
			return true;
		} else {
			return false;
		}
	}

	function _BuildBreadCrumbs()
	{
		/*
			Build a list of one or more breadcrumb trails for this
			product based on which categories it appears in
		*/

		// Build the arrays that will contain the category names to build the trails
		$count = 0;

		$GLOBALS['BreadCrumbs'] = "";
		$GLOBALS['FindByCategory'] = "";

		// First we need to fetch the parent lists of all of the categories
		$trailCategories = array();
		$crumbList = array();
		$query = sprintf("
			SELECT c.categoryid, c.catparentlist
			FROM [|PREFIX|]categoryassociations ca
			INNER JOIN [|PREFIX|]categories c ON (c.categoryid=ca.categoryid)
			WHERE ca.productid='%d'",
			$GLOBALS['ISC_CLASS_DB']->Quote($this->GetProductId())
		);
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			if ($row['catparentlist'] == '') {
				$row['catparentlist'] = $row['categoryid'];
			}
			$cats = explode(",", $row['catparentlist']);
			$trailCategories = array_merge($trailCategories, $cats);
			$crumbList[$row['categoryid']] = $row['catparentlist'];
		}

		$trailCategories = implode(",", array_unique($trailCategories));
		$categories = array();
		if ($trailCategories != '') {
			// Now load the names for the parent categories from the database
			$query = sprintf("SELECT categoryid, catname FROM [|PREFIX|]categories WHERE categoryid IN (%s)", $trailCategories);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$categories[$row['categoryid']] = $row['catname'];
			}
		}

		// Now we have all of the information we need to build the trails, lets actually build them
		foreach ($crumbList as $trail) {
			$GLOBALS['CatTrailLink'] = $GLOBALS['ShopPath'];
			$GLOBALS['CatTrailName'] = GetLang('Home');
			$GLOBALS['BreadcrumbItems'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItem");
			$GLOBALS['FindByCategoryItems'] = "";

			$cats = explode(",", $trail);
			foreach ($cats as $categoryid) {
				if(!CustomerGroupHasAccessToCategory($categoryid)) {
					continue;
				}
				if (isset($categories[$categoryid])) {
					$catname = $categories[$categoryid];
					$GLOBALS['CatTrailLink'] = CatLink($categoryid, $catname);
					$GLOBALS['CatTrailName'] = isc_html_escape($catname);
					$GLOBALS['BreadcrumbItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItem");
					$GLOBALS['FindByCategoryItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductFindByCategoryItem");
				}
			}

			$GLOBALS['CatTrailName'] = isc_html_escape($this->GetProductName());
			$GLOBALS['BreadcrumbItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItemCurrent");
			$GLOBALS['BreadCrumbs'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBreadCrumb");
			$GLOBALS['FindByCategory'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductFindByCategory");
		}
	}

	function HandlePage()
	{
		$this->ShowPage();
	}

	function HasFreeShipping()
	{
		return $this->_prodfreeshipping;
	}

	function GetFixedShippingCost()
	{
		return $this->_prodfixedshippingcost;
	}

	function GetProduct()
	{
		return $this->_product;
	}

	function GetProductName()
	{
		return $this->_prodname;
	}

	function GetProductId()
	{
		return $this->_prodid;
	}

	function GetThumb()
	{
		return $this->_prodthumb;
	}

	function GetDesc()
	{
		return $this->_proddesc;
	}

	function GetNumImages()
	{
		return $this->_prodimages;
	}

	function GetPrice()
	{
		return $this->_prodprice;
	}

	function GetRetailPrice()
	{
		return $this->_prodretailprice;
	}

	function GetSalePrice()
	{
		return $this->_prodsaleprice;
	}

	function GetCalculatedPrice()
	{
		return CalculateProductPrice($this->_product, true, true, false);
	}

	function GetFinalPrice()
	{
		return CalcProdCustomerGroupPrice($this->_product, $this->_prodcalculatedprice);
	}

	function GetBrandName()
	{
		return $this->_prodbrandname;
	}

	function GetProductType()
	{
		return $this->_prodtype;
	}

	function GetWeight()
	{
		return FormatWeight($this->_prodweight, true);
	}

	function GetRating()
	{
		return $this->_prodavgrating;
	}

	function GetNumReviews()
	{
		return $this->_prodnumreviews;
	}

	function GetSKU()
	{
		return $this->_prodsku;
	}

	function GetAvailability()
	{
		return $this->_prodavailability;
	}

	function GetNumCustomFields()
	{
		return $this->_prodnumcustomfields;
	}

	function GetRelatedProducts()
	{
		// Related products are set to automatic, find them
		return GetRelatedProducts($this->_prodid, $this->_prodname, $this->_prodrelatedproducts);
	}

	function IsPurchasingAllowed()
	{
		return $this->_prodallowpurchases;
	}

	function ArePricesHidden()
	{
		if(!GetConfig('ShowProductPrice') || $this->_prodhideprice == 1) {
			return true;
		}

		return false;
	}

	function GetProductCallForPricingLabel()
	{
		return $this->_prodcallforpricinglabel;
	}

	function GetPageTitle()
	{
		return $this->_prodpagetitle;
	}

	public function GetProductWarranty()
	{
		return $this->_product['prodwarranty'];
	}

	function BuildTitle()
	{
		$title = '';
		if ($this->GetPageTitle()!="") {
			$title = $this->GetPageTitle();
		} elseif ($this->GetProductName()!="") {
			$title = sprintf("%s - %s", $this->GetProductName(), GetConfig('StoreName'));
		} else {
			$title = sprintf("%s %s", GetConfig('StoreName'), GetLang('Products'));
		}
		return $title;
	}

	function ShowPage()
	{
		if ($this->_prodid > 0) {
			// Check that the customer has permisison to view this product
			$canView = false;
			$productCategories = explode(',', $this->_product['prodcatids']);
			foreach($productCategories as $categoryId) {
				// Do we have permission to access this category?
				if(CustomerGroupHasAccessToCategory($categoryId)) {
					$canView = true;
				}
			}
			if($canView == false) {
				$noPermissionsPage = GetClass('ISC_403');
				$noPermissionsPage->HandlePage();
				exit;
			}

			if ($this->_prodmetakeywords != "") {
				$GLOBALS['ISC_CLASS_TEMPLATE']->SetMetaKeywords(isc_html_escape($this->_prodmetakeywords));
			}

			if ($this->_prodmetadesc != "") {
				$GLOBALS['ISC_CLASS_TEMPLATE']->SetMetaDescription(isc_html_escape($this->_prodmetadesc));
			}

			$GLOBALS['CompareLink'] = CompareLink();

			// If we're showing images as a lightbox, we need to load up the URLs for the other images for this product
			if(GetConfig('ProductImageMode') == 'lightbox') {
				$GLOBALS['AdditionalStylesheets'] = array(
					GetConfig('ShopPath').'/javascript/jquery/plugins/lightbox/lightbox.css'
				);
			}

			$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate($this->_prodlayoutfile);
			$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
		}
		// Visiting an invalid product, show a lovely error message
		else {
			ShowInvalidError('product');
			die();
		}
	}
}

?>

Link to comment
Share on other sites

Im sorry but i get the idea that u were not the guy who build this code.

It seems that the guys who programmed this knew exactly what he was doing, inserting stuff inside someone elses code is hard, and i should see the compleet project and think about it to find a solution.

UR best shot is contact the guy who made this, since i cannot spare more time on this, im sorry.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.