public function _LoadVariationCombinationsTable($VariationId, $ShowInventoryFields, $ProductId = 0, $ProductHash = '') { $GLOBALS['HeaderRows'] = ""; $GLOBALS['VariationRows'] = ""; $options = array(); $option_ids = array(); $i = 0; $query = sprintf("SELECT DISTINCT(voname) FROM [|PREFIX|]product_variation_options WHERE vovariationid='%d' ORDER BY vooptionsort, vovaluesort", $VariationId); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $GLOBALS['HeaderRows'] .= sprintf("<td>%s</td>", isc_html_escape($row['voname'])); $options[$row['voname']] = array(); $option_ids[$row['voname']] = array(); } // Now get all of the variation combinations $query = sprintf("SELECT * FROM [|PREFIX|]product_variation_options WHERE vovariationid='%d' ORDER BY vooptionsort, vovaluesort", $VariationId); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $options[$row['voname']][] = $row['vovalue']; $option_ids[$row['voname']][] = $row['voptionid']; } // Get the variation combinations as text, such as #red#small#modern $GLOBALS["variation_data"] = array(); $GLOBALS['VariationRows'] = ""; $this->GetCombinationText('', $options); $GLOBALS["variation_combinations"] = $GLOBALS["variation_data"]; // Get the variation combinations ID's, such as #145#185#195 $GLOBALS["variation_data"] = array(); $this->GetCombinationText('', $option_ids); $GLOBALS["variation_combination_ids"] = $GLOBALS["variation_data"]; // Setup a counter $count = 0; // Loop through the variation combination ID's and output them as hidden fields foreach ($GLOBALS["variation_combination_ids"] as $k => $combo) { $GLOBALS['VariationRows'] .= sprintf("\t<input name='options[{$count}][variationcombination]' type='hidden' value='%s' /></td>", $combo); ++$count; } // Reset the counter $count = 0; // Now loop through all of the options and output the combinations if (count($GLOBALS["variation_combinations"]) > 0 && $GLOBALS["variation_combinations"][0] != "") { foreach ($GLOBALS["variation_combinations"] as $k => $combo) { // Set the default values $enabled = 'checked="checked"'; $sku = ""; $add_p_checked = $subtract_p_checked = $fixed_p_checked = ""; $show_price = "none"; $price = ""; $add_w_checked = $subtract_w_checked = $fixed_w_checked = ""; $show_weight = "none"; $weight = ""; if (isId($ProductId) || $ProductHash !== '') { // Get the variation combination's existing details from the product_variation_combinations table $combo_ids = preg_replace("/^#/", "", $GLOBALS["variation_combination_ids"][$count]); $combo_ids = str_replace("#", ",", $combo_ids); $query = "SELECT * FROM [|PREFIX|]product_variation_combinations WHERE vcoptionids='" . $GLOBALS['ISC_CLASS_DB']->Quote($combo_ids) . "' AND "; if (isId($ProductId)) { $query .= "vcproductid=" . (int) $ProductId; } else { $query .= "vcproducthash='" . $GLOBALS['ISC_CLASS_DB']->Quote($ProductHash) . "'"; } $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); // Are there any option details? if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { if ($row['vcenabled'] == 1) { $enabled = 'checked="checked"'; } else { $enabled = ""; } $sku = $row['vcsku']; $add_p_checked = $subtract_p_checked = $fixed_p_checked = ""; $show_price = "none"; $price = ""; switch ($row['vcpricediff']) { case "add": $add_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; case "subtract": $subtract_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; case "fixed": $fixed_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; } $add_w_checked = $subtract_w_checked = $fixed_w_checked = ""; $show_weight = "none"; $weight = ""; switch ($row['vcweightdiff']) { case "add": $add_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; case "subtract": $subtract_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; case "fixed": $fixed_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; } } } $GLOBALS['VariationRows'] .= sprintf("<input type='hidden' name='options[{$count}][id]' value='%d' />", $row['combinationid']); $GLOBALS['VariationRows'] .= "<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver'\" onmouseout=\"this.className='GridRow'\">"; $GLOBALS['VariationRows'] .= "\t<td style='width:30px; padding-left:5px'><img src='images/variation.gif' width='16' height='16' /></td>"; $GLOBALS['VariationRows'] .= sprintf("\t<td style='padding-left:4px'><input name='options[{$count}][enabled]' type='checkbox' %s value='ON' /></td>", $enabled); $combo = preg_replace("/^#/", "", $combo); $combos = explode("#", $combo); foreach ($combos as $c) { $GLOBALS['VariationRows'] .= sprintf("\t<td>%s</td>", isc_html_escape($c)); } $GLOBALS['VariationRows'] .= sprintf("\t<td><input name='options[{$count}][sku]' type='text' class='Field50' value='%s' /></td>", isc_html_escape($sku)); $GLOBALS['VariationRows'] .= sprintf("\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<select class='PriceDrop' name='options[{$count}][pricediff]' onchange=\"if(this.selectedIndex>0) { \$(this).parent().find('span').show(); \$(this).parent().find('span input').focus(); \$(this).parent().find('span input').select(); } else { \$(this).parent().find('span').hide(); } \">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=''>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option %s value='add'>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option %s value='subtract'>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option %s value='fixed'>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='display:%s'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t%s <input name='options[{$count}][price]' type='text' class='Field50 PriceBox' style='width:40px' value='%s' /> %s\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</td>", GetLang("NoChange"), $add_p_checked, GetLang("VariationAdd"), $subtract_p_checked, GetLang("VariationSubtract"), $fixed_p_checked, GetLang("VariationFixed"), $show_price, $GLOBALS['CurrencyTokenLeft'], $price, $GLOBALS['CurrencyTokenRight']); $GLOBALS['VariationRows'] .= sprintf("\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<select class='WeightDrop' name='options[{$count}][weightdiff]' onchange=\"if(this.selectedIndex>0) { \$(this).parent().find('span').show(); \$(this).parent().find('span input').focus(); \$(this).parent().find('span input').select(); } else { \$(this).parent().find('span').hide(); } \">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=''>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option %s value='add'>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option %s value='subtract'>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option %s value='fixed'>%s</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='display:%s'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input name='options[{$count}][weight]' type='text' class='Field50 WeightBox' style='width:40px' value='%s' /> %s\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</td>", GetLang("NoChange"), $add_w_checked, GetLang("VariationAdd"), $subtract_w_checked, GetLang("VariationSubtract"), $fixed_w_checked, GetLang("VariationFixed"), $show_weight, $weight, GetConfig('WeightMeasurement')); $GLOBALS['VariationRows'] .= "\t<td><input name='options[{$count}][image]' type='file' class='Field150 OptionImage' />"; if ($row['vcimage'] != "") { $GLOBALS['VariationRows'] .= sprintf("\t<br /><input name='options[{$count}][delimage]' id='variation_delete_image_{$count}' type='checkbox' value='ON' /> <label for='variation_delete_image_{$count}'>%s</label> %s <a href='%s' target='_blank'>%s</a>", GetLang("DeleteVariationImage"), GetLang("Currently"), sprintf("%s/%s/%s", $GLOBALS['ShopPath'], GetConfig('ImageDirectory'), $row['vcimage']), $row['vcimage']); } $GLOBALS['VariationRows'] .= "\t</td>"; // Is inventory tracking enabled for variations? if ($ShowInventoryFields) { $InventoryFieldsHide = "display: auto;"; } else { $InventoryFieldsHide = "display: none;"; } $GLOBALS['VariationRows'] .= sprintf("\t<td class=\"VariationStockColumn\" style=\"" . $InventoryFieldsHide . "\"><input name='options[{$count}][currentstock]' type='text' class='Field50 StockLevel' value='%d' /></td>", $row['vcstock']); $GLOBALS['VariationRows'] .= sprintf("\t<td class=\"VariationStockColumn\" style=\"" . $InventoryFieldsHide . "\"><input name='options[{$count}][lowstock]' type='text' class='Field50 LowStockLevel' value='%d' /></td>", $row['vclowstock']); $GLOBALS['VariationRows'] .= "</tr>"; $count++; } } if (!$ShowInventoryFields) { $GLOBALS['HideInv'] = "none"; } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("products.variation.combination"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
public function BuildForm() { if (GetConfig('CurrencyLocation') === 'left') { $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken'); $GLOBALS['CurrencyTokenRight'] = ''; } else { $GLOBALS['CurrencyTokenLeft'] = ''; $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken'); } if (empty($this->rules['cost'])) { $this->LoadWeightRanges(); } if (empty($this->rules['cost'])) { $GLOBALS['POS'] = 0; $GLOBALS['COST_VAL'] = ''; $GLOBALS['LOWER_VAL'] = ''; $GLOBALS['UPPER_VAL'] = ''; return $this->ParseTemplate('weight_range_row', true); } $output = ''; // Sorts the indexes so 0 01 011 0111 ksort($this->rules['cost']); foreach ($this->rules['cost'] as $id => $cost) { $GLOBALS['POS'] = $id; $GLOBALS['COST_VAL'] = FormatPrice($this->rules['cost'][$id], false, false); $GLOBALS['LOWER_VAL'] = FormatWeight($this->rules['lower'][$id], false); $GLOBALS['UPPER_VAL'] = FormatWeight($this->rules['upper'][$id], false); $output .= $this->ParseTemplate('weight_range_row', true); } return $output; }
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'] .= '> </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();'> <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."'> $split[2]</label>"."</td></tr>"; $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' {$checked} onclick='Check()'>" . "<label for='nothanks'> {$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();'> <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'> {$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> <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> <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()); }
public function GetWeight() { return FormatWeight($this->_prodweight, true); }
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'] .= '> </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> <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()); }
public function Action_GetProduct() { if(empty($this->router->request->details->productId)) { $this->BadRequest('The details->productId node is missing'); } $image = new ISC_PRODUCT_IMAGE(); // autoload helper so we can use exceptions defined in the product image class file unset($image); $productId = (int)$this->router->request->details->productId; $productClass = new ISC_PRODUCT($productId); $product = $productClass->_product; // stuff that comes directly from the database may be incomplete -- use the image library to make sure try { if (!$product['imageid']) { // no image present in data so throw an exception just to force the removal of data below in the catch{} block throw new ISC_PRODUCT_IMAGE_EXCEPTION(); } $image = new ISC_PRODUCT_IMAGE(); $image->populateFromDatabaseRow($product); // call the image library to make sure resized images are present and then add full urls so they're useful for remote users $product['imagefiletiny'] = $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_TINY, true, true, false); $product['imagefilethumb'] = $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true, true, false); $product['imagefilestd'] = $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true, true, false); $product['imagefilezoom'] = $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, true, false); // call the image library to make sure resized images are present and the sizes are correct $product['imagefiletinysize'] = implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_TINY)); $product['imagefilethumbsize'] = implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL)); $product['imagefilestdsize'] = implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_STANDARD)); $product['imagefilezoomsize'] = implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_ZOOM)); } catch (Exception $exception) { // some sort of problem when dealing with product images - remove image info from the response unset( $product['imagefiletiny'], $product['imagefilethumb'], $product['imagefilestd'], $product['imagefilezoom'], $product['imagefiletinysize'], $product['imagefilethumbsize'], $product['imagefilestdsize'], $product['imagefilezoomsize'], $product['imagedesc'], $product['imagedateadded'] ); } // direct data feed also includes some fields that are irrelevant or unwanted unset( $product['imagefile'], // don't provide a link to the non-water-marked image $product['imageprodid'], $product['imageprodhash'], $product['imageisthumb'], $product['imagesort'] ); if(empty($product)) { return array(); } $product['prodlink'] = ProdLink($product['prodname']); // Fetch any images for the product $images = new ISC_PRODUCT_IMAGE_ITERATOR(ISC_PRODUCT_IMAGE::generateGetProductImagesFromDatabaseSql((int)$productId)); foreach ($images as $image) { /** @var $image ISC_PRODUCT_IMAGE */ $imageisthumb = 0; if ($image->getIsThumbnail()) { $imageisthumb = 1; } try { $product['images']['item'][] = array( 'imageid' => $image->getProductImageId(), 'imagefiletiny' => $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_TINY, true, true, false), 'imagefilethumb' => $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true, true, false), 'imagefilestd' => $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true, true, false), 'imagefilezoom' => $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, true, false), 'imagefiletinysize' => implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_TINY)), 'imagefilethumbsize' => implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL)), 'imagefilestdsize' => implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_STANDARD)), 'imagefilezoomsize' => implode('x', $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_ZOOM)), 'imageisthumb' => $imageisthumb, 'imagesort' => $image->getSort(), 'imagedesc' => $image->getDescription(), 'imagedateadded' => $image->getDateAdded(), ); } catch (Exception $exception) { // skip this image and bring down the count of product images obtained from ISC_PRODUCT $product['numimages']--; } } // Fetch the categories this product belongs to $trailCategories = array(); $crumbList = array(); $query = " SELECT c.categoryid, c.catparentlist FROM [|PREFIX|]categoryassociations ca JOIN [|PREFIX|]categories c ON (c.categoryid=ca.categoryid) WHERE ca.productId='".(int)$productId."' "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { if ($row['catparentlist'] == '') { $row['catparentlist'] = $row['categoryid']; } $cats = explode(",", $row['catparentlist']); $trailCategories = array_merge($trailCategories, $cats); $crumbList[$row['categoryid']] = $row['catparentlist']; } $trailCategories = implode(",", array_unique($trailCategories)); $categories = array(); if ($trailCategories != '') { // Now load the names for the parent categories from the database $query = " SELECT categoryid, catname FROM [|PREFIX|]categories WHERE categoryid IN (".$trailCategories.") "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $categories[$row['categoryid']] = $row['catname']; } } // Now we have all of the information we need to build the trails, lets actually build them foreach ($crumbList as $productcatid => $trail) { $cats = explode(',', $trail); $catName = ''; $catLink = CatLink($productcatid, $categories[$productcatid]); foreach ($cats as $categoryid) { if(isset($categories[$categoryid])) { if($catName) { $catName .= ' » '; } $catName .= $categories[$categoryid]; } } $product['categories']['item'][] = array( 'name' => $catName, 'link' => $catLink, 'id' => $productcatid ); } if($product['prodvariationid'] > 0) { if ($product['prodsaleprice'] != 0) { $variationBasePrice = $product['prodsaleprice']; } else { $variationBasePrice = $product['prodprice']; } $vop = $productClass->_prodvariationoptions; $vval = $productClass->_prodvariationvalues; foreach($productClass->_prodvariationcombinations as $variation) { $variationPrice = CurrencyConvertFormatPrice(CalcProductVariationPrice($variationBasePrice, $variation['vcpricediff'], $variation['vcprice'], $product)); $variationWeight = FormatWeight(CalcProductVariationWeight($product['prodweight'], $variation['vcweightdiff'], $variation['vcweight']), true); $variationName = array(); $options = explode(',', $variation['vcoptionids']); foreach($options as $k => $optionId) { $label = $vop[$k]; $variationName[] = $label.': '.$vval[$label][$optionId]; } $variationName = implode(', ', $variationName); $variationRow = array( 'name' => $variationName, 'id' => $variation['combinationid'], 'price' => $variationPrice, 'sku' => $variation['vcsku'], 'weight' => $variationWeight, ); if($product['prodinvtrack'] == 2) { $variationRow['stock'] = $variation['vcstock']; } if ($variation['vcimage']) { try { $image = new ISC_PRODUCT_IMAGE; $image->setSourceFilePath($variation['vcimage']); if($variation['vcimagethumb']) { $image->setResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, $variation['vcimagethumb']); $variationRow['thumb'] = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true, false); } if($variation['vcimagestd']) { $image->setResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_STANDARD, $variation['vcimagestd']); $variationRow['standard'] = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true, false); } if($variation['vcimagezoom']) { $image->setResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_ZOOM, $variation['vcimagezoom']); $variationRow['image'] = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, false); } } catch (Exception $exception) { // nothing } } $product['variations']['item'][] = $variationRow; } } return $product; }
public function WriteRow($row) { $expirationDate = isc_date("Y-m-d", strtotime('+29 days')); $link = ProdLink($row['prodname']); $desc = strip_tags($row['proddesc']); // Strip out invalid characters $desc = StripInvalidXMLChars($desc); if(isc_strlen($desc) > 1000) { $desc = isc_substr($desc, 0, 997)."..."; } // Apply taxes to the price $price = getClass('ISC_TAX')->getPrice($row['prodcalculatedprice'], $row['tax_class_id'], getConfig('taxDefaultTaxDisplayProducts')); $entry = array( 'title' => isc_html_escape($row['prodname']), 'link' => isc_html_escape($link), 'description' => isc_html_escape($desc), 'g:department' => isc_html_escape($row['catname']), 'g:expiration_date' => $expirationDate, 'g:id' => $row['productid'], 'g:condition' => isc_html_escape(isc_strtolower($row['prodcondition'])), 'g:price' => $price ); if($row['brandname']) { $entry['g:brand'] = isc_html_escape($row['brandname']); } if(!empty($row['imagefile'])) { try { $image = new ISC_PRODUCT_IMAGE(); $image->populateFromDatabaseRow($row); $entry['g:image_link'] = isc_html_escape($image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, true, false)); } catch (Exception $ex) { } } if($row['prodcode']) { $entry['g:model_number'] = isc_html_escape($row['prodcode']); } if($row['prodweight'] > 0) { if(GetConfig('WeightMeasurement') == 'KGS') { $measure = 'kg'; } else { $measure = strtolower(GetConfig('WeightMeasurement')); } $entry['g:weight'] = FormatWeight($row['prodweight'], false).' '.$measure; } $dimensions = array( 'g:height' => 'prodheight', 'g:length' => 'proddepth', 'g:width' => 'prodwidth' ); if(GetConfig('LengthMeasurement') == 'Centimeters') { $measure = 'cm'; } else { $measure = strtolower(GetConfig('LengthMeasurement')); } foreach($dimensions as $google => $ours) { if($row[$ours] > 0) { $entry[$google] = $row[$ours].' '.$measure; } } // upc codes if(!empty($row['upc'])) { $entry['g:upc'] = StripInvalidXMLChars($row['upc']); } $xml = "<entry>\n"; foreach($entry as $k => $v) { $xml .= "\t<".$k."><![CDATA[".$v."]]></".$k.">\n"; } if(isset($row['prodfreeshipping']) && $row['prodfreeshipping'] != 1){ $xml .= "</entry>\n"; } else { $xml .= "\t<g:shipping><g:price><![CDATA[0]]></g:price></g:shipping>\n</entry>\n"; } fwrite($this->handle, $xml); }
public function _LoadVariationCombinationsTable($VariationId, $ShowInventoryFields, $ProductId=0, $ProductHash='', $filterOptions = array()) { $GLOBALS['HeaderRows'] = ""; $GLOBALS['VariationRows'] = ""; $options = array(); $option_ids = array(); $i = 0; $query = sprintf("SELECT DISTINCT(voname) FROM [|PREFIX|]product_variation_options WHERE vovariationid='%d' ORDER BY vooptionsort, vovaluesort", $VariationId); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $GLOBALS['HeaderRows'] .= sprintf("<td>%s</td>", isc_html_escape($row['voname'])); $options[$row['voname']] = array(); $option_ids[$row['voname']] = array(); } // Now get all of the variation options $query = sprintf("SELECT * FROM [|PREFIX|]product_variation_options WHERE vovariationid='%d' ORDER BY vooptionsort, vovaluesort", $VariationId); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $options[$row['voname']][] = $row['vovalue']; $option_ids[$row['voname']][] = $row['voptionid']; } $newOptions = $options; $newOptionIds = $option_ids; // were filter options submitted? if (!empty($filterOptions)) { foreach ($option_ids as $optionName => $optionValues) { // were values selected for this option? if (isset($filterOptions[$optionName])) { $currentValues = $filterOptions[$optionName]; // ignore filtering if the 'All' value was selected if (!in_array('all', $currentValues)) { // remove any options not in the list $diffValues = array_diff($optionValues, $currentValues); foreach ($diffValues as $value) { $index = array_search($value, $optionValues); unset($newOptions[$optionName][$index]); unset($newOptionIds[$optionName][$index]); } } } } } // create the form for filtering options $filterOptionsHTML = ''; foreach ($option_ids as $optionName => $optionList) { $allSelected = ''; if (!isset($filterOptions[$optionName]) || in_array('all', $filterOptions[$optionName])) { $allSelected = ' selected="selected"'; } $filterOptionsHTML .= '<label>' . isc_html_escape($optionName) . ':</label>'; $filterOptionsHTML .= '<select multiple="multiple" size="4" name="filterOption[' . isc_html_escape($optionName) . '][]"><option value="all"' . $allSelected . '>(' . GetLang('All') . ')</option>'; foreach ($optionList as $optionId) { $key = array_search($optionId, $optionList); $optionValue = $options[$optionName][$key]; $selected = ''; if (isset($filterOptions[$optionName]) && in_array($optionId, $filterOptions[$optionName])) { $selected = ' selected="selected"'; } $filterOptionsHTML .= '<option value="' . isc_html_escape($optionId) . '"' . $selected . '>' . isc_html_escape($optionValue) . '</option>'; } $filterOptionsHTML .= '</select><br />'; } $GLOBALS['FilterOptions'] = $filterOptionsHTML; $page = 0; $start = 0; $numOptions = 1; $numPages = 0; $GLOBALS['Nav'] = ""; $max = 0; /* $validSortFields = array('productid', 'prodcode', 'currentinv', 'prodname', 'prodcalculatedprice', 'prodvisible', $featuredColumn); if(isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") { $sortOrder = "asc"; } else { $sortOrder = "desc"; } if(isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) { $sortField = $_REQUEST['sortField']; SaveDefaultSortField("ManageProducts", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageProducts", "productid", $sortOrder); } */ if(isset($_GET['page'])) { $page = (int)$_GET['page']; } else { $page = 1; } //$sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder); //$GLOBALS['SortURL'] = $sortURL; $sortURL = ''; // Limit the number of questions returned if($page == 1) { $start = 1; } else { $start = ($page * ISC_PRODUCTS_PER_PAGE) - (ISC_PRODUCTS_PER_PAGE-1); } $start = $start-1; foreach ($newOptions as $option) { $numOptions *= count($option); } $numPages = ceil($numOptions / ISC_PRODUCTS_PER_PAGE); $filterQuery = ''; if (!empty($filterOptions)) { $GLOBALS['FilterOptionsQuery'] = http_build_query($filterOptions); $queryOptions = array('filterOption' => $filterOptions); $filterQuery = "&" . http_build_query($queryOptions); } // Add the "(Page x of n)" label if($numOptions > ISC_PRODUCTS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numOptions, ISC_PRODUCTS_PER_PAGE, $page, "remote.php?w=getVariationCombinations&productId=" . $ProductId . "&productHash=" . $ProductHash . "&v=" . $VariationId . "&inv=" . (int)$ShowInventoryFields . $sortURL . $filterQuery); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = preg_replace('# \|$#',"", $GLOBALS['Nav']); //$GLOBALS['SortField'] = $sortField; //$GLOBALS['SortOrder'] = $sortOrder; // Get the variation combinations as text, such as #red#small#modern $GLOBALS["variation_data"] = array(); $GLOBALS['VariationRows'] = ""; $this->GetCombinationText('', $newOptions, 0, ISC_PRODUCTS_PER_PAGE, $start); $GLOBALS["variation_combinations"] = $GLOBALS["variation_data"]; // Get the variation combinations ID's, such as #145#185#195 $GLOBALS["variation_data"] = array(); $this->GetCombinationText('', $newOptionIds, 0, ISC_PRODUCTS_PER_PAGE, $start); $GLOBALS["variation_combination_ids"] = $GLOBALS["variation_data"]; // Setup a counter $count = 0; // Loop through the variation combination ID's and output them as hidden fields foreach($GLOBALS["variation_combination_ids"] as $k => $combo) { $GLOBALS['VariationRows'] .= sprintf(" <input name='options[$count][variationcombination]' type='hidden' value='%s' /></td>", $combo); ++$count; } // Reset the counter $count = 0; // Now loop through all of the options and output the combinations if(!empty($GLOBALS["variation_combinations"]) && $GLOBALS["variation_combinations"][0] != "") { foreach($GLOBALS["variation_combinations"] as $k => $combo) { // Set the default values $enabled = 'checked="checked"'; $sku = ''; $price = ''; $weight = ''; $add_p_checked = ''; $add_w_checked = ''; $show_price = 'none'; $show_weight = 'none'; $fixed_p_checked = ''; $fixed_w_checked = ''; $subtract_p_checked = ''; $subtract_w_checked = ''; if (isId($ProductId) || $ProductHash !== '') { // Get the variation combination's existing details from the product_variation_combinations table $combo_ids = preg_replace("/^#/", "", $GLOBALS["variation_combination_ids"][$count]); //$combo_ids = str_replace("#", ",", $combo_ids); $optionIds = explode("#", $combo_ids); $optionWhere = ""; foreach ($optionIds as $optionId) { $optionWhere .= " AND FIND_IN_SET(" . $optionId . ", vcoptionids)"; } $query = "SELECT * FROM [|PREFIX|]product_variation_combinations WHERE "; if (empty($ProductHash)) { $query .= "vcproductid=" . (int)$ProductId; } else { $query .= "vcproducthash='" . $GLOBALS['ISC_CLASS_DB']->Quote($ProductHash) . "'"; } $query .= $optionWhere; $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); $row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result); // Are there any option details? if($row !== false) { if($row['vcenabled'] == 1) { $enabled = 'checked="checked"'; } else { $enabled = ""; } $sku = $row['vcsku']; $price = ''; $show_price = 'none'; $add_p_checked = ''; $fixed_p_checked = ''; $subtract_p_checked = ''; switch($row['vcpricediff']) { case "add": { $add_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; } case "subtract": { $subtract_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; } case "fixed": { $fixed_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; } } $add_w_checked = ''; $subtract_w_checked = ''; $fixed_w_checked = ''; $show_weight = 'none'; $weight = ''; switch($row['vcweightdiff']) { case "add": { $add_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; } case "subtract": { $subtract_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; } case "fixed": { $fixed_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; } } } } $GLOBALS['VariationRows'] .= sprintf("<input type='hidden' name='options[$count][id]' value='%d' />", $row['combinationid']); $GLOBALS['VariationRows'] .= "<tr class=\"GridRow CombinationRow\">"; $GLOBALS['VariationRows'] .= sprintf(" <td style='padding-left:4px'><input name='options[$count][enabled]' type='checkbox' %s value='ON' /></td>", $enabled); $combo = preg_replace("/^#/", "", $combo); $combos = explode("#", $combo); foreach($combos as $c) { $GLOBALS['VariationRows'] .= sprintf(" <td>%s</td>", isc_html_escape($c)); } $GLOBALS['VariationRows'] .= sprintf(" <td><input name='options[$count][sku]' type='text' class='Field50' value='%s' /></td>", isc_html_escape($sku)); $GLOBALS['VariationRows'] .= sprintf(" <td> <select class='PriceDrop' name='options[$count][pricediff]' onchange=\"if(this.selectedIndex>0) { $(this).parent().find('span').show(); $(this).parent().find('span input').focus(); $(this).parent().find('span input').select(); } else { $(this).parent().find('span').hide(); } \"> <option value=''>%s</option> <option %s value='add'>%s</option> <option %s value='subtract'>%s</option> <option %s value='fixed'>%s</option> </select> <span style='display:%s'> %s <input name='options[$count][price]' type='text' class='Field50 PriceBox' style='width:40px' value='%s' /> %s </span> </td>", GetLang("NoChange"), $add_p_checked, GetLang("VariationAdd"), $subtract_p_checked, GetLang("VariationSubtract"), $fixed_p_checked, GetLang("VariationFixed"), $show_price, $GLOBALS['CurrencyTokenLeft'], $price, $GLOBALS['CurrencyTokenRight']); $GLOBALS['VariationRows'] .= sprintf(" <td> <select class='WeightDrop' name='options[$count][weightdiff]' onchange=\"if(this.selectedIndex>0) { $(this).parent().find('span').show(); $(this).parent().find('span input').focus(); $(this).parent().find('span input').select(); } else { $(this).parent().find('span').hide(); } \"> <option value=''>%s</option> <option %s value='add'>%s</option> <option %s value='subtract'>%s</option> <option %s value='fixed'>%s</option> </select> <span style='display:%s'> <input name='options[$count][weight]' type='text' class='Field50 WeightBox' style='width:40px' value='%s' /> %s </span> </td>", GetLang("NoChange"), $add_w_checked, GetLang("VariationAdd"), $subtract_w_checked, GetLang("VariationSubtract"), $fixed_w_checked, GetLang("VariationFixed"), $show_weight, $weight, GetConfig('WeightMeasurement')); $GLOBALS['VariationRows'] .= " <td><input name='options[$count][image]' type='file' class='Field150 OptionImage' />"; if($row['vcimage'] != "") { $GLOBALS['VariationRows'] .= sprintf(" <br /><input name='options[$count][delimage]' id='variation_delete_image_$count' type='checkbox' value='ON' /> <label for='variation_delete_image_$count'>%s</label> %s <a href='%s' target='_blank'>%s</a>", GetLang("DeleteVariationImage"), GetLang("Currently"), sprintf("%s/%s/%s", $GLOBALS['ShopPath'], GetConfig('ImageDirectory'), $row['vcimage']), $row['vcimage']); } $GLOBALS['VariationRows'] .= " </td>"; // Is inventory tracking enabled for variations? if($ShowInventoryFields) { $InventoryFieldsHide = "display: auto;"; } else { $InventoryFieldsHide = "display: none;"; } $GLOBALS['VariationRows'] .= sprintf(" <td class=\"VariationStockColumn\" style=\"".$InventoryFieldsHide."\"><input name='options[$count][currentstock]' type='text' class='Field50 StockLevel' value='%d' /></td>", $row['vcstock']); $GLOBALS['VariationRows'] .= sprintf(" <td class=\"VariationStockColumn\" style=\"".$InventoryFieldsHide."\"><input name='options[$count][lowstock]' type='text' class='Field50 LowStockLevel' value='%d' /></td>", $row['vclowstock']); $GLOBALS['VariationRows'] .= "</tr>"; $count++; } } $GLOBALS['ColSpan'] = count($newOptions) + 5; if($ShowInventoryFields) { $GLOBALS['ColSpan'] += 2; } else { $GLOBALS['HideInv'] = "none"; } $GLOBALS['VariationId'] = $VariationId; $GLOBALS['ShowInv'] = (int)$ShowInventoryFields; if (!empty($ProductHash)) { $GLOBALS['VProductId'] = ''; $GLOBALS['VProductHash'] = $ProductHash; } else { $GLOBALS['VProductId'] = $ProductId; $GLOBALS['VProductHash'] = ''; } if (!isset($_COOKIE['showVariationFilter']) || $_COOKIE['showVariationFilter'] == 'true') { $GLOBALS['ShowFilterChecked'] = 'checked="checked"'; } else { $GLOBALS['ShowVariationFilter'] = 'none'; } return $this->template->render('products.variation.combination.tpl'); }
/** * Setup product dimension details. */ private function SetProductDimensions() { if ($this->productClass->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) { // It's a physical product $GLOBALS['ProductWeight'] = $this->productClass->GetWeight(); } else { // It's a digital product $GLOBALS['HideWeight'] = "none"; } $product = $this->productClass->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'; } }
public function GetWeight($includemeasure=true) { return FormatWeight($this->_prodweight, $includemeasure); }
public function weightFilter($row, $args) { $weight = $row['prodweight']; if(!empty($args['format'])) return FormatWeight($weight, false); else return $row['prodweight']; }
/** * Build the HTML form item for each module variable. * * @param string The identifier for this */ protected function _BuildFormItem($id, &$var, $useTabs = true) { // What type of variable is it? $item = ""; if (!isset($GLOBALS['ValidationJavascript'])) { $GLOBALS['ValidationJavascript'] = ''; } if ($useTabs == true) { $showTab = "ShowTab(" . $this->tabId . ");"; } else { $showTab = ''; } switch ($var['type']) { case "blank": $item = ""; $GLOBALS['Required'] = ""; break; case "label": $item = $var['label']; $GLOBALS['Required'] = " "; break; case "custom": $item = ''; if (method_exists($this, $var['callback'])) { $item = call_user_func(array($this, $var['callback'])); } if (isset($var['javascript'])) { $GLOBALS['ValidationJavascript'] .= $var['javascript']; } break; case 'text': case "textbox": case "password": $default = ""; if (isset($var['default']) && $var['default'] != "") { $default = $var['default']; } if ($this->GetValue($id)) { $default = $this->GetValue($id); } if (isset($var['format']) && $default !== '') { switch ($var['format']) { case 'price': $default = FormatPrice($default, false, false); break; case 'weight': case 'dimension': $default = FormatWeight($default, false); break; } } $default = isc_html_escape($default); if (isset($var['size'])) { $txt_size = $var['size']; $txtClass = "Field"; } else { $txt_size = ""; $txtClass = "Field250"; } if (isset($var['prefix'])) { $txtPrefix = $var['prefix'] . " "; } else { $txtPrefix = ""; } if (isset($var['suffix'])) { $txtSuffix = ' ' . $var['suffix']; } else { $txtSuffix = ''; } if ($var['type'] == 'password') { $type = 'password'; } else { $type = 'text'; } $readOnly = ''; if (isset($var['readonly']) && $var['readonly'] == true) { $readOnly = 'readonly="readonly"'; } $txtName = $this->GetId() . "[" . $id . "]"; $txtId = $this->GetId() . "_" . $id; $item = $txtPrefix . "<input type=\"" . $type . "\" class=\"" . $txtClass . "\" name=\"" . $txtName . "\" id=\"" . $txtId . "\" value=\"" . isc_html_escape($default) . "\" size=\"" . $txt_size . "\" " . $readOnly . " />" . $txtSuffix; if (isset($var['required']) && $var['required']) { $GLOBALS['Required'] = "<span class=\"Required\">*</span>"; } else { $GLOBALS['Required'] = " "; } if (isset($var['required']) && $var['required']) { $message = addslashes(sprintf(GetLang('EnterValueForField'), $var['name'])); $GLOBALS['ValidationJavascript'] .= "\n\t\t\t\t\t\tif(!\$('#" . $txtId . "').val()) {\n\t\t\t\t\t\t\t" . $showTab . "\n\t\t\t\t\t\t\talert('" . $message . "');\n\t\t\t\t\t\t\t\$('#" . $txtId . "').focus();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t"; } break; case "textarea": $default = ""; if ($var['default'] != "") { $default = $var['default']; } if ($this->GetValue($id)) { $default = $this->GetValue($id); } if (isset($var['format']) && $default !== '') { switch ($var['format']) { case 'price': $default = FormatPrice($default, false, false); break; case 'weight': case 'dimension': $default = FormatWeight($default, false); break; } } $default = isc_html_escape($default); if (isset($var['rows'])) { $txtRows = $var['rows']; } else { $txtRows = 5; } if (isset($var['prefix'])) { $txtPrefix = $var['prefix'] . " "; } else { $txtPrefix = ""; } $txtName = sprintf("%s[%s]", $this->GetId(), $id); $txtId = sprintf("%s_%s", $this->GetId(), $id); $txtClass = "Field250"; $item = sprintf("%s<textarea class='%s' name='%s' id='%s' rows='%d'>%s</textarea>", $txtPrefix, $txtClass, $txtName, $txtId, $txtRows, $default); if ($var['required']) { $GLOBALS['Required'] = "<span class=\"Required\">*</span>"; } else { $GLOBALS['Required'] = " "; } if ($var['required']) { $message = addslashes(sprintf(GetLang('EnterValueForField'), $var['name'])); $GLOBALS['ValidationJavascript'] .= "\n\t\t\t\t\t\tif(!\$('#" . $txtId . "').val()) {\n\t\t\t\t\t\t\t" . $showTab . "\n\t\t\t\t\t\t\talert('" . $message . "');\n\t\t\t\t\t\t\t\$('#" . $txtId . "').focus();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t"; } break; case "dropdown": $additionalClass = ''; if (isset($var['multiselect']) && $var['multiselect']) { if (isset($var['multiselectheight'])) { $multiSelect = sprintf("multiple size='%s'", $var['multiselectheight']); } else { $multiSelect = "multiple size='7'"; } $additionalClass = "ISSelectReplacement"; } else { $multiSelect = ""; } if ($multiSelect) { $selName = sprintf("%s[%s][]", $this->GetId(), $id); } else { $selName = sprintf("%s[%s]", $this->GetId(), $id); } $selId = sprintf("%s_%s", $this->GetId(), $id); $item = sprintf("<select %s class='Field250 %s' name='%s' id='%s'>", $multiSelect, $additionalClass, $selName, $selId); if ($var['required']) { $GLOBALS['Required'] = "<span class=\"Required\">*</span>"; } else { $GLOBALS['Required'] = " "; } $default = ''; if (isset($var['default'])) { $default = $var['default']; } if ($this->GetValue($id)) { $default = $this->GetValue($id); } if (!is_array($default)) { $default = array($default); } // Loop through each of the options foreach ($var['options'] as $k => $v) { $sel = ''; if (in_array($v, $default)) { $sel = 'selected="selected"'; } $item .= "<option " . $sel . " value='" . $v . "'>" . $k . "</option>"; } $item .= "</select>"; if ($var['required']) { $message = addslashes(sprintf(GetLang('ChooseOptionForField'), $var['name'])); $GLOBALS['ValidationJavascript'] .= "\n\t\t\t\t\t\tif(\$('#" . $selId . "').val() == -1) {\n\t\t\t\t\t\t\t" . $showTab . "\n\t\t\t\t\t\t\talert('" . $message . "');\n\t\t\t\t\t\t\t\$('#" . $selId . "').focus();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t"; } break; } return $item; }