2

我在我的网站上收到上述错误,这里是代码,它说第 104 行与私有函数 SetPreorderData() 相关 - 即我的代码的第一行。如果有人能对此有所了解,我将不胜感激!

private function SetPreorderData()
{
    $GLOBALS['SNIPPETS']['ProductExpectedReleaseDate'] = '';

    if (!$this->productClass->IsPreOrder()) {
        return;
    }

    if ($this->productClass->GetReleaseDate()) {
        $GLOBALS['ReleaseDate'] = isc_html_escape($this->productClass->GetPreOrderMessage());
        if (!$GLOBALS['ReleaseDate']) {
            return;
        }
    } else {
        $GLOBALS['ReleaseDate'] = GetLang('PreOrderProduct');
    }

    $GLOBALS['SNIPPETS']['ProductExpectedReleaseDate'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductExpectedReleaseDate');
}

/**
* Set the display options for min/max qty
*/
private function SetMinMaxQty()
{
    $js = '';

    if ($this->productClass->GetMinQty()) {
        $GLOBALS['HideMinQty'] = '';
        $GLOBALS['MinQty'] = $this->productClass->GetMinQty();
        $js .= 'productMinQty=' . $this->productClass->GetMinQty() . ';';
        $js .= 'lang.ProductMinQtyError = ' . isc_json_encode(GetLang('ProductMinQtyError', array(
            'product' => $this->productClass->GetProductName(),
            'qty' => $this->productClass->GetMinQty(),
        ))) . ';';
    } else {
        $GLOBALS['HideMinQty'] = 'display:none;';
        $GLOBALS['MinQty'] = '';
        $js .= 'productMinQty=0;';
    }

    if ($this->productClass->GetMaxQty() !== INF) {
        $GLOBALS['HideMaxQty'] = '';
        $GLOBALS['MaxQty'] = $this->productClass->GetMaxQty();
        $js .= 'productMaxQty=' . $this->productClass->GetMaxQty() . ';';
        $js .= 'lang.ProductMaxQtyError = ' . isc_json_encode(GetLang('ProductMaxQtyError', array(
            'product' => $this->productClass->GetProductName(),
            'qty' => $this->productClass->GetMaxQty(),
        ))) . ';';
    } else {
        $GLOBALS['HideMaxQty'] = 'display:none;';
        $GLOBALS['MaxQty'] = '';
        $js .= 'productMaxQty=Number.POSITIVE_INFINITY;';
    }

    $GLOBALS['ProductMinMaxQtyJavascript'] = $js;
}

这是文件的完整代码:

CLASS ISC_PRODUCTDETAILS_PANEL extends PANEL
{
    /**
     * @var ISC_PRODUCT Instance of the product class that this panel is loading details for.
     */
    private $productClass = null;

    /**
     * @var MySQLDb Instance of the database class.
     */
    private $db = null;

    private $hasRequiredFileFields = false;

    /**
     * Set the display settings for this panel.
     */
    public function SetPanelSettings()
    {
        $this->productClass = GetClass('ISC_PRODUCT');
        $this->db = $GLOBALS['ISC_CLASS_DB'];

        if(!empty($_SESSION['ProductErrorMessage'])) {
            FlashMessage($_SESSION['ProductErrorMessage'], 'error');
        }
        $GLOBALS['ProductDetailFlashMessages'] = GetFlashMessageBoxes();

        $GLOBALS['ProductName'] = isc_html_escape($this->productClass->GetProductName());
        $GLOBALS['ProductId'] = $this->productClass->GetProductId();
        $GLOBALS['ProductPrice'] = '';

        if(isset($_SESSION['ProductErrorMessage']) && $_SESSION['ProductErrorMessage']!='') {
            $GLOBALS['HideProductErrorMessage']='';
            $GLOBALS['ProductErrorMessage']=$_SESSION['ProductErrorMessage'];
            unset($_SESSION['ProductErrorMessage']);
        }

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

        $product = $this->productClass->getProduct();
        if($product['prodvariationid'] > 0 || $product['prodconfigfields'] || $product['prodeventdaterequired']) {
            $GLOBALS['ISC_CLASS_TEMPLATE']->assign('ConfigurableProductClass', 'ConfigurableProduct');
        }
        else {
            $GLOBALS['ISC_CLASS_TEMPLATE']->assign('ConfigurableProductClass', 'NonConfigurableProduct');
        }

        // We've got a lot to do on this page, so to make it easier to follow,
        // everything is broken down in to smaller functions.
        $this->SetVendorDetails();
        $this->SetWrappingDetails();
        $this->SetProductImages();
        $this->SetShippingCost();
        $this->SetPricingDetails();
        $this->SetProductDimensions();
        $this->SetProductReviews();
        $this->SetBulkDiscounts();
        $this->SetBrandDetails();
        $this->SetInventoryDetails();
        $this->SetMiscAttributes();
        $this->SetPurchasingOptions();
        $this->SetProductVariations();
        $this->SetPreorderData();
        $this->SetMinMaxQty();

         ###### LOGIN FOR PRICE HACK BOF#############
         $customerClass = GetClass('ISC_CUSTOMER');
         if(!$customerClass->GetCustomerId()) {
         return;
         }
         $groupId = 0;
         $customerClass = GetClass('ISC_CUSTOMER');
         $customer = $customerClass->GetCustomerInfo();
         if(isset($customer['custgroupid'])) {
         $groupId = $customer['custgroupid'];
         }
         if($customer['custgroupid'] == 0) {
         return;

        // Mobile devices don't support file uploads, so if this is a mobile device then don't show
        // any configuration for the product and show a message that the product must be purchased
        // on the full site.
        if($this->hasRequiredFileFields && $GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
            $GLOBALS['SNIPPETS']['ProductFieldsList'] = '';
            $GLOBALS['SNIPPETS']['VariationList'] = '';
            $GLOBALS['SNIPPETS']['EventDate'] = '';
            $GLOBALS['ConfigurableProductClass'] = 'NonConfigurableProduct';
            $GLOBALS['DisplayAdd'] = 'none';
            $GLOBALS['SNIPPETS']['SideAddItemSoldOut'] = $GLOBALS['ISC_CLASS_TEMPLATE']->getSnippet('ProductNotOrderableOnMobiles');
        }

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

    /**
    * Set display options for a preorder product
    *
    */
    private function SetPreorderData()
    {
        $GLOBALS['SNIPPETS']['ProductExpectedReleaseDate'] = '';

        if (!$this->productClass->IsPreOrder()) {
            return;
        }

        if ($this->productClass->GetReleaseDate()) {
            $GLOBALS['ReleaseDate'] = isc_html_escape($this->productClass->GetPreOrderMessage());
            if (!$GLOBALS['ReleaseDate']) {
                return;
            }
        } else {
            $GLOBALS['ReleaseDate'] = GetLang('PreOrderProduct');
        }

        $GLOBALS['SNIPPETS']['ProductExpectedReleaseDate'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductExpectedReleaseDate');
    }

    /**
    * Set the display options for min/max qty
    */
    private function SetMinMaxQty()
    {
        $js = '';

        if ($this->productClass->GetMinQty()) {
            $GLOBALS['HideMinQty'] = '';
            $GLOBALS['MinQty'] = $this->productClass->GetMinQty();
            $js .= 'productMinQty=' . $this->productClass->GetMinQty() . ';';
            $js .= 'lang.ProductMinQtyError = ' . isc_json_encode(GetLang('ProductMinQtyError', array(
                'product' => $this->productClass->GetProductName(),
                'qty' => $this->productClass->GetMinQty(),
            ))) . ';';
        } else {
            $GLOBALS['HideMinQty'] = 'display:none;';
            $GLOBALS['MinQty'] = '';
            $js .= 'productMinQty=0;';
        }

        if ($this->productClass->GetMaxQty() !== INF) {
            $GLOBALS['HideMaxQty'] = '';
            $GLOBALS['MaxQty'] = $this->productClass->GetMaxQty();
            $js .= 'productMaxQty=' . $this->productClass->GetMaxQty() . ';';
            $js .= 'lang.ProductMaxQtyError = ' . isc_json_encode(GetLang('ProductMaxQtyError', array(
                'product' => $this->productClass->GetProductName(),
                'qty' => $this->productClass->GetMaxQty(),
            ))) . ';';
        } else {
            $GLOBALS['HideMaxQty'] = 'display:none;';
            $GLOBALS['MaxQty'] = '';
            $js .= 'productMaxQty=Number.POSITIVE_INFINITY;';
        }

        $GLOBALS['ProductMinMaxQtyJavascript'] = $js;
    }

    /**
     * Set the display options for the shipping pricing.
     */
    private function SetShippingCost()
    {
        if(!GetConfig('ShowProductShipping') || $this->productClass->GetProductType() != PT_PHYSICAL) {
            $GLOBALS['HideShipping'] = 'none';
            return;
        }

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

    /**
     * Set general pricing details for the product.
     */
    private function SetPricingDetails()
    {
        $product = $this->productClass->getProduct();

        $GLOBALS['PriceLabel'] = GetLang('Price');

        if($this->productClass->GetProductCallForPricingLabel()) {
            $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($this->productClass->GetProductCallForPricingLabel());
        }
        // If prices are hidden, then we don't need to go any further
        else if($this->productClass->ArePricesHidden()) {
            $GLOBALS['HidePrice'] = "display: none;";
            $GLOBALS['HideRRP'] = 'none';
            $GLOBALS['ProductPrice'] = '';
            return;
        }
        else {
            $options = array('strikeRetail' => false);
            $GLOBALS['ProductPrice'] = formatProductDetailsPrice($product, $options);
        }

        // Determine if we need to show the RRP for this product or not
        // by comparing the price of the product including any taxes if
        // there are any
        $GLOBALS['HideRRP'] = "none";
        $productPrice = $product['prodcalculatedprice'];
        $retailPrice = $product['prodretailprice'];
        if($retailPrice) {
            // Get the tax display format
            $displayFormat = getConfig('taxDefaultTaxDisplayProducts');
            $options['displayInclusive'] = $displayFormat;

            // Convert to the browsing currency, and apply group discounts
            $productPrice = formatProductPrice($product, $productPrice, array(
                'localeFormat' => false, 'displayInclusive' => $displayFormat
            ));
            $retailPrice = formatProductPrice($product, $retailPrice, array(
                'localeFormat' => false, 'displayInclusive' => $displayFormat
            ));

            if($productPrice < $retailPrice) {
                $GLOBALS['HideRRP'] = '';

                // Showing call for pricing, so just show the RRP and that's all
                if($this->productClass->GetProductCallForPricingLabel()) {
                    $GLOBALS['RetailPrice'] = CurrencyConvertFormatPrice($retailPrice);
                }
                else {
                    // ISC-1057: do not apply customer discount to RRP in this case
                    $retailPrice = formatProductPrice($product, $product['prodretailprice'], array(
                        'localeFormat' => false,
                        'displayInclusive' => $displayFormat,
                        'customerGroup' => 0,
                    ));
                    $GLOBALS['RetailPrice'] = '<strike>' . formatPrice($retailPrice) . '</strike>';
                    $GLOBALS['PriceLabel'] = GetLang('YourPrice');
                    $savings = $retailPrice - $productPrice;
                    $string = sprintf(getLang('YouSave'), '<span class="YouSaveAmount">'.formatPrice($savings).'</span>');
                    $GLOBALS['YouSave'] = '<span class="YouSave">'.$string.'</span>';
                }
            }
        }
    }

    /**
     * Setup the purchasing options such as quantity box, stock messages,
     * add to cart button, product fields etc.
     */
    private function SetPurchasingOptions()
    {
        if(!$this->productClass->IsPurchasingAllowed()) {
            $GLOBALS['DisplayAdd'] = 'none';
            return;
        }

        $GLOBALS['AddToCartButton'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductAddToCartButton');

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

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

        // If we're using a cart quantity drop down, load that
        if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
            if ($this->productClass->GetMinQty()) {
                $GLOBALS['Quantity' . $this->productClass->GetMinQty()] = 'selected="selected"';
            } else {
                $GLOBALS['Quantity1'] = 'selected="selected"';
            }
            $GLOBALS['QtyOptionZero'] = "";
            $GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
        }
        // Otherwise, load the textbox
        else {
            $GLOBALS['ProductQuantity'] = 1;
            $GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
        }

        // Can we sell this product/option
        $saleable = IsProductSaleable($this->productClass->GetProduct());
        $variations = $this->productClass->GetProductVariationOptions();
        if(!empty($variations) && $this->productClass->GetProductInventoryTracking() == 2) {
            $productInStock = true;
        }
        else {
            $productInStock = $saleable;
        }

        if($productInStock == true) {
            $GLOBALS['SNIPPETS']['SideAddItemSoldOut'] = '';
            $GLOBALS['DisplayAdd'] = "";

            if (GetConfig('FastCartAction') == 'popup' && GetConfig('ShowCartSuggestions')) {
                $GLOBALS['FastCartButtonJs'] = ' && fastCartAction(event)';
            }
        }
        else if($this->productClass->IsPurchasingAllowed()) {
            $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideAddItemSoldOut");
            $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
            $GLOBALS['SNIPPETS']['SideAddItemSoldOut'] = $output;

            $GLOBALS['BuyBoxSoldOut'] = "ProductBuyBoxSoldOut";
            $GLOBALS['DisplayAdd'] = "none";
            $GLOBALS['ISC_LANG']['BuyThisItem'] = GetLang('ItemUnavailable');
        }

        if(GetConfig('ShowAddToCartQtyBox') == 1) {
            $GLOBALS['DisplayAddQty'] = $GLOBALS['DisplayAdd'];
        }
        else {
            $GLOBALS['DisplayAddQty'] = "none";
        }

        if($this->productClass->IsPurchasingAllowed()) {
            $this->LoadEventDate();
            $this->LoadProductFieldsLayout();
        }

        $GLOBALS['ShowAddToCartQtyBox'] = GetConfig('ShowAddToCartQtyBox');
    }

    /**
     * Setup the list of variations for this product if it has any.
     */
    private function SetProductVariations()
    {
        $GLOBALS['VariationList'] = '';
        $GLOBALS['SNIPPETS']['VariationList'] = '';
        $GLOBALS['HideVariationList'] = '';
        $GLOBALS['ProductOptionRequired'] = "false";

        // Are there any product variations?
        $variationOptions = $this->productClass->GetProductVariationOptions();

        if(empty($variationOptions)) {
            $GLOBALS['HideVariationList'] = 'display:none;';
            return;
        }

        $variationValues = $this->productClass->GetProductVariationOptionValues();

        // Is a product option required when adding the product to the cart?
        if($this->productClass->IsOptionRequired()) {
            $GLOBALS['ProductOptionRequired'] = "true";
        }

        if(count($variationOptions) == 1) {
            $onlyOneVariation = true;
            $GLOBALS['OptionMessage'] = GetLang('ChooseAnOption');
        }
        else {
            $GLOBALS['OptionMessage'] = GetLang('ChooseOneOrMoreOptions');
            $onlyOneVariation = false;
        }
        $useSelect = false;
        $GLOBALS['VariationNumber'] = 0;

        foreach($variationOptions as $optionName) {
            // If this is the only variation then instead of select boxes, just show radio buttons
            $GLOBALS['VariationChooseText'] = "";
            $GLOBALS['VariationNumber']++;
            $GLOBALS['VariationName'] = isc_html_escape($optionName);
            $GLOBALS['SNIPPETS']['OptionList'] = '';

            // Fixes cases where for one reason or another there are no options for a specific variation
            // Botched import?
            if(empty($variationValues[$optionName])) {
                continue;
            }

            if($onlyOneVariation && count($variationValues[$optionName]) <= 5 && !$this->productClass->IsOptionRequired()) {
                $GLOBALS['OptionId'] = 0;
                $GLOBALS['OptionValue'] = GetLang('zNone');
                $GLOBALS['OptionChecked'] = "checked=\"checked\"";
                $GLOBALS['SNIPPETS']['OptionList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductVariationListSingleItem");
            }
            else if($onlyOneVariation && count($variationValues[$optionName]) > 5) {
                $useSelect = true;
            }

            // Build the list of options
            $GLOBALS['OptionChecked'] = '';
            if (isset($variationValues[$optionName])) {
                foreach($variationValues[$optionName] as $optionid => $value) {
                    $GLOBALS['OptionId'] = (int)$optionid;
                    $GLOBALS['OptionValue'] = isc_html_escape($value);
                    if($onlyOneVariation && !$useSelect) {
                        $GLOBALS['SNIPPETS']['OptionList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductVariationListSingleItem");
                    }
                    else {
                        $GLOBALS['SNIPPETS']['OptionList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductVariationListMultipleItem");
                    }
                }
            }

            if($onlyOneVariation == true && !$useSelect) {
                $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductVariationListSingle");
            }
            else {
                $GLOBALS['VariationChooseText'] = GetLang('ChooseA')." ".isc_html_escape($optionName);
                $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductVariationListMultiple");
            }
            $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
            $GLOBALS['SNIPPETS']['VariationList'] .= $output;
        }
    }

    /**
     * Set the event date entry fields up.
     */
    public function LoadEventDate()
    {
        $output = '';
        $productId = $this->productClass->GetProductId();
        $fields = ($this->productClass->GetEventDateFields());


        if (empty($fields['prodeventdaterequired'])) {
            return;
        }

        $GLOBALS['EventDateName'] = '<span class="Required">*</span>'.$fields['prodeventdatefieldname'];

        $from_stamp = $fields['prodeventdatelimitedstartdate'];
        $to_stamp = $fields['prodeventdatelimitedenddate'];

        $to_day = isc_date("d", $to_stamp);
        $from_day = isc_date("d", $from_stamp);

        $to_month = isc_date("m", $to_stamp);
        $from_month = isc_date("m", $from_stamp);

        $to_year = isc_date("Y", $to_stamp);
        $from_year = isc_date("Y", $from_stamp);

        $to_date = isc_date('jS M Y',$to_stamp);
        $from_date = isc_date('jS M Y',$from_stamp);

        $eventDateInvalidMessage = sprintf(GetLang('EventDateInvalid'), strtolower($fields['prodeventdatefieldname']));

        $comp_date = '';
        $comp_date_end = '';
        $eventDateErrorMessage = '';

        $edlimited = $fields['prodeventdatelimited'];
        if (empty($edlimited)) {
            $from_year = isc_date('Y');
            $to_year = isc_date('Y',isc_gmmktime(0, 0, 0, 0,0,isc_date('Y')+5));
            $GLOBALS['EventDateLimitations'] = '';
        } else {
            if ($fields['prodeventdatelimitedtype'] == 1) {
                $GLOBALS['EventDateLimitations'] = sprintf(GetLang('EventDateLimitations1'),$from_date,$to_date);

                $comp_date = isc_date('Y/m/d', $from_stamp);
                $comp_date_end = isc_date('Y/m/d', $to_stamp);

                $eventDateErrorMessage = sprintf(GetLang('EventDateLimitationsLong1'), strtolower($fields['prodeventdatefieldname']),$from_date, $to_date);

            } else if ($fields['prodeventdatelimitedtype'] == 2) {
                $to_year = isc_date('Y', isc_gmmktime(0, 0, 0, isc_date('m',$from_stamp),isc_date('d',$from_stamp),isc_date('Y',$from_stamp)+5));
                $GLOBALS['EventDateLimitations'] = sprintf(GetLang('EventDateLimitations2'), $from_date);

                $comp_date = isc_date('Y/m/d', $from_stamp);

                $eventDateErrorMessage = sprintf(GetLang('EventDateLimitationsLong2'), strtolower($fields['prodeventdatefieldname']),$from_date);


            } else if ($fields['prodeventdatelimitedtype'] == 3) {
                $from_year = isc_date('Y', time());
                $GLOBALS['EventDateLimitations'] = sprintf(GetLang('EventDateLimitations3'),$to_date);

                $comp_date = isc_date('Y/m/d', $to_stamp);

                $eventDateErrorMessage = sprintf(GetLang('EventDateLimitationsLong3'), strtolower($fields['prodeventdatefieldname']),$to_date);
            }
        }


        $GLOBALS['OverviewToDays'] = $this->GetDayOptions();
        $GLOBALS['OverviewToMonths'] = $this->GetMonthOptions();
        $GLOBALS['OverviewToYears'] = $this->GetYearOptions($from_year,$to_year);

        $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('EventDate');
        $GLOBALS['SNIPPETS']['EventDate'] = $output;

        $GLOBALS['EventDateJavascript'] = sprintf("<script type=\"text/javascript\"> var eventDateData = {type:'%s',compDate:'%s',compDateEnd:'%s',invalidMessage:'%s',errorMessage:'%s'}; </script>",
            $fields['prodeventdatelimitedtype'],
            $comp_date,
            $comp_date_end,
            $eventDateInvalidMessage,
            $eventDateErrorMessage
        );
    }

    /**
     * Generate a list of the day options available for event dates.
     *
     * @return string HTML string containing option tags for days 1 to 31.
     */
    private function GetDayOptions()
    {
        $output = '<option value=\'-1\'>---</option>';
        for($i = 1; $i <= 31; $i++) {
            $output .= sprintf("<option value='%d'>%s</option>", $i, $i);
        }

        return $output;
    }

    /**
     * Generate select options for selecting a delivery date month.
     *
     * @return string HTML string containing option tags for available months.
     */
    private function GetMonthOptions()
    {
        $output = '<option value=\'-1\'>---</option>';
        for($i = 1; $i <= 12; $i++) {
            $stamp = isc_gmmktime(0, 0, 0, $i, 1, 2000);
            $month = isc_date("M", $stamp);
            $output .= sprintf("<option value='%d'>%s</option>", $i, $month);
        }

        return $output;
    }

    /**
     * Generate select options for selecting a delivery date year.
     *
     * @param int $from The year to start from.
     * @param int $to The year to end at.
     * @return string HTML string containing option tags for available years.
     */
    private function GetYearOptions($from, $to)
    {
        $output = '<option value=\'-1\'>---</option>';
        for($i = $from; $i <= $to; $i++) {
            $output .= sprintf("<option value='%d'>%s</option>", $i, $i);
        }

        return $output;
    }

    /**
     * Generate the configurable product fields if this product has any.
     */
    public function LoadProductFieldsLayout()
    {
        $output = '';
        $productId = $this->productClass->GetProductId();
        $fields = $this->productClass->GetProductFields($productId);
        if(empty($fields)) {
            return;
        }

        foreach($fields as $field) {
            $GLOBALS['ProductFieldType'] = isc_html_escape($field['type']);
            $GLOBALS['ItemId'] = 0;
            $GLOBALS['ProductFieldId'] = (int)$field['id'];
            $GLOBALS['ProductFieldName'] = isc_html_escape($field['name']);
            $GLOBALS['ProductFieldInputSize'] = '';
            $GLOBALS['ProductFieldRequired'] = '';
            $GLOBALS['FieldRequiredClass'] = '';
            $GLOBALS['CheckboxFieldNameLeft'] = '';
            $GLOBALS['CheckboxFieldNameRight'] = '';
            $GLOBALS['HideCartFileName'] = 'display:none';
            $GLOBALS['HideDeleteFileLink'] = 'display:none';
            $GLOBALS['HideFileHelp'] = "display:none";
            $snippetFile = 'ProductFieldInput';

            switch ($field['type']) {
                case 'textarea': {
                    $snippetFile = 'ProductFieldTextarea';
                    break;
                }
                case 'file': {
                    if(!$GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
                        $GLOBALS['HideFileHelp'] = "";
                        $GLOBALS['FileSize'] = Store_Number::niceSize($field['fileSize']*1024);
                        $GLOBALS['FileTypes'] = $field['fileType'];
                    }
                    if($field['required']) {
                        $this->hasRequiredFileFields = true;
                    }
                    break;
                }
                case 'checkbox': {
                    $GLOBALS['CheckboxFieldNameLeft'] = isc_html_escape($field['name']);
                    $snippetFile = 'ProductFieldCheckbox';
                    break;
                }
                case 'select':
                    $options = explode(',', $field['selectOptions']);
                    $optionStr = '<option value="">' . GetLang('PleaseChooseAnOption') . '</option>';
                    foreach ($options as $option) {
                        $option = trim($option);
                        $optionStr .= "<option value=\"" . isc_html_escape($option) . "\">" . isc_html_escape($option) . "</option>\n";
                    }
                    $GLOBALS['SelectOptions'] = $optionStr;
                    $snippetFile = 'ProductFieldSelect';
                    break;
                default: break;
            }

            if($field['required']) {
                $GLOBALS['ProductFieldRequired'] = '<span class="Required">*</span>';
                $GLOBALS['FieldRequiredClass'] = 'FieldRequired';
            }
            $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippetFile);
        }
        $GLOBALS['SNIPPETS']['ProductFieldsList'] = $output;
    }

    /**
     * Generate the bulk discounts window if this product has any.
     */
    public function SetBulkDiscounts()
    {
        // Does this product have any bulk discount?
        if (!$this->productClass->CanUseBulkDiscounts()) {
            $GLOBALS['HideBulkDiscountLink'] = 'none';
            return;
        }

        $GLOBALS['HideBulkDiscountLink'] = '';
        $GLOBALS['BulkDiscountThickBoxTitle'] = sprintf(GetLang('BulkDiscountThickBoxTitle'), isc_html_escape($this->productClass->GetProductName()));

        $rates = '';
        $prevMax = 0;
        $query = "
            SELECT *
            FROM [|PREFIX|]product_discounts
            WHERE discountprodid = " . (int)$this->productClass->GetProductId() . "
            ORDER BY IF(discountquantitymax > 0, discountquantitymax, discountquantitymin) ASC
        ";

        $result = $this->db->Query($query);
        while ($row = $this->db->Fetch($result)) {

            $range = '';
            if ($row['discountquantitymin'] == 0) {
                $range = isc_html_escape(intval($prevMax+1) . ' - ' . (int)$row['discountquantitymax']);
            } else if ($row['discountquantitymax'] == 0) {
                $range = isc_html_escape(sprintf(GetLang('BulkDiscountThickBoxDiscountOrAbove'), (int)$row['discountquantitymin']));
            } else {
                $range = isc_html_escape((int)$row['discountquantitymin'] . ' - ' . (int)$row['discountquantitymax']);
            }

            $discount = '';
            switch (isc_strtolower(isc_html_escape($row['discounttype']))) {
                case 'price':
                    $discount = sprintf(GetLang('BulkDiscountThickBoxDiscountPrice'), $range, CurrencyConvertFormatPrice(isc_html_escape($row['discountamount'])));
                    break;

                case 'percent':
                    $discount = sprintf(GetLang('BulkDiscountThickBoxDiscountPercent'), $range, (int)$row['discountamount'] . '%');
                    break;

                case 'fixed';
                    $price = CalculateCustGroupDiscount($this->productClass->GetProductId(),$row['discountamount']);
                    $discount = sprintf(GetLang('BulkDiscountThickBoxDiscountFixed'), $range, CurrencyConvertFormatPrice(isc_html_escape($price)));
                    break;
            }

            $rates .= '<li>' . isc_html_escape($discount) . '</li>';

            if ($row['discountquantitymax'] !== 0) {
                $prevMax = $row['discountquantitymax'];
            }
        }

        $GLOBALS['BulkDiscountThickBoxRates'] = $rates;
        $GLOBALS['ProductBulkDiscountThickBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBulkDiscountThickBox");
    }
4

1 回答 1

6

您在公共函数 SetPanelSettings() 中缺少右括号。

 if($customer['custgroupid'] == 0) {
 return;

在那之后添加一个}。

于 2013-09-28T08:39:46.853 回答