Illegal Offset type error

  • bret_chels
  • Born
  • Born
  • bret_chels
  • Posts: 1

Post 3+ Months Ago

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
Code: [ Select ]
 
<?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'] .= '>&nbsp;</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;
        }
    }
 
 
?>
 
 
  1.  
  2. <?php
  3.  
  4.  
  5.     CLASS ISC_PRODUCTDETAILS_PANEL extends PANEL
  6.     {
  7.  
  8.  
  9.         function SetPanelSettings()
  10.         {
  11.  
  12.  
  13.  
  14.             $GLOBALS['ProductCartQuantity'] = '';
  15.             if(isset($GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) {
  16.                 $GLOBALS['ProductCartQuantity'] = (int)$GLOBALS['CartQuantity'.$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()];
  17.             }
  18.            
  19.             $GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
  20.             $GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
  21.             $wishLists = $this->LoadCustomerWishLists();
  22.             $GLOBALS['WishLists'] = '';
  23.             $GLOBALS['ProductPrice'] = '';
  24.  
  25.             $i=0;
  26.             foreach ($wishLists as $wishlist) {
  27.                 if ($i == 0) {
  28.                     $checked = 'checked';
  29.                 } else {
  30.                     $checked = '';
  31.                 }
  32.                 $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 />';
  33.                 ++$i;
  34.             }
  35.  
  36.             $thumb = '';
  37.             $GLOBALS['ImagePopupJavascript'] = "showProductImage('".GetConfig('ShopPath')."/productimage.php', ".$GLOBALS['ProductId'].");";
  38.  
  39.             $GLOBALS['AdditionalStylesheets'] = array(
  40.                 GetConfig('ShopPath').'/javascript/jquery/plugins/lightbox/lightbox.css'
  41.             );
  42.  
  43.             // If we're showing images as a lightbox, we need to load up the URLs for the other images for this product
  44.             if(GetConfig('ProductImageMode') == 'lightbox') {
  45.                 $GLOBALS['LightBoxImageList'] = '';
  46.                 $query = "
  47.                     SELECT imagefile
  48.                     FROM [|PREFIX|]product_images
  49.                     WHERE imageprodid='".$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."' AND imageisthumb=0
  50.                     ORDER BY imagesort ASC
  51.                 ";
  52.                 $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
  53.                 while($image = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
  54.                     $GLOBALS['LightBoxImageList'] .= '<a ';
  55.                     $GLOBALS['LightBoxImageList'] .= 'href="'.$GLOBALS['ShopPath'].'/'.GetConfig('ImageDirectory').'/'.$image['imagefile'].'" ';
  56.                     $GLOBALS['LightBoxImageList'] .= 'title="'.addslashes($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()).'"';
  57.                     $GLOBALS['LightBoxImageList'] .= '>&nbsp;</a>';
  58.                 }
  59.                 $GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox();";
  60.                 $GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
  61.             }
  62.  
  63.  
  64.             // Is there a thumbnail image?
  65.             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetThumb() != "") {
  66.                 $thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
  67.                 $GLOBALS['ThumbImage'] = sprintf('<a href="#" onclick="'.$GLOBALS['ImagePopupJavascript'].'"><img src="%s" alt="" /></a>', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
  68.             }
  69.  
  70.             // Is there more than one image? If not, hide the "See more pictures" link
  71.            
  72.             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 0) {
  73.                 $GLOBALS['HideMorePicturesLink'] = "none";
  74.                 $GLOBALS['ThumbImage'] = sprintf('<img src="%s" alt="" />', $GLOBALS['ShopPath']."/".GetConfig('ImageDirectory')."/".$thumb);
  75.             } else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
  76.                 $GLOBALS['HideMorePicturesLink'] = "";
  77.                 $GLOBALS['SeeMorePictures'] = GetLang('SeeLargerImage');
  78.             }
  79.             else {
  80.                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1 == 1) {
  81.                     $var = "MorePictures1";
  82.                 } else {
  83.                     $var = "MorePictures2";
  84.                 }
  85.                 $GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
  86.             }
  87.  
  88.             if($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
  89.                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost() != 0) {
  90.                     // Is there a fixed shipping cost?
  91.                     $GLOBALS['ShippingPrice'] = sprintf("%s %s", CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost()), GetLang('FixedShippingCost'));
  92.                 }
  93.                 else if ($GLOBALS['ISC_CLASS_PRODUCT']->HasFreeShipping()) {
  94.                     // Does this product have free shipping?
  95.                     $GLOBALS['ShippingPrice'] = GetLang('FreeShipping');
  96.                 }
  97.                 else {
  98.                     // Shipping calculated at checkout
  99.                     $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
  100.                 }
  101.  
  102.                 // Is tax already included in this price?
  103.                 if(GetConfig('TaxTypeSelected') > 0) {
  104.                     if(GetConfig('PricesIncludeTax')) {
  105.                         if(GetConfig('TaxTypeSelected') == 2 && GetConfig('DefaultTaxRateName')) { //not included
  106.                             $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
  107.                         }
  108.                         else {
  109.                             $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
  110.                         }
  111.                     }
  112.                     else {
  113.                         if(GetConfig('TaxTypeSelected') == 2) {
  114.                             if(GetConfig('DefaultTaxRateName')) {
  115.                                 $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
  116.                             }
  117.                             else {
  118.                                 $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
  119.                             }
  120.                         }
  121.                         else {
  122.                             $GLOBALS['IncludingExcludingTax'] = GetLang('ProductExcludingTax2');
  123.                         }
  124.                     }
  125.                 }
  126.  
  127.                 $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
  128.  
  129.                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
  130.                     $GLOBALS['RetailPrice'] = "<strike>".CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice())."</strike>";
  131.                     $GLOBALS['PriceLabel'] = GetLang('YourPrice');
  132.                     $savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
  133.                     $GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), CurrencyConvertFormatPrice($savings))."</span>";
  134.                 } else {
  135.                     $GLOBALS['PriceLabel'] = GetLang('Price');
  136.                     $GLOBALS['HideRRP'] = "none";
  137.                 }
  138.             }
  139.             else {
  140.                 $GLOBALS['PriceLabel'] = GetLang('Price');
  141.                 $GLOBALS['HideShipping'] = 'none';
  142.                 if($GLOBALS['ISC_CLASS_PRODUCT']->ArePricesHidden() || !GetConfig('ShowProductPrice')) {
  143.                     if($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()) {
  144.                         $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel();
  145.                     }
  146.                     else {
  147.                         $GLOBALS['HidePrice'] = "display: none;";
  148.                     }
  149.                 } else {
  150.                     $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
  151.                 }
  152.  
  153.                 $GLOBALS['HideRRP'] = 'none';
  154.             }
  155.  
  156.             // Is this product linked to a brand?
  157.             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName() != "" && GetConfig('ShowProductBrand')) {
  158.                 $GLOBALS['BrandName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
  159.                 $GLOBALS['BrandLink'] = BrandLink($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
  160.             }
  161.             else {
  162.                 $GLOBALS['HideBrandLink'] = "none";
  163.             }
  164.  
  165.             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) {
  166.                 // It's a physical product
  167.                 $GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
  168.             }
  169.             else {
  170.                 // It's a digital product
  171.                 $GLOBALS['HideWeight'] = "none";
  172.                 $GLOBALS['HideShipping'] = "none";
  173.             }
  174.  
  175.             // Are reviews disabled? Then don't show anything related to reviews
  176.             if(GetConfig('EnableProductReviews') == 0) {
  177.                 $GLOBALS['HideReviewLink'] = "none";
  178.                 $GLOBALS['HideRating'] = "none";
  179.                 $GLOBALS['HideReviews'] = "none";
  180.             }
  181.             else {
  182.                 // How many reviews are there?
  183.                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) {
  184.                     $GLOBALS['HideReviewLink'] = "none";
  185.                 }
  186.                 else {
  187.                     $GLOBALS['HideNoReviewsMessage'] = "none";
  188.                     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 1) {
  189.                         $GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1');
  190.                     } else {
  191.                         $GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews());
  192.                     }
  193.                 }
  194.             }
  195.  
  196.             // Has a product availability been given?
  197.             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability() != "") {
  198.                 $GLOBALS['Availability'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability());
  199.             } else {
  200.                 $GLOBALS['HideAvailability'] = "none";
  201.             }
  202.  
  203.             // Is there an SKU for this product?
  204.             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU() != "" && GetConfig('ShowProductSKU')) {
  205.                 $GLOBALS['SKU'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
  206.             }
  207.             else {
  208.                 $GLOBALS['HideSKU'] = "none";
  209.             }
  210.  
  211.             if(!GetConfig('ShowProductRating')) {
  212.                 $GLOBALS['HideRating'] = "none";
  213.             }
  214.  
  215.             $GLOBALS['Rating'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetRating();
  216.             $GLOBALS['CartLink'] = CartLink();
  217.  
  218.             $GLOBALS['ProductDesc'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetDesc();
  219.             if(!trim($GLOBALS['ProductDesc'])) {
  220.                 $GLOBALS['HidePanels'][] = 'ProductDescription';
  221.             }
  222.  
  223.             $GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;
  224.  
  225.             $GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);
  226.  
  227.             $GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();
  228.  
  229.             // Are there any custom fields for this product? If so, load them
  230.             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumCustomFields() > 0) {
  231.                 $this->LoadProductCustomFields();
  232.             }
  233.             else {
  234.                 $GLOBALS['HideCustomFields'] = "none";
  235.             }
  236.  
  237.             if (GetConfig('ShowInventory') == 1 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() > 0) {
  238.                 $GLOBALS['InventoryList'] = '';
  239.                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 2) {
  240.                     $variations = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVariations();
  241.                     if (empty($options)) {
  242.                         $GLOBALS['HideCurrentStock'] = "display: none;";
  243.                     }
  244.                 }
  245.                 else if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 1) {
  246.                     $currentStock = $GLOBALS['ISC_CLASS_PRODUCT']->GetInventoryLevel();
  247.                     if ($currentStock <= 0) {
  248.                         $GLOBALS['InventoryList'] = GetLang('SoldOut');
  249.                     }
  250.                     else {
  251.                         $GLOBALS['InventoryList'] = $currentStock;
  252.                     }
  253.                 }
  254.             }
  255.             else {
  256.                 $GLOBALS['HideCurrentStock'] = "display: none;";
  257.             }
  258.  
  259.             if(GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
  260.                 require_once ISC_BASE_PATH.'/includes/display/SideProductAddToCart.php';
  261.                 ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
  262.                 $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
  263.             }
  264.            
  265.             $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
  266.         }
  267.  
  268.         function LoadProductCustomFields()
  269.         {
  270.  
  271.             $GLOBALS['SNIPPETS']['ProductCustomFields'] = "";
  272.  
  273.             $query = sprintf("select * from [|PREFIX|]product_customfields where fieldprodid='%d' order by fieldid asc", $GLOBALS['ISC_CLASS_DB']->Quote($GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()));
  274.             $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
  275.  
  276.             while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
  277.                 $GLOBALS['CustomFieldName'] = isc_html_escape($row['fieldname']);
  278.                 $GLOBALS['CustomFieldValue'] = $row['fieldvalue'];
  279.                 $GLOBALS['SNIPPETS']['ProductCustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductCustomFieldItem");
  280.             }
  281.         }
  282.  
  283.         function LoadCustomerWishLists()
  284.         {
  285.             $wishLists = array();
  286.             if(CustomerIsSignedIn()) {
  287.                 $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
  288.                 $customer_id = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();
  289.  
  290.                 // get customer's wish list from database
  291.                 $query = "SELECT * FROM [|PREFIX|]wishlists WHERE customerid = ".$customer_id;
  292.                 $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
  293.                 while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
  294.                     $wishLists[] = $row;
  295.                 }
  296.             }
  297.             return $wishLists;
  298.         }
  299.     }
  300.  
  301.  
  302. ?>
  303.  
  304.  



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.


Code: [ Select ]
 
$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';
}
 
  1.  
  2. $product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
  3. $dimensions = array(
  4.     'ProductHeight' => 'prodheight',
  5.     'ProductWidth' => 'prodwidth',
  6.     'ProductDepth' => 'proddepth'
  7. );
  8. foreach($dimensions as $global => $field) {
  9.     if($product[$dimensions] > 0) {
  10.         $GLOBALS[$global] = FormatWeight($product[$field], false);
  11.         $hasDimensions = true;
  12.     }
  13.     else {
  14.         $GLOBALS['Hide'.$global] = 'display: none';
  15.     }
  16. }
  17.  
  18.  
  19. if(!isset($hasDimensions)) {
  20.     $GLOBALS['HideDimensions'] = 'display: none';
  21. }
  22.  




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
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

The following line
Code: [ Select ]
if($product[$dimensions] > 0) {


Should probably be one of the following two instead.

Code: [ Select ]
if($product[$global] > 0) {

Code: [ Select ]
if($product[$field] > 0) {

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 52 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.