コード例 #1
0
 public function SetPanelSettings()
 {
     $GLOBALS['HideProductErrorMessage'] = 'display:none';
     if (isset($_SESSION['ProductErrorMessage']) && $_SESSION['ProductErrorMessage'] != '') {
         $GLOBALS['HideProductErrorMessage'] = '';
         $GLOBALS['ProductErrorMessage'] = $_SESSION['ProductErrorMessage'];
         unset($_SESSION['ProductErrorMessage']);
     }
     $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();
     $GLOBALS['ProductPrice'] = '';
     // Get the vendor information
     $vendorInfo = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor();
     $GLOBALS['HideVendorDetails'] = 'display: none';
     $GLOBALS['VendorName'] = '';
     if (is_array($vendorInfo)) {
         //$GLOBALS['HideVendorDetails'] = '';
         $GLOBALS['VendorName'] = '<a href="' . VendorLink($vendorInfo) . '">' . isc_html_escape($vendorInfo['vendorname']) . '</a>';
     }
     // Can this product be gift wrapped? And do we have any gift wrapping options set up?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanBeGiftWrapped() && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
         $GLOBALS['HideGiftWrapMessage'] = '';
         $GLOBALS['GiftWrappingAvailable'] = GetLang('GiftWrappingOptionsAvailable');
     } else {
         $GLOBALS['HideGiftWrapMessage'] = 'display: none';
     }
     $thumb = '';
     $GLOBALS['ImagePopupJavascript'] = "showProductImageNew('" . $this->ProdImageLink($GLOBALS['ProductId']) . "', 0, 0);";
     //$GLOBALS['VideoPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productvideo.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['VideoPopupJavascript'] = "showProductVideoNew('" . $this->ProdVideoLink($GLOBALS['ProductId']) . "');";
     //$GLOBALS['AudioPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productaudio.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['AudioPopupJavascript'] = "showProductVideoNew('" . $this->ProdAudioLink($GLOBALS['ProductId']) . "');";
     // 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['LightBoxImageList'] = '';
         $query = "\n\t\t\t\t\tSELECT imagefile\n\t\t\t\t\tFROM [|PREFIX|]product_images\n\t\t\t\t\tWHERE imageprodid='" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' AND imageisthumb=0\n\t\t\t\t\tORDER BY imagesort ASC\n\t\t\t\t";
         $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="' . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()) . '"';
             $GLOBALS['LightBoxImageList'] .= '>&nbsp;</a>';
         }
         $GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox(); return false;";
         $GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
     }
     // Is there a thumbnail image we can show?
     $thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
     $thumbImage = '';
     if ($thumb == '' && GetConfig('DefaultProductImage') != '') {
         if (GetConfig('DefaultProductImage') == 'template') {
             $thumb = GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/ProductDefault.gif';
         } else {
             $thumb = GetConfig('ShopPath') . '/' . GetConfig('DefaultProductImage');
         }
         $thumbImage = '<img src="' . $thumb . '" alt="" />';
     } else {
         if ($thumb != '') {
             $thumbImage = '<img src="' . GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $thumb . '" alt="" />';
         }
     }
     // 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'] = $thumbImage;
     } else {
         $GLOBALS['ThumbImage'] = '<a href="#" onclick="' . $GLOBALS['ImagePopupJavascript'] . '">' . $thumbImage . '</a>';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 2) {
             $var = "MorePictures1";
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
                 $var = "SeeLargerImage";
             } else {
                 $var = "MorePictures2";
             }
         }
         $GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
         $this->SetAdditionalView();
     }
     // Is there more than one video? If not, hide the "See videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() == 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() == 0) {
         $GLOBALS['HideVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() > 0) {
             $var = "SeeVideos";
         } else {
             $GLOBALS['HideSpecVideosLink'] = "none";
         }
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() > 0) {
             $avar = "SeeAudios";
         } else {
             $GLOBALS['HideSpecAudiosLink'] = "none";
         }
         $GLOBALS['SeeVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos());
         $GLOBALS['SeeAudios'] = sprintf(GetLang($avar), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios());
     }
     //more Videos link ends Added by Simha
     // Is there more than one video? If not, hide the "See Ins videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() == 0) {
         $GLOBALS['HideInsVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() > 0) {
             $var = "SeeInsVideos";
         }
         $GLOBALS['SeeInsVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos());
     }
     //more Ins Videos link ends Added by Simha
     //Added by Simha to hide Not For Sale Msg
     $GLOBALS['DisplayNotForSaleMsg'] = 'none';
     if ($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         if (!GetConfig('ShowProductShipping')) {
             $GLOBALS['HideShipping'] = 'none';
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
                 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');
                     }
                 }
             } else {
                 $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
             }
         }
         // Is tax already included in this price?
         if (GetConfig('TaxTypeSelected') > 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductTaxable()) {
             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();
         $catquery = " SELECT DISTINCT c.categoryid\n                FROM isc_categories c                                                 \n                LEFT JOIN isc_categoryassociations ca ON c.categoryid = ca.categoryid \n                LEFT JOIN isc_products p ON ca.productid = p.productid AND p.prodvisible='1'\n                WHERE p.productid= " . $GLOBALS['ProductId'] . "";
         $relcats = array();
         $catresult = $GLOBALS['ISC_CLASS_DB']->Query($catquery);
         while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catresult)) {
             $relcats[] = $catrow['categoryid'];
         }
         $productCats = $relcats;
         $DiscountInfo = GetRuleModuleInfo();
         $FinalPrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
         foreach ($DiscountInfo as $DiscountInfoSub) {
             $catids = explode(",", $DiscountInfoSub['catids']);
             foreach ($catids as $catid) {
                 if (in_array($catid, $productCats)) {
                     $DiscountAmount = $FinalPrice * ((int) $DiscountInfoSub['amount'] / 100);
                     if ($DiscountAmount < 0) {
                         $DiscountAmount = 0;
                     }
                     $DiscountAmount = $FinalPrice - $DiscountAmount;
                 }
             }
         }
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['RetailPrice'] = "<strike>" . CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) . "</strike>";
             // blessen
             //$GLOBALS['PriceLabel'] = GetLang('YourPrice');
             $GLOBALS['PriceLabel'] = GetLang('Price');
             $savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
             $GLOBALS['HideRRP'] = "none";
             //$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), "<span class=
             //'YouSaveAmount'>".CurrencyConvertFormatPrice($savings)."</span>")."</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_TEMPLATE']->ParseGL($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel());
             } else {
                 $GLOBALS['HidePrice'] = "display: none;";
             }
         } else {
             $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
         }
         $GLOBALS['HideRRP'] = 'none';
         //To display not for sale message Added by Simha
         $GLOBALS['DisplayNotForSaleMsg'] = '';
     }
     // 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
         $prodweight = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         # Added to hide the weight lable while the value is 0.00 Baskaran
         if ($prodweight == '0.00 LBS') {
             $GLOBALS['HideWeight'] = "none";
         } else {
             $GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         }
     } else {
         // It's a digital product
         $GLOBALS['HideWeight'] = "none";
     }
     $product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
     $dimensions = array('ProductHeight' => 'prodheight', 'ProductWidth' => 'prodwidth', 'ProductDepth' => 'proddepth');
     foreach ($dimensions as $global => $field) {
         if ($product[$field] > 0) {
             $GLOBALS[$global] = FormatWeight($product[$field], false);
             $hasDimensions = true;
         } else {
             $GLOBALS['Hide' . $global] = 'display: none';
         }
     }
     if (!isset($hasDimensions)) {
         $GLOBALS['HideDimensions'] = 'display: 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();
     /* Baskaran added to display image in product detail page */
     $brandimage = $GLOBALS['ISC_CLASS_PRODUCT']->GetProdbrandimagefile();
     $imageurl = '';
     if ($brandimage != '' || !empty($brandimage)) {
         $imageurl = GetConfig('ShopPath') . "/product_images/" . $brandimage;
     } else {
         $imageurl = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
     }
     $GLOBALS['ImageUrl'] = $imageurl;
     /* Baskaran ends */
     $GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;
     $GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);
     $GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();
     // Does this product have any bulk discount?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanUseBulkDiscounts()) {
         $GLOBALS['HideBulkDiscountLink'] = '';
         $GLOBALS['BulkDiscountThickBoxTitle'] = sprintf(GetLang('BulkDiscountThickBoxTitle'), isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()));
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         $GLOBALS['BulkDiscountThickBoxRates'] = ISC_SIDEPRODUCTADDTOCART_PANEL::GetProductBulkDiscounts();
         $GLOBALS['ProductBulkDiscountThickBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBulkDiscountThickBox");
     } else {
         $GLOBALS['HideBulkDiscountLink'] = '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;";
     }
     /* Added for to display the "Make an offer" Button -- Baskaran */
     # Checked for the selected series offer is 'yes'
     $GLOBALS['HideOfferButton'] = 'none';
     if (GetConfig('ShowBestOffer') == '1') {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesOffer() == 'yes') {
             $GLOBALS['HideOfferButton'] = '';
         } else {
             # Checking for the selected sub category offer is 'yes'
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetCategoryOffer() == 'yes') {
                 $GLOBALS['HideOfferButton'] = '';
             } else {
                 # Checking brand offer is 'yes' and corresponding series offer are 'no'
                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesCntOffer() == 0) {
                     $GLOBALS['HideOfferButton'] = '';
                 } else {
                     # Checking for Root category offer is 'yes' and corresponding sub category offer are 'no'
                     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetRootCategoryOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSubCategoryCntOffer() == 0) {
                         $GLOBALS['HideOfferButton'] = '';
                     } else {
                         $GLOBALS['HideOfferButton'] = 'none';
                     }
                 }
             }
         }
     }
     /* Code Ends */
     if (GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
         //blessen
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart1");
         } else {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
         }
         //blessen
         // original $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
     }
     //blessen
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
         $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice());
         $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike>&nbsp;&nbsp;<b alt='Price may be adjusted. Add to your cart and see the final price.'  Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>";
     }
     $GLOBALS['ShowOnSaleImage'] = '';
     if (isset($DiscountAmount) && $DiscountAmount < $FinalPrice) {
         //&& GetConfig('ShowOnSale')
         $GLOBALS['ProductPrice'] = "<strike>" . CurrencyConvertFormatPrice($FinalPrice) . "</strike>";
         $GLOBALS['DiscountPrice'] = "" . CurrencyConvertFormatPrice($DiscountAmount) . "";
         if (GetConfig('ShowOnSale')) {
             $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
         }
     }
     //blessen
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
 }
コード例 #2
0
 public function SetPanelSettings()
 {
     $GLOBALS['HideProductErrorMessage'] = 'display:none';
     if (isset($_SESSION['ProductErrorMessage']) && $_SESSION['ProductErrorMessage'] != '') {
         $GLOBALS['HideProductErrorMessage'] = '';
         $GLOBALS['ProductErrorMessage'] = $_SESSION['ProductErrorMessage'];
         unset($_SESSION['ProductErrorMessage']);
     }
     $GLOBALS['ProductCartQuantity'] = '';
     if (isset($GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) {
         $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()];
     }
     //temp script to shortern the product name
     $pid = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $querytemp = "SELECT prodbrandid FROM  [|PREFIX|]products where productid = " . $pid . "  ";
     $resulttemp = $GLOBALS['ISC_CLASS_DB']->Query($querytemp);
     $brand = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp);
     if ($brand['prodbrandid'] == 37) {
         $querytemp1 = "SELECT c.catname, c.catcombine FROM [|PREFIX|]categories \tc left join [|PREFIX|]categoryassociations ca on c.categoryid = ca.categoryid  left join [|PREFIX|]products p on ca.productid = p.productid where p.productid =  '" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' ";
         $resulttemp1 = $GLOBALS['ISC_CLASS_DB']->Query($querytemp1);
         $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp1);
         if ($cat['catcombine'] != "") {
             $GLOBALS['ProductName'] = $cat['catcombine'] . " Part Number " . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
         } else {
             $GLOBALS['ProductName'] = $cat['catname'] . " Part Number " . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
         }
     } else {
         $GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
     }
     //temp script to shortern the product name
     //$GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
     $GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $GLOBALS['ProductPrice'] = '';
     // Get the vendor information
     $vendorInfo = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor();
     $GLOBALS['HideVendorDetails'] = 'display: none';
     $GLOBALS['VendorName'] = '';
     if (is_array($vendorInfo)) {
         //$GLOBALS['HideVendorDetails'] = '';
         $GLOBALS['VendorName'] = '<a href="' . VendorLink($vendorInfo) . '">' . isc_html_escape($vendorInfo['vendorname']) . '</a>';
     }
     // Can this product be gift wrapped? And do we have any gift wrapping options set up?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanBeGiftWrapped() && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
         $GLOBALS['HideGiftWrapMessage'] = '';
         $GLOBALS['GiftWrappingAvailable'] = GetLang('GiftWrappingOptionsAvailable');
     } else {
         $GLOBALS['HideGiftWrapMessage'] = 'display: none';
     }
     $thumb = '';
     $GLOBALS['ImagePopupJavascript'] = "showProductImageNew('" . $this->ProdImageLink($GLOBALS['ProductId']) . "', 0, 0);";
     //$GLOBALS['VideoPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productvideo.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['VideoPopupJavascript'] = "showProductVideoNew('" . $this->ProdVideoLink($GLOBALS['ProductId']) . "');";
     //$GLOBALS['AudioPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productaudio.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['AudioPopupJavascript'] = "showProductVideoNew('" . $this->ProdAudioLink($GLOBALS['ProductId']) . "');";
     // 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['LightBoxImageList'] = '';
         $query = "\n\t\t\t\t\tSELECT imagefile\n\t\t\t\t\tFROM [|PREFIX|]product_images\n\t\t\t\t\tWHERE imageprodid='" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' AND imageisthumb=0\n\t\t\t\t\tORDER BY imagesort ASC\n\t\t\t\t";
         $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="' . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()) . '"';
             $GLOBALS['LightBoxImageList'] .= '>&nbsp;</a>';
         }
         $GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox(); return false;";
         $GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
     }
     // Is there a thumbnail image we can show?
     $thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
     $thumbImage = '';
     if ($thumb == '' && GetConfig('DefaultProductImage') != '') {
         if (GetConfig('DefaultProductImage') == 'template') {
             $thumb = GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/ProductDefault.gif';
         } else {
             $thumb = GetConfig('ShopPath') . '/' . GetConfig('DefaultProductImage');
         }
         $thumbImage = '<img src="' . $thumb . '" alt="" />';
     } else {
         if ($thumb != '') {
             $thumbImage = '<img src="' . GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $thumb . '" alt="" />';
         }
     }
     // 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'] = $thumbImage;
     } else {
         $GLOBALS['ThumbImage'] = '<a href="#" onclick="' . $GLOBALS['ImagePopupJavascript'] . '">' . $thumbImage . '</a>';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 2) {
             $var = "MorePictures1";
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
                 $var = "SeeLargerImage";
             } else {
                 $var = "MorePictures2";
             }
         }
         $GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
         $this->SetAdditionalView();
     }
     // Is there more than one video? If not, hide the "See videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() == 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() == 0) {
         $GLOBALS['HideVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() > 0) {
             $var = "SeeVideos";
         } else {
             $GLOBALS['HideSpecVideosLink'] = "none";
         }
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() > 0) {
             $avar = "SeeAudios";
         } else {
             $GLOBALS['HideSpecAudiosLink'] = "none";
         }
         $GLOBALS['SeeVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos());
         $GLOBALS['SeeAudios'] = sprintf(GetLang($avar), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios());
     }
     //more Videos link ends Added by Simha
     // Is there more than one video? If not, hide the "See Ins videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() == 0) {
         $GLOBALS['HideInsVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() > 0) {
             $var = "SeeInsVideos";
         }
         $GLOBALS['SeeInsVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos());
     }
     //more Ins Videos link ends Added by Simha
     //Added by Simha to hide Not For Sale Msg
     $GLOBALS['DisplayNotForSaleMsg'] = 'none';
     if ($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         if (!GetConfig('ShowProductShipping')) {
             $GLOBALS['HideShipping'] = 'none';
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
                 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');
                     }
                 }
             } else {
                 $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
             }
         }
         // Is tax already included in this price?
         if (GetConfig('TaxTypeSelected') > 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductTaxable()) {
             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();
         $catquery = " SELECT DISTINCT c.categoryid, p.brandseriesid\n                FROM isc_categories c                                                 \n                LEFT JOIN isc_categoryassociations ca ON c.categoryid = ca.categoryid \n                LEFT JOIN isc_products p ON ca.productid = p.productid AND p.prodvisible='1'\n                WHERE p.productid= " . $GLOBALS['ProductId'] . "";
         $relcats = array();
         $brandseries = 0;
         $catresult = $GLOBALS['ISC_CLASS_DB']->Query($catquery);
         while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catresult)) {
             $relcats[] = $catrow['categoryid'];
             $brandseries = $catrow['brandseriesid'];
         }
         $productCats = $relcats;
         $discounttype = 0;
         //$DiscountInfo = GetRuleModuleInfo();
         //$FinalPrice    = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
         //$FinalPrice    = $GLOBALS['ProductPrice'];
         $FinalPrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetPrice();
         $SalePrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetSalePrice();
         if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) {
             $DiscountPrice = $SalePrice;
         } else {
             $DiscountPrice = $FinalPrice;
             $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $productCats[0], $brandseries, $discounttype);
         }
         /*
         foreach($DiscountInfo as $DiscountInfoSub)   {  
             $catids = explode(",", $DiscountInfoSub['catids']);
             foreach($catids as $catid) {
                 if(in_array($catid, $productCats)) {     
                     $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); 
                     if ($DiscountAmount < 0) {
                         $DiscountAmount = 0;
                     }
                     $DiscountAmount  = $FinalPrice - $DiscountAmount; 
                 } 
             }  
         }
         */
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['RetailPrice'] = "<strike>" . CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice()) . "</strike>";
             // blessen
             //$GLOBALS['PriceLabel'] = GetLang('YourPrice');
             $GLOBALS['PriceLabel'] = GetLang('Price');
             $savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice();
             $GLOBALS['HideRRP'] = "none";
             //$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), "<span class=
             //'YouSaveAmount'>".CurrencyConvertFormatPrice($savings)."</span>")."</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_TEMPLATE']->ParseGL($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel());
             } else {
                 $GLOBALS['HidePrice'] = "display: none;";
             }
         } else {
             $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
         }
         $GLOBALS['HideRRP'] = 'none';
         //To display not for sale message Added by Simha
         $GLOBALS['DisplayNotForSaleMsg'] = '';
     }
     // 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
         $prodweight = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         # Added to hide the weight lable while the value is 0.00 Baskaran
         if ($prodweight == '0.00 LBS') {
             $GLOBALS['HideWeight'] = "none";
         } else {
             $GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         }
     } else {
         // It's a digital product
         $GLOBALS['HideWeight'] = "none";
     }
     $product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
     $dimensions = array('ProductHeight' => 'prodheight', 'ProductWidth' => 'prodwidth', 'ProductDepth' => 'proddepth');
     foreach ($dimensions as $global => $field) {
         if ($product[$field] > 0) {
             $GLOBALS[$global] = FormatWeight($product[$field], false);
             $hasDimensions = true;
         } else {
             $GLOBALS['Hide' . $global] = 'display: none';
         }
     }
     if (!isset($hasDimensions)) {
         $GLOBALS['HideDimensions'] = 'display: 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();
     /* Baskaran added to display image in product detail page */
     $brandimage = $GLOBALS['ISC_CLASS_PRODUCT']->GetProdbrandimagefile();
     $imageurl = '';
     if ($brandimage != '' || !empty($brandimage)) {
         $imageurl = GetConfig('ShopPath') . "/product_images/" . $brandimage;
     } else {
         $imageurl = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
     }
     $GLOBALS['ImageUrl'] = $imageurl;
     /* Baskaran ends */
     $GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;
     $GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);
     $GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();
     // Does this product have any bulk discount?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanUseBulkDiscounts()) {
         $GLOBALS['HideBulkDiscountLink'] = '';
         $GLOBALS['BulkDiscountThickBoxTitle'] = sprintf(GetLang('BulkDiscountThickBoxTitle'), isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()));
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         $GLOBALS['BulkDiscountThickBoxRates'] = ISC_SIDEPRODUCTADDTOCART_PANEL::GetProductBulkDiscounts();
         $GLOBALS['ProductBulkDiscountThickBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBulkDiscountThickBox");
     } else {
         $GLOBALS['HideBulkDiscountLink'] = '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;";
     }
     /* Added for to display the "Make an offer" Button -- Baskaran */
     # Checked for the selected series offer is 'yes'
     $GLOBALS['HideOfferButton'] = 'none';
     if (GetConfig('ShowBestOffer') == '1') {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesOffer() == 'yes') {
             $GLOBALS['HideOfferButton'] = '';
         } else {
             # Checking for the selected sub category offer is 'yes'
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetCategoryOffer() == 'yes') {
                 $GLOBALS['HideOfferButton'] = '';
             } else {
                 # Checking brand offer is 'yes' and corresponding series offer are 'no'
                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesCntOffer() == 0) {
                     $GLOBALS['HideOfferButton'] = '';
                 } else {
                     # Checking for Root category offer is 'yes' and corresponding sub category offer are 'no'
                     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetRootCategoryOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSubCategoryCntOffer() == 0) {
                         $GLOBALS['HideOfferButton'] = '';
                     } else {
                         $GLOBALS['HideOfferButton'] = 'none';
                     }
                 }
             }
         }
     }
     //Check for item in Cart Session
     $CartItems = $_SESSION['CART']['ITEMS'];
     $compids = array();
     $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     //print_r($CartItems);
     foreach ($CartItems as $key => $item) {
         if ($item['product_id'] == $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()) {
             if ($item['compitem'] == 1) {
                 foreach ($item['complementary'] as $citem) {
                     $compids[$citem['comp_productid']] = $citem['quantity'];
                 }
             }
             break;
         }
     }
     //Check for item in Cart Session Ends
     # Complementary items -- Baskaran
     $productid = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $make = '';
     $model = '';
     $year = '';
     if ($GLOBALS['EnableSEOUrls'] == 0) {
         if (isset($_REQUEST['make']) && $_REQUEST['make'] != '') {
             $make = MakeURLNormal($_REQUEST['make']);
         }
         if (isset($_REQUEST['model']) && $_REQUEST['model'] != '') {
             $model = MakeURLNormal($_REQUEST['model']);
         }
         if (isset($_REQUEST['year']) && $_REQUEST['year'] != '') {
             $year = $_REQUEST['year'];
         }
     } else {
         if (count($GLOBALS['PathInfo']) > 0) {
             foreach ($GLOBALS['PathInfo'] as $key => $value) {
                 if (eregi('make=', $value)) {
                     $make = MakeURLNormal(substr($value, strpos($value, '=') + 1));
                 } else {
                     if (eregi('model=', $value)) {
                         $model = MakeURLNormal(substr($value, strpos($value, '=') + 1));
                     } else {
                         if (eregi('year=', $value)) {
                             $year = substr($value, strpos($value, '=') + 1);
                         }
                     }
                 }
             }
         }
     }
     $where = '';
     if ($make != '') {
         $where .= "and (prodmake = '" . $make . "' or prodmake = 'NON-SPEC VEHICLE')";
     }
     if ($model != '') {
         $where .= " and (prodmodel = '" . $model . "' or prodmodel = 'ALL')";
     }
     if ($year != '') {
         $where .= " and (({$year} between prodstartyear and prodendyear) or (prodstartyear = 'ALL'and prodendyear = 'ALL'))";
     }
     $result = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT id,productid FROM [|PREFIX|]import_variations where productid = '" . $productid . "' {$where} order by id");
     $impvariationid = '';
     while ($improw = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
         $impvariationid[] = $improw['id'];
     }
     $impid = implode("','", $impvariationid);
     $impquery = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT complementaryitems FROM [|PREFIX|]application_data where variationid in('" . $impid . "') AND complementaryitems != ''");
     if ($GLOBALS["ISC_CLASS_DB"]->countResult($impquery) > 0) {
         $compitems = '';
         while ($joinrecord = $GLOBALS["ISC_CLASS_DB"]->Fetch($impquery)) {
             $compitems .= $joinrecord['complementaryitems'] . ",";
         }
         $comp = substr($compitems, 0, -1);
         if ($comp != '') {
             # Spliting the string with [ ] with regular expression -- Baskaran
             $temp = $comp;
             $temp = htmlspecialchars_decode($temp);
             preg_match_all('/\\[([^\\]]+)\\]/', $temp, $matches);
             $compexplode = $matches[1];
             $cntproducts = count($compexplode);
             /*$arraycnt = array_count_values($compexplode);    
               asort($arraycnt);
               $compunique = array_keys($arraycnt);
               rsort($compunique);
               $cntproducts = count($compunique);*/
             $originalarray = array();
             $tempArr = array();
             $tempArr1 = array();
             # Checking whether the SKU are valid and present in the db -- Baskaran
             for ($i = 0; $i < $cntproducts; $i++) {
                 $split = split(",", $compexplode[$i]);
                 $sku = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'");
                 if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) == 1 and $split[0] != 0) {
                     if (in_array($split[0], $tempArr)) {
                         continue;
                     }
                     $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2];
                     $tempArr[] = $split[0];
                 } else {
                     if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) != 1 and $split[0] == 0) {
                         if (in_array($split[0], $tempArr1)) {
                             continue;
                         }
                         $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2];
                         $tempArr1[] = $split[0];
                     }
                 }
             }
             $cntoriginal = count($originalarray);
             # Ordering the resultent array which is come from above one with the no thanks option '0' is the key to create the array -- Baskaran
             $arrManipulate = array();
             $nothanks = array();
             for ($i = 0; $i < $cntoriginal; $i++) {
                 $orsplit = split(",", $originalarray[$i]);
                 if ($i == 0 and $orsplit[0] == 0) {
                     $arrManipulate[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2];
                 } else {
                     if ($i != 0 and $orsplit[0] == 0) {
                         $nothanks[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2];
                     } else {
                         $arrManipulate[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2];
                     }
                 }
             }
             if (count($nothanks) > 0) {
                 $arrOrder = array_merge($arrManipulate, $nothanks);
             } else {
                 $arrOrder = $arrManipulate;
             }
             $cntarrOrder = count($arrOrder);
             if ($cntarrOrder > 0) {
                 $complementary = "<table cellspacing='2' cellpadding='0' border='0' width='100%'>";
                 for ($i = 0; $i < $cntarrOrder; $i++) {
                     $split = split(",", $arrOrder[$i]);
                     $sku = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'");
                     $skurow = $GLOBALS["ISC_CLASS_DB"]->Fetch($sku);
                     $brandname = $skurow['brandname'];
                     $catname = $skurow['catname'];
                     $skucode = $skurow['prodcode'];
                     $productid = $split[0] != 0 ? $skurow['productid'] : '0';
                     # $split[0] is sku code, $split[1] is comp. price
                     $path = $skurow['imagefile'];
                     $feature = $skurow['proddescfeature'];
                     $prodimage = '';
                     if ($skurow['imagefile'] != '') {
                         $prodimage = GetConfig('ShopPath') . "/product_images/{$path}";
                     } else {
                         $prodimage = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
                     }
                     $compdesc = html_entity_decode($split[2]);
                     $compprice = "<b>Price :" . CurrencyConvertFormatPrice($split[1]) . "</b>";
                     $price = CurrencyConvertFormatPrice($split[1]);
                     $feature = addslashes($feature);
                     $esc = htmlentities($feature, ENT_QUOTES);
                     $pricefeature = $esc . isc_html_escape($compprice);
                     $pricefeature = $esc . isc_html_escape($compprice);
                     if (isset($compids[$productid])) {
                         $sel = $compids[$productid];
                         $styleval = "style='display: block;'";
                         $checked = "checked = 'checked'";
                     } else {
                         $sel = 0;
                         $styleval = "style='display: none;'";
                         $checked = "";
                     }
                     if ($i == 0 and $productid != 0) {
                         if (count($compids) == 0) {
                             $styleval = "style='display: block;'";
                             $checked = " checked = 'checked' ";
                         }
                         $complementary .= '<input type="hidden" name="hidmake" value="' . $make . '" id="hidmake" />';
                         $complementary .= '<input type="hidden" name="hidmodel" value="' . $model . '" id="hidmodel" />';
                         $complementary .= '<input type="hidden" name="hidyear" value="' . $year . '" id="hidyear" />';
                         $complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_" . $i . "' value='" . $productid . "' {$checked} onclick='ActiveProductTab(\"CompItem_Tab\");ShowCompDesc(\"{$skucode}\",this.id);unCheck()'>" . "<label id='complabel' for='rdprod_" . $i . "' onmouseover= 'loadHoverImage(event, \"{$prodimage}\", \"{$pricefeature}\");' onmouseout = 'hideTip();'>&nbsp;<a href='#Compl'>{$catname} {$brandname} {$skucode}</a></label>" . "{$compdesc}" . "</td>\n                            <td><div {$styleval} id='compqty_" . $productid . "'>" . $this->BuildOption('compqty[' . $productid . ']', $sel) . "</div></td><td><div id='pr_" . $productid . "' {$styleval}><b>{$price}<b></div></td>\n                                </tr>";
                     } else {
                         if ($i == 0 and $productid == 0) {
                             if (count($compids) == 0) {
                                 $checked = " checked = 'checked' ";
                             }
                             $complementary .= '<input type="hidden" name="hidmake" value="' . $make . '" id="hidmake" />';
                             $complementary .= '<input type="hidden" name="hidmodel" value="' . $model . '" id="hidmodel" />';
                             $complementary .= '<input type="hidden" name="hidyear" value="' . $year . '" id="hidyear" />';
                             //						$complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_".$i."' value='".$productid."' checked = 'checked'>"."<label for='rdprod_".$i."'>&nbsp;$split[2]</label>"."</td></tr>";
                             $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' {$checked} onclick='Check()'>" . "<label for='nothanks'>&nbsp;{$split['2']}</label><input type = 'hidden' name = 'isremovable' value = '1' />" . "</td></tr>";
                         } else {
                             if ($i != 0 and $productid != 0) {
                                 $complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_" . $i . "' value='" . $productid . "' {$checked} onclick='ActiveProductTab(\"CompItem_Tab\");ShowCompDesc(\"{$skucode}\",this.id);unCheck()'>" . "<label id='complabel' for='rdprod_" . $i . "' onmouseover= 'loadHoverImage(event, \"{$prodimage}\", \"{$pricefeature}\");' onmouseout = 'hideTip();'>&nbsp;<a href='#Compl'>{$catname} {$brandname} {$skucode}</a></label>" . "{$compdesc}" . "</td>\n                            <td><div {$styleval} id='compqty_" . $productid . "'>" . $this->BuildOption('compqty[' . $productid . ']', $sel) . "</div></td><td><div id='pr_" . $productid . "' {$styleval}><b>{$price}</b></div></td>\n                                </tr>";
                             } else {
                                 if ($i != 0 and $productid == 0) {
                                     $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' onclick='Check()'>" . "<label for='nothanks'>&nbsp;{$split['2']}</label><input type = 'hidden' name = 'isremovable' value = '1' />" . "</td></tr>";
                                 }
                             }
                         }
                     }
                     $complementary .= '<input type="hidden" name="hidRadio" value="' . $brandname . " " . $skucode . '" id="hid_rdprod_' . $i . '" />';
                 }
                 $complementary .= "</table>";
                 $GLOBALS['complementaryproducts'] = $complementary;
                 $GLOBALS['complementarypaneltoshow'] = "%%Panel.ComplementartyItems%%<hr />";
             }
         }
     }
     /* Code Ends */
     if (GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
         //blessen
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart1");
         } else {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
         }
         //Added by Simha
         if (isc_strtolower($GLOBALS['ISC_CLASS_PRODUCT']->IsTestData()) == 'yes') {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = "<hr>" . GetLang('ThisIsTestData');
         }
         //blessen
         // original $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
     }
     $price_for_shipping = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
     //blessen
     //$GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() replaced by GetPrice
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() && (double) $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() > 0) {
         $price_for_shipping = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice();
         $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice());
         $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike>&nbsp;&nbsp;<b alt='Price may be adjusted. Add to your cart and see the final price.'  Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>";
     }
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $DiscountPrice && $discounttype == 1) {
         $price_for_shipping = $DiscountPrice;
         $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice());
         $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike>&nbsp;&nbsp;<b alt='Price may be adjusted. Add to your cart and see the final price.'  Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>";
     }
     $GLOBALS['ShowOnSaleImage'] = '';
     if (isset($DiscountPrice) && $discounttype == 0 && $DiscountPrice < $FinalPrice) {
         //&& GetConfig('ShowOnSale')
         $price_for_shipping = $DiscountPrice;
         $GLOBALS['ProductPrice'] = "<strike>" . CurrencyConvertFormatPrice($FinalPrice) . "</strike>";
         $GLOBALS['DiscountPrice'] = "" . CurrencyConvertFormatPrice($DiscountPrice) . "";
         if (GetConfig('ShowOnSale')) {
             $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
         }
     }
     $price = 0;
     $upper_price = 0;
     $shipping_qry = "SELECT variablename, variableval FROM isc_shipping_vars WHERE methodid='1' AND modulename='shipping_bytotal' AND ( variablename LIKE 'cost_0' OR variablename LIKE 'lower_0' OR variablename LIKE 'upper_0' )";
     $shipping_res = $GLOBALS['ISC_CLASS_DB']->Query($shipping_qry);
     while ($shipping_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($shipping_res)) {
         if ($shipping_arr['variablename'] == 'cost_0') {
             $price = $shipping_arr['variableval'];
         }
         if ($shipping_arr['variablename'] == 'upper_0') {
             $upper_price = $shipping_arr['variableval'];
         }
     }
     if ($price_for_shipping < $upper_price) {
         $GLOBALS['ShippingPrice'] = "\$" . $price;
     } else {
         $GLOBALS['ShippingPrice'] = "Ships Freight Free, see <a href='" . $GLOBALS['ShopPath'] . "/pages/8'>policy</a> for details";
     }
     //blessen
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
 }
コード例 #3
0
 public function LoadEventDate($position = 'middle')
 {
     $output = '';
     $productId = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $fields = $GLOBALS['ISC_CLASS_PRODUCT']->GetEventDateFields();
     if (empty($fields['prodeventdaterequired'])) {
         return;
     }
     $GLOBALS['EventDateName'] = '<div class="FloatLeft Required"><span class="Required" style="margin-right : 4px;">*</span></div> ' . $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'] = ISC_SIDEPRODUCTADDTOCART_PANEL::_GetDayOptions();
     $GLOBALS['OverviewToMonths'] = ISC_SIDEPRODUCTADDTOCART_PANEL::_GetMonthOptions();
     $GLOBALS['OverviewToYears'] = ISC_SIDEPRODUCTADDTOCART_PANEL::_GetYearOptions($from_year, $to_year);
     if ($position != 'middle') {
         $GLOBALS['EventDateMonthStyle'] = ' width : 44px; font-size : 90%;';
         $GLOBALS['EventDateDayStyle'] = 'width : 40px; font-size : 90%;';
         $GLOBALS['EventDateYearStyle'] = 'width : 50px; font-size : 90%;';
     }
     $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);
 }