public function CopyProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost = false, $OriginalProductID = 0) { if ($MsgDesc != "") { $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus); } // Show the form to edit a product if (isset($_REQUEST['productId']) && isId($_REQUEST['productId'])) { $OriginalProductID = $_REQUEST['productId']; } $prodId = $OriginalProductID; $z = 0; $arrData = array(); $arrImages = array(); $arrCustomFields = array(); if (GetConfig('CurrencyLocation') == 'right') { $GLOBALS['CurrencyTokenLeft'] = ''; $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken'); } else { $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken'); $GLOBALS['CurrencyTokenRight'] = ''; } $GLOBALS['ServerFiles'] = $this->_GetImportFilesOptions(); $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY'); // Make sure the product exists if (ProductExists($prodId)) { if ($PreservePost == true) { $this->_GetProductData(0, $arrData); $this->_GetCustomFieldData(0, $arrCustomFields); $GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout(0, true); // Restore the hash $GLOBALS['ProductHash'] = $arrData['prodhash']; } else { $this->_GetProductData($prodId, $arrData); $this->_GetCustomFieldData($prodId, $arrCustomFields); $GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout($prodId, true); // Generate the hash $GLOBALS['ProductHash'] = md5(time() . uniqid(rand(), true)); // We'll need to duplicate (copy) the thumbnail, images and download files here $this->_CopyProductImages($prodId, 0, $GLOBALS['ProductHash']); $this->_CopyDownloads($prodId, 0, $GLOBALS['ProductHash']); $arrData['prodname'] = GetLang('CopyOf') . $arrData['prodname']; } // Does this user have permission to edit this product? if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['prodvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewProducts'); } $arrImages = $this->_GetImageData(0, $GLOBALS['ProductHash']); if (isset($_POST['currentTab'])) { $GLOBALS['CurrentTab'] = (int) $_POST['currentTab']; } else { $GLOBALS['CurrentTab'] = 0; } $GLOBALS['FormAction'] = 'copyProduct2'; $GLOBALS['Title'] = GetLang('CopyProductTitle'); $GLOBALS['Intro'] = GetLang('CopyProductIntro'); $GLOBALS["ProdType_" . $arrData['prodtype']] = 'checked="checked"'; $GLOBALS['ProdType'] = $arrData['prodtype'] - 1; $GLOBALS['ProdCode'] = isc_html_escape($arrData['prodcode']); $GLOBALS['ProdName'] = isc_html_escape($arrData['prodname']); $GLOBALS['OriginalProductId'] = $OriginalProductID; $visibleCategories = array(); if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if ($vendorData['vendoraccesscats']) { $visibleCategories = explode(',', $vendorData['vendoraccesscats']); } } // $GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions($arrData['prodcats'], "<option %s value='%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories); $GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptionsProduct($arrData['prodcats'], "<option %s value='%d' id='category_old%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories); $GLOBALS['RelatedCategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions(0, "<option %s value='%d'>%s</option>", "selected='selected'", "- ", false); //blessen $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '60%', 'height' => '350px', 'value' => $arrData['proddesc']); $wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodmfg']); $wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodwarranty']); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['WYSIWYG1'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions1); $GLOBALS['WYSIWYG2'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions2); $GLOBALS['ProdSearchKeywords'] = isc_html_escape($arrData['prodsearchkeywords']); $GLOBALS['ProdAvailability'] = isc_html_escape($arrData['prodavailability']); $GLOBALS['ProdPrice'] = number_format($arrData['prodprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); if (CFloat($arrData['prodcostprice']) > 0) { $GLOBALS['ProdCostPrice'] = number_format($arrData['prodcostprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodretailprice']) > 0) { $GLOBALS['ProdRetailPrice'] = number_format($arrData['prodretailprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodsaleprice']) > 0) { $GLOBALS['ProdSalePrice'] = number_format($arrData['prodsaleprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } $GLOBALS['ProdSortOrder'] = $arrData['prodsortorder']; if ($arrData['prodvisible'] == 1) { $GLOBALS['ProdVisible'] = "checked"; } if ($arrData['prodfeatured'] == 1) { $GLOBALS['ProdFeatured'] = "checked"; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { $GLOBALS['HideStoreFeatured'] = 'display: none'; } else { if (!gzte11(ISC_HUGEPRINT) || !$arrData['prodvendorid']) { $GLOBALS['HideVendorFeatured'] = 'display: none'; } } if ($arrData['prodvendorfeatured'] == 1) { $GLOBALS['ProdVendorFeatured'] = 'checked="checked"'; } if ($arrData['prodistaxable'] == 1) { $GLOBALS['ProdIsTaxable'] = 'checked'; } if ($arrData['prodallowpurchases'] == 1) { $GLOBALS['ProdAllowPurchases'] = 'checked="checked"'; } else { if ($arrData['prodhideprice'] == 1) { $GLOBALS['ProdHidePrice'] = 'checked="checked"'; } $GLOBALS['ProdCallForPricingLabel'] = isc_html_escape($arrData['prodcallforpricinglabel']); } $GLOBALS['MoreImages'] = "MoreImages();"; for ($i = 1; $i <= $arrImages['numImages']; $i++) { $image = sprintf("../%s/%s", GetConfig('ImageDirectory'), $arrImages["image" . $i]); if ($i == 1) { $GLOBALS["ImageMessage" . $i] = sprintf(GetLang('EditImageDesc'), $image, $arrImages["image" . $i]); } else { $GLOBALS["ImageMessage" . $i] = sprintf(GetLang('EditImageDesc2'), $arrImages["id" . $i], $arrImages["id" . $i], $arrImages["id" . $i], $image, $arrImages["image" . $i], $arrImages["id" . $i]); } } if (isset($arrImages['thumb'])) { $thumb = sprintf("../%s/%s", GetConfig('ImageDirectory'), $arrImages['thumb']); $GLOBALS['ThumbMessage'] = sprintf(GetLang('EditImageDesc'), $thumb, $arrImages['thumb']); } //blessen //$GLOBALS['ProdWarranty'] = $arrData['prodwarranty']; //$GLOBALS['prod_instruction'] = $arrData['prod_instruction']; //$GLOBALS['prod_article'] = $arrData['prod_article']; $GLOBALS['ProdWeight'] = number_format($arrData['prodweight'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); if (CFloat($arrData['prodwidth']) > 0) { $GLOBALS['ProdWidth'] = number_format($arrData['prodwidth'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodheight']) > 0) { $GLOBALS['ProdHeight'] = number_format($arrData['prodheight'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['proddepth']) > 0) { $GLOBALS['ProdDepth'] = number_format($arrData['proddepth'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodfixedshippingcost']) > 0) { $GLOBALS['ProdFixedShippingCost'] = number_format($arrData['prodfixedshippingcost'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if ($arrData['prodfreeshipping'] == 1) { $GLOBALS['FreeShipping'] = 'checked="checked"'; } if ($arrData['prodrelatedproducts'] == -1) { $GLOBALS['IsProdRelatedAuto'] = 'checked="checked"'; } else { if (isset($arrData['prodrelated'])) { $GLOBALS['RelatedProductOptions'] = ""; foreach ($arrData['prodrelated'] as $r) { $GLOBALS['RelatedProductOptions'] .= sprintf("<option value='%d'>%s</option>", (int) $r[0], isc_html_escape($r[1])); } } } $GLOBALS['ProdTags'] = $arrData['prodtags']; $GLOBALS['CurrentStockLevel'] = $arrData['prodcurrentinv']; $GLOBALS['LowStockLevel'] = $arrData['prodlowinv']; $GLOBALS["InvTrack_" . $arrData['prodinvtrack']] = 'checked="checked"'; $GLOBALS['WrappingOptions'] = $this->BuildGiftWrappingSelect(explode(',', $arrData['prodwrapoptions'])); $GLOBALS['HideGiftWrappingOptions'] = 'display: none'; if ($arrData['prodwrapoptions'] == 0) { $GLOBALS['WrappingOptionsDefaultChecked'] = 'checked="checked"'; } else { if ($arrData['prodwrapoptions'] == -1) { $GLOBALS['WrappingOptionsNoneChecked'] = 'checked="checked"'; } else { $GLOBALS['HideGiftWrappingOptions'] = ''; $GLOBALS['WrappingOptionsCustomChecked'] = 'checked="checked"'; } } if ($arrData['prodinvtrack'] == 1) { $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(true);"; } else { $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(false);"; } if ($arrData['prodoptionsrequired'] == 1) { $GLOBALS['OptionsRequired'] = 'checked="checked"'; } if ($arrData['prodtype'] == 1) { $GLOBALS['HideProductInventoryOptions'] = "none"; } $GLOBALS['EnterOptionPrice'] = sprintf(GetLang('EnterOptionPrice'), GetConfig('CurrencyToken'), GetConfig('CurrencyToken')); $GLOBALS['EnterOptionWeight'] = sprintf(GetLang('EnterOptionWeight'), GetConfig('WeightMeasurement')); $GLOBALS['HideCustomFieldLink'] = "none"; if (GetConfig('PricesIncludeTax')) { $GLOBALS['PriceMsg'] = GetLang('IncTax'); } else { $GLOBALS['PriceMsg'] = GetLang('ExTax'); } $GLOBALS['CustomFields'] = ''; $GLOBALS['CustomFieldKey'] = 0; if (!empty($arrCustomFields)) { foreach ($arrCustomFields as $f) { $GLOBALS['CustomFieldName'] = isc_html_escape($f['name']); $GLOBALS['CustomFieldValue'] = isc_html_escape($f['value']); $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel($GLOBALS['CustomFieldKey'] + 1, GetLang('CustomField')); if (!$GLOBALS['CustomFieldKey']) { $GLOBALS['HideCustomFieldDelete'] = 'none'; } else { $GLOBALS['HideCustomFieldDelete'] = ''; } $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CustomFields'); $GLOBALS['CustomFieldKey']++; } } // Add one more custom field $GLOBALS['CustomFieldName'] = ''; $GLOBALS['CustomFieldValue'] = ''; $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel($GLOBALS['CustomFieldKey'] + 1, GetLang('CustomField')); if (!$GLOBALS['CustomFieldKey']) { $GLOBALS['HideCustomFieldDelete'] = 'none'; } else { $GLOBALS['HideCustomFieldDelete'] = ''; } $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CustomFields'); if ($this->HasGD()) { $GLOBALS['ShowGDThumb'] = ""; $GLOBALS['ShowNoGDThumb'] = "none"; } else { $GLOBALS['ShowGDThumb'] = "none"; $GLOBALS['ShowNoGDThumb'] = ""; } // Get a list of any downloads associated with this product $GLOBALS['DownloadsGrid'] = $this->GetDownloadsGrid(0, $GLOBALS['ProductHash']); $GLOBALS['ISC_LANG']['MaxUploadSize'] = sprintf(GetLang('MaxUploadSize'), GetMaxUploadSize()); if ($GLOBALS['DownloadsGrid'] == '') { $GLOBALS['DisplayDownloaadGrid'] = "none"; } // Get the brands as select options $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS'); $GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_ADMIN_BRANDS']->GetBrandsAsOptions($arrData['prodbrandid']); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother'); // Get a list of all layout files $layoutFile = 'product.html'; if ($arrData['prodlayoutfile'] != '') { $layoutFile = $arrData['prodlayoutfile']; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("product.html", $layoutFile); $GLOBALS['ProdPageTitle'] = isc_html_escape($arrData['prodpagetitle']); $GLOBALS['ProdMetaKeywords'] = isc_html_escape($arrData['prodmetakeywords']); $GLOBALS['ProdMetaDesc'] = isc_html_escape($arrData['prodmetadesc']); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother'); if (!gzte11(ISC_MEDIUMPRINT)) { $GLOBALS['HideInventoryOptions'] = "none"; } else { $GLOBALS['HideInventoryOptions'] = ''; } // Does this product have a variation assigned to it? $GLOBALS['ProductVariationExisting'] = $arrData['prodvariationid']; if ($arrData['prodvariationid'] > 0) { $GLOBALS['IsYesVariation'] = 'checked="checked"'; } else { $GLOBALS['IsNoVariation'] = 'checked="checked"'; $GLOBALS['HideVariationList'] = "none"; $GLOBALS['HideVariationCombinationList'] = "none"; } // If there are no variations then disable the option to choose one $numVariations = 0; $GLOBALS['VariationOptions'] = $this->GetVariationsAsOptions($numVariations, $arrData['prodvariationid']); if ($numVariations == 0) { $GLOBALS['VariationDisabled'] = "DISABLED"; $GLOBALS['VariationColor'] = "#CACACA"; $GLOBALS['IsNoVariation'] = 'checked="checked"'; $GLOBALS['IsYesVariation'] = ""; $GLOBALS['HideVariationCombinationList'] = "none"; } else { // Load the variation combinations if ($arrData['prodinvtrack'] == 2) { $show_inv_fields = true; } else { $show_inv_fields = false; } /** * We'll need to duplicate the variation combinations here if we are NOT preserving the post */ if (!$PreservePost) { $this->_CopyVariationData($arrData['productid'], 0, $GLOBALS['ProductHash']); } $GLOBALS['VariationCombinationList'] = $this->_LoadVariationCombinationsTable($arrData['prodvariationid'], $show_inv_fields, 0, $GLOBALS['ProductHash']); } if (!gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorOption'] = 'display: none'; } else { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if (isset($vendorData['vendorid'])) { $GLOBALS['HideVendorSelect'] = 'display: none'; $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']); } else { $GLOBALS['HideVendorLabel'] = 'display: none'; $GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['prodvendorid']); } } // Display the discount rules if ($PreservePost == true) { $GLOBALS['DiscountRules'] = $this->GetDiscountRules($prodId); } else { $GLOBALS['DiscountRules'] = $this->GetDiscountRules(0); } // Hide if we are not enabled if (!GetConfig('BulkDiscountEnabled')) { $GLOBALS['HideDiscountRulesWarningBox'] = ''; $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesNotEnabledWarning'); $GLOBALS['DiscountRulesWithWarning'] = 'none'; // Also hide it if this product has variations } else { if (isset($arrData['prodvariationid']) && isId($arrData['prodvariationid'])) { $GLOBALS['HideDiscountRulesWarningBox'] = ''; $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesVariationWarning'); $GLOBALS['DiscountRulesWithWarning'] = 'none'; } else { $GLOBALS['HideDiscountRulesWarningBox'] = 'none'; $GLOBALS['DiscountRulesWithWarning'] = ''; } } $GLOBALS['DiscountRulesEnabled'] = (int) GetConfig('BulkDiscountEnabled'); $GLOBALS['EventDateFieldName'] = $arrData['prodeventdatefieldname']; if ($GLOBALS['EventDateFieldName'] == null) { $GLOBALS['EventDateFieldName'] = GetLang('EventDateDefault'); } if ($arrData['prodeventdaterequired'] == 1) { $GLOBALS['EventDateRequired'] = 'checked="checked"'; $from_stamp = $arrData['prodeventdatelimitedstartdate']; $to_stamp = $arrData['prodeventdatelimitedenddate']; } else { $from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y")); $to_stamp = isc_gmmktime(0, 0, 0, isc_date("m") + 1, isc_date("d"), isc_date("Y")); } if ($arrData['prodeventdatelimited'] == 1) { $GLOBALS['LimitDates'] = 'checked="checked"'; } $GLOBALS['LimitDateOption1'] = ''; $GLOBALS['LimitDateOption2'] = ''; $GLOBALS['LimitDateOption3'] = ''; switch ($arrData['prodeventdatelimitedtype']) { case 1: $GLOBALS['LimitDateOption1'] = 'selected="selected"'; break; case 2: $GLOBALS['LimitDateOption2'] = 'selected="selected"'; break; case 3: $GLOBALS['LimitDateOption3'] = 'selected="selected"'; break; } // Set the global variables for the select boxes $from_day = isc_date("d", $from_stamp); $from_month = isc_date("m", $from_stamp); $from_year = isc_date("Y", $from_stamp); $to_day = isc_date("d", $to_stamp); $to_month = isc_date("m", $to_stamp); $to_year = isc_date("Y", $to_stamp); $GLOBALS['OverviewFromDays'] = $this->_GetDayOptions($from_day); $GLOBALS['OverviewFromMonths'] = $this->_GetMonthOptions($from_month); $GLOBALS['OverviewFromYears'] = $this->_GetYearOptions($from_year); $GLOBALS['OverviewToDays'] = $this->_GetDayOptions($to_day); $GLOBALS['OverviewToMonths'] = $this->_GetMonthOptions($to_month); $GLOBALS['OverviewToYears'] = $this->_GetYearOptions($to_year); if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Create_Category)) { $GLOBALS['HideCategoryCreation'] = 'display: none'; } $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother'); $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("product.form"); $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(); } else { // The product doesn't exist if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { $this->ManageProducts(GetLang('ProductDoesntExist'), MSG_ERROR); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
private function EditCategory() { $GLOBALS['Message'] = GetFlashMessageBoxes(); if (isset($_GET['catId'])) { $catId = (int) $_GET['catId']; include_once ISC_BASE_PATH . '/lib/api/category.api.php'; $category = new API_CATEGORY(); $category->load($catId); //wirror_20100804: remove the cookie CustomContentId, and fetch current CustomContentId from table category if ($category->customcontentid != 0) { $contentId = isc_html_escape($category->customcontentid); } else { if (isset($_COOKIE['CustomContentId']) && is_numeric($_COOKIE['CustomContentId'])) { $contentId = $_COOKIE['CustomContentId']; } else { $customItem = array('contenttype' => 1, 'description' => "custom products content for category#{$catId}"); $contentId = GetClass('ISC_ADMIN_CUSTOMCONTENTS')->createCustomContens($customItem); } } setcookie("CustomContentId", $contentId, time() + 3600); //wirror_20100806: show the custom content options $GLOBALS['ContentOptions'] = $this->_GetContentTypeOptions($category->pagecontenttype); $GLOBALS['CustomPageAction'] = "listCateCustomcontents&customContentId={$contentId}&catId={$catId}"; $GLOBALS['CategoryName'] = isc_html_escape($category->catname); $GLOBALS['CategoryOptions'] = $this->GetCategoryParentOptions($catId, array($category->catparentid)); $GLOBALS['CategorySort'] = isc_html_escape($category->catsort); $GLOBALS['CategoryPageTitle'] = isc_html_escape($category->catpagetitle); $GLOBALS['CategoryMetaKeywords'] = isc_html_escape($category->catmetakeywords); $GLOBALS['CategoryMetaDesc'] = isc_html_escape($category->catmetadesc); $GLOBALS['CatDepartment'] = $this->getDepartment($category->catdeptid); $GLOBALS['AltKeyword'] = isc_html_escape($category->cataltkeyword); $GLOBALS['catcombine'] = isc_html_escape($category->catcombine); $GLOBALS['CatDeptid'] = isc_html_escape($category->catdeptid); $GLOBALS['StartPrice'] = isc_html_escape($category->StartPrice); $GLOBALS['EndPrice'] = isc_html_escape($category->EndPrice); $GLOBALS['CatImageAlt'] = isc_html_escape($category->catimagealt); if (strtolower($category->displayproducts) == 'on') { $GLOBALS['DisplayProducts'] = 'checked="checked"'; } $GLOBALS['CategorySelect'] = '<input type="hidden" name="catparentid" id="catparentid" value="' . $category->catparentid . '"> <select size="5" name="catparent_id" id="catparent_id" class="Field750" style="height:115" onchange="HandleRootCategory();SelectDept();" disabled="disabled">'; # Added because when we disable the category list, id cant be get while saving, so hidden field is added and the id is changed to catparentid. -- Baskaran $temp = ''; $pnamearray = array('Category Name', 'Sub Category Name', 'Brand Name', 'Series Name', 'Part Number', 'Product Code', 'Product color', 'Product Material', 'Product Style'); $savedarray = explode(",", $category->Productname); foreach ($pnamearray as $key => $value) { if (in_array($key, $savedarray)) { $temp .= "<option value='" . $key . "' selected='selected' >" . $value . "</option>"; } else { $temp .= "<option value='" . $key . "' >" . $value . "</option>"; } } $GLOBALS['Productname'] = $temp; $congocatname = ''; if ($category->catparentid == 0) { $space1 = str_replace(" ", "", isc_html_escape($category->catname)); $hypen1 = str_replace("-", "", $space1); $amp1 = str_replace("&", "", $hypen1); $slash1 = str_replace("/", "", $amp1); $congocatname = str_replace(",", "", $slash1); } else { $query = "SELECT * from [|PREFIX|]categories where categoryid = {$category->catparentid}"; $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); $row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result); $space2 = str_replace(" ", "", $row['catname']); $hypen2 = str_replace("-", "", $space2); $amp2 = str_replace("&", "", $hypen2); $slash2 = str_replace("/", "", $amp2); $congocatname = str_replace(",", "", $slash2); } $_SESSION['congocatname'] = $congocatname; $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '750px', 'height' => '500px', 'value' => $category->catdesc); $wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '300px', 'value' => $category->categoryfooter); $wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '300px', 'value' => $category->featurepoints); $wysiwygOptions3 = array('id' => 'wysiwyg3', 'width' => '60%', 'height' => '300px', 'value' => $category->divdesc); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['WYSIWYG1'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions1); $GLOBALS['WYSIWYG2'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions2); $GLOBALS['WYSIWYG3'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions3); $GLOBALS['ControlScript'] = $category->controlscript; $GLOBALS['TrackingScript'] = $category->trackingscript; $GLOBALS['FormAction'] = "saveUpdatedCategory"; $GLOBALS['CatTitle'] = GetLang('EditCatTitle'); $GLOBALS['CatIntro'] = GetLang('EditCatIntro'); $GLOBALS['CancelMessage'] = GetLang('CancelEditCategory'); $GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='categoryId' value='%d'>", $catId); #wirror_20100805: hide the custom content id $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='customContentId' value='%d'>", $contentId); if ($category->catparentid == '0') { //$GLOBALS['DisableFileUpload'] = 'disabled="disabled"'; $GLOBALS['ShowFileUploadMessage'] = ''; $GLOBALS['ShowHidecatCombine'] = 'none'; $GLOBALS['disabledept'] = ''; } else { //$GLOBALS['DisableFileUpload'] = ''; $GLOBALS['ShowFileUploadMessage'] = 'none'; $GLOBALS['ShowHidecatCombine'] = ''; $GLOBALS['disabledept'] = 'disabled="disabled"'; } // Get a list of all layout files $layoutFile = 'category.html'; if ($category->catlayoutfile != '') { $layoutFile = $category->catlayoutfile; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("category.html", $layoutFile); $GLOBALS["CatImageMessage"] = ''; if ($category->catimagefile !== '') { $image = '../' . 'category_images' . '/' . $category->catimagefile; $GLOBALS["CatImageMessage"] = sprintf(GetLang('CatImageDesc'), $image, $category->catimagefile); } $GLOBALS["CatHoverImageMessage"] = ''; if ($category->cathoverimagefile !== '') { $image = '../' . 'category_images' . '/' . $category->cathoverimagefile; $GLOBALS["CatHoverImageMessage"] = sprintf(GetLang('CatHoverImageDesc'), $image, $category->cathoverimagefile); } $SelectedQualifiers = $this->GetSelectedQualifiers($catId); $GLOBALS['QualifierOptions'] = $this->GetQualifierOptions($SelectedQualifiers, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "", false); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing'); $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("category.form"); $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(); } else { if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Categories)) { $this->ManageCategories(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
private function EditPageStep1($MsgDesc = "", $MsgStatus = "", $IsError = false) { $GLOBALS['Message'] = ''; if($MsgDesc != "") { $GLOBALS['Message'] .= MessageBox($MsgDesc, $MsgStatus); } $GLOBALS['Message'] .= GetFlashMessageBoxes(); $pageId = (int)$_REQUEST['pageId']; $arrData = array(); if(PageExists($pageId)) { // Was the page submitted with a duplicate page name? if($IsError) { $this->_GetPageData(0, $arrData); } else { $this->_GetPageData($pageId, $arrData); } $GLOBALS['CurrentTab'] = '0'; if(isset($_REQUEST['currentTab'])) { $GLOBALS['CurrentTab'] = $_REQUEST['currentTab']; } // Does this user have permission to edit this product? if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['pagevendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewPages'); } $GLOBALS['PageId'] = (int) $pageId; $GLOBALS['SetupType'] = sprintf("SwitchType(%d);", $arrData['pagetype']); $GLOBALS['Title'] = GetLang('EditPage'); $GLOBALS['FormAction'] = "editPage2"; $GLOBALS['PageTitle'] = isc_html_escape($arrData['pagetitle']); $wysiwygOptions = array( 'id' => 'wysiwyg', 'value' => $arrData['pagecontent'] ); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['PageLink'] = isc_html_escape($arrData['pagelink']); $GLOBALS['PageFeed'] = isc_html_escape($arrData['pagefeed']); $GLOBALS['PageEmail'] = isc_html_escape($arrData['pageemail']); $GLOBALS['ParentPageOptions'] = $this->GetParentPageOptions($arrData['pageparentid'], $pageId, $arrData['pagevendorid']); $GLOBALS['PageKeywords'] = isc_html_escape($arrData['pagekeywords']); $GLOBALS['PageMetaTitle'] = isc_html_escape($arrData['pagemetatitle']); $GLOBALS['PageDesc'] = isc_html_escape($arrData['pagedesc']); $GLOBALS['PageSearchKeywords'] = isc_html_escape($arrData['pagesearchkeywords']); $GLOBALS['PageSort'] = (int) $arrData['pagesort']; if($arrData['pagestatus'] == 1) { $GLOBALS['Visible'] = 'checked="checked"'; } if($arrData['pagecustomersonly'] == 1) { $GLOBALS['IsCustomersOnly'] = "checked=\"checked\""; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "fullname"))) { $GLOBALS['IsContactFullName'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "companyname"))) { $GLOBALS['IsContactCompanyName'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "phone"))) { $GLOBALS['IsContactPhone'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "orderno"))) { $GLOBALS['IsContactOrderNo'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "rma"))) { $GLOBALS['IsContactRMA'] = 'checked="checked"'; } // Is this page the default home page? if($arrData['pageishomepage'] == 1) { $GLOBALS['IsHomePage'] = 'checked="checked"'; } $GLOBALS['IsVendor'] = 'false'; if(!gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorOption'] = 'display: none'; } else { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if(isset($vendorData['vendorid'])) { $GLOBALS['HideVendorSelect'] = 'display: none'; $GLOBALS['IsVendor'] = 'true'; $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']); } else { $GLOBALS['HideVendorLabel'] = 'display: none'; $GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['pagevendorid']); } } // Get a list of all layout files $layoutFile = 'page.html'; if($arrData['pagelayoutfile'] != '') { $layoutFile = $arrData['pagelayoutfile']; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("page.html", $layoutFile); //Google website optimizer $GLOBALS['GoogleWebsiteOptimizerIntro'] = GetLang('PageGoogleWebsiteOptimizerIntro'); $GLOBALS['HideOptimizerConfigForm'] = 'display:none;'; $GLOBALS['CheckEnableOptimizer'] = ''; $GLOBALS['SkipOptimizerConfirmMsg'] = 'true'; $enabledOptimizers = GetConfig('OptimizerMethods'); if(!empty($enabledOptimizers)) { foreach ($enabledOptimizers as $id => $date) { GetModuleById('optimizer', $optimizerModule, $id); if ($optimizerModule->_testPage == 'pages' || $optimizerModule->_testPage == 'all') { $GLOBALS['SkipOptimizerConfirmMsg'] = 'false'; break; } } } if($arrData['page_enable_optimizer']) { $GLOBALS['HideOptimizerConfigForm'] = ''; $GLOBALS['CheckEnableOptimizer'] = 'Checked'; } $pageUrl = PageLink($pageId, $arrData['pagetitle']); $optimizer = getClass('ISC_ADMIN_OPTIMIZER'); $GLOBALS['OptimizerConfigForm'] = $optimizer->showPerItemConfigForm('page', $pageId, $pageUrl); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing'); $this->template->display('page.form.tpl'); } else { // The news page doesn't exist FlashMessage(GetLang('PageDoesntExist'), MSG_ERROR, 'index.php?ToDo=viewPages'); } }
private function EditCategory() { $GLOBALS['Message'] = GetFlashMessageBoxes(); if (isset($_GET['catId'])) { $catId = (int) $_GET['catId']; $this->categoryAPI->load($catId); $GLOBALS['CategoryName'] = isc_html_escape($this->categoryAPI->catname); $GLOBALS['CategoryOptions'] = $this->GetCategoryParentOptions($catId, array($this->categoryAPI->catparentid)); $GLOBALS['CategorySort'] = isc_html_escape($this->categoryAPI->catsort); $GLOBALS['CategoryPageTitle'] = isc_html_escape($this->categoryAPI->catpagetitle); $GLOBALS['CategoryMetaKeywords'] = isc_html_escape($this->categoryAPI->catmetakeywords); $GLOBALS['CategoryMetaDesc'] = isc_html_escape($this->categoryAPI->catmetadesc); $GLOBALS['CategorySearchKeywords'] = isc_html_escape($this->categoryAPI->catsearchkeywords); $wysiwygOptions = array( 'id' => 'wysiwyg', 'width' => '656px', 'height' => '250px', 'value' => $this->categoryAPI->catdesc ); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['FormAction'] = "saveUpdatedCategory"; $GLOBALS['CatTitle'] = GetLang('EditCatTitle'); $GLOBALS['CatIntro'] = GetLang('EditCatIntro'); $GLOBALS['CancelMessage'] = GetLang('CancelEditCategory'); $GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='categoryId' value='%d'>", $catId); if ($this->categoryAPI->catparentid == '0') { $GLOBALS['DisableFileUpload'] = 'disabled="disabled"'; $GLOBALS['ShowFileUploadMessage'] = ''; } else { $GLOBALS['DisableFileUpload'] = ''; $GLOBALS['ShowFileUploadMessage'] = 'none'; } // Get a list of all layout files $layoutFile = 'category.html'; if($this->categoryAPI->catlayoutfile != '') { $layoutFile = $this->categoryAPI->catlayoutfile; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("category.html", $layoutFile); $GLOBALS["CatImageMessage"] = ''; $this->template->assign('ShowYesUseImageRow', 'none'); if ($this->categoryAPI->catimagefile !== '') { $image = '../' . GetConfig('ImageDirectory') . '/' . $this->categoryAPI->catimagefile; $GLOBALS["CatImageMessage"] = sprintf(GetLang('CatImageDesc'), $image, $this->categoryAPI->catimagefile); $this->template->assign('CatImageFile', basename($this->categoryAPI->catimagefile)); $this->template->assign('ShowYesUseImageRow', 'block'); $this->template->assign('CatImageLink', $image); } //Google website optimizer $GLOBALS['GoogleWebsiteOptimizerIntro'] = GetLang('CatGoogleWebsiteOptimizerIntro'); $GLOBALS['HideOptimizerConfigForm'] = 'display:none;'; $GLOBALS['CheckEnableOptimizer'] = ''; $GLOBALS['SkipOptimizerConfirmMsg'] = 'true'; $enabledOptimizers = GetConfig('OptimizerMethods'); if(!empty($enabledOptimizers)) { foreach ($enabledOptimizers as $id => $date) { GetModuleById('optimizer', $optimizerModule, $id); if ($optimizerModule->_testPage == 'categories' || $optimizerModule->_testPage == 'all') { $GLOBALS['SkipOptimizerConfirmMsg'] = 'false'; break; } } } if($this->categoryAPI->cat_enable_optimizer == '1') { $GLOBALS['HideOptimizerConfigForm'] = ''; $GLOBALS['CheckEnableOptimizer'] = 'Checked'; } $optimizer = getClass('ISC_ADMIN_OPTIMIZER'); $GLOBALS['OptimizerConfigForm'] = $optimizer->showPerItemConfigForm('category', $catId, CatLink($catId, $this->categoryAPI->catname)); if(isset($_REQUEST['currentTab'])) { $GLOBALS['CurrentTab'] = $_REQUEST['currentTab']; } else { $GLOBALS['CurrentTab'] = 'details'; } // Get shopping comparison options $shoppingComparisonModules = Isc_ShoppingComparison::getModulesWithTaxonomies(); $GLOBALS['AlternateCategoriesCache'] = (array)json_decode($this->categoryAPI->cataltcategoriescache); $GLOBALS['ShoppingComparisonModules'] = $shoppingComparisonModules; $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing'); $this->template->display('category.form.tpl'); } else { if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Categories)) { $this->ManageCategories(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
public function CopyProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost=false, $OriginalProductID=0) { if ($MsgDesc != "") { $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus); } // Show the form to edit a product if (isset($_REQUEST['productId']) && isId($_REQUEST['productId'])) { $OriginalProductID = $_REQUEST['productId']; } $prodId = $OriginalProductID; $z = 0; $arrData = array(); $arrCustomFields = array(); if (GetConfig('CurrencyLocation') == 'right') { $GLOBALS['CurrencyTokenLeft'] = ''; $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken'); } else { $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken'); $GLOBALS['CurrencyTokenRight'] = ''; } $GLOBALS['ServerFiles'] = $this->_GetImportFilesOptions(); $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY'); // Make sure the product exists if (ProductExists($prodId)) { if($PreservePost == true) { $this->_GetProductData(0, $arrData); $this->_GetCustomFieldData(0, $arrCustomFields); $GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout(0, true); // Restore the hash $GLOBALS['ProductHash'] = $arrData['prodhash']; } else { $this->_GetProductData($prodId, $arrData); $this->_GetCustomFieldData($prodId, $arrCustomFields); $GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout($prodId, true); // Generate the hash $GLOBALS['ProductHash'] = md5(time().uniqid(rand(), true)); // We'll need to duplicate (copy) the thumbnail, images and download files here $this->_CopyDownloads($prodId, 0, $GLOBALS['ProductHash']); $productImages = ISC_PRODUCT_IMAGE::copyImagesToProductHash($prodId, $GLOBALS['ProductHash']); $this->setupProductImageGlobals($productImages); $arrData['prodname'] = GetLang('CopyOf') . $arrData['prodname']; } $this->template->assign('product', $arrData); // Does this user have permission to edit this product? if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['prodvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewProducts'); } if(isset($_POST['currentTab'])) { $GLOBALS['CurrentTab'] = (int)$_POST['currentTab']; } else { $GLOBALS['CurrentTab'] = 0; } $GLOBALS['FormAction'] = 'copyProduct2'; $GLOBALS['Title'] = GetLang('CopyProductTitle'); $GLOBALS['Intro'] = GetLang('CopyProductIntro'); $GLOBALS["ProdType_" . $arrData['prodtype']] = 'checked="checked"'; $GLOBALS['ProdType'] = $arrData['prodtype'] - 1; $GLOBALS['ProdCode'] = isc_html_escape($arrData['prodcode']); $GLOBALS['ProdName'] = isc_html_escape($arrData['prodname']); $GLOBALS['OriginalProductId'] = $OriginalProductID; $visibleCategories = array(); if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if($vendorData['vendoraccesscats']) { $visibleCategories = explode(',', $vendorData['vendoraccesscats']); } } $GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions($arrData['prodcats'], "<option %s value='%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories); $GLOBALS['RelatedCategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions(0, "<option %s value='%d'>%s</option>", "selected='selected'", "- ", false); $wysiwygOptions = array( 'id' => 'wysiwyg', 'width' => '100%', 'height' => '500px', 'value' => $arrData['proddesc'] ); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['ProdSearchKeywords'] = isc_html_escape($arrData['prodsearchkeywords']); $GLOBALS['ProdAvailability'] = isc_html_escape($arrData['prodavailability']); $GLOBALS['ProdPrice'] = number_format($arrData['prodprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); if (CFloat($arrData['prodcostprice']) > 0) { $GLOBALS['ProdCostPrice'] = number_format($arrData['prodcostprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodretailprice']) > 0) { $GLOBALS['ProdRetailPrice'] = number_format($arrData['prodretailprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodsaleprice']) > 0) { $GLOBALS['ProdSalePrice'] = number_format($arrData['prodsaleprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } $GLOBALS['ProdSortOrder'] = $arrData['prodsortorder']; if ($arrData['prodvisible'] == 1) { $GLOBALS['ProdVisible'] = "checked"; } if ($arrData['prodfeatured'] == 1) { $GLOBALS['ProdFeatured'] = "checked"; } if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { $GLOBALS['HideStoreFeatured'] = 'display: none'; } else if(!gzte11(ISC_HUGEPRINT) || !$arrData['prodvendorid']) { $GLOBALS['HideVendorFeatured'] = 'display: none'; } if($arrData['prodvendorfeatured'] == 1) { $GLOBALS['ProdVendorFeatured'] = 'checked="checked"'; } if($arrData['prodallowpurchases'] == 1) { $GLOBALS['ProdAllowPurchases'] = 'checked="checked"'; } else { if($arrData['prodhideprice'] == 1) { $GLOBALS['ProdHidePrice'] = 'checked="checked"'; } $GLOBALS['ProdCallForPricingLabel'] = isc_html_escape($arrData['prodcallforpricinglabel']); } $GLOBALS['ProdWarranty'] = $arrData['prodwarranty']; $GLOBALS['ProdWeight'] = number_format($arrData['prodweight'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); if (CFloat($arrData['prodwidth']) > 0) { $GLOBALS['ProdWidth'] = number_format($arrData['prodwidth'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodheight']) > 0) { $GLOBALS['ProdHeight'] = number_format($arrData['prodheight'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['proddepth']) > 0) { $GLOBALS['ProdDepth'] = number_format($arrData['proddepth'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if (CFloat($arrData['prodfixedshippingcost']) > 0) { $GLOBALS['ProdFixedShippingCost'] = number_format($arrData['prodfixedshippingcost'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), ""); } if ($arrData['prodfreeshipping'] == 1) { $GLOBALS['FreeShipping'] = 'checked="checked"'; } if($arrData['prodrelatedproducts'] == -1) { $GLOBALS['IsProdRelatedAuto'] = 'checked="checked"'; } else if(isset($arrData['prodrelated'])) { $GLOBALS['RelatedProductOptions'] = ""; foreach ($arrData['prodrelated'] as $r) { $GLOBALS['RelatedProductOptions'] .= sprintf("<option value='%d'>%s</option>", (int) $r[0], isc_html_escape($r[1])); } } $GLOBALS['ProdTags'] = $arrData['prodtags']; $GLOBALS['CurrentStockLevel'] = $arrData['prodcurrentinv']; $GLOBALS['LowStockLevel'] = $arrData['prodlowinv']; $GLOBALS["InvTrack_" . $arrData['prodinvtrack']] = 'checked="checked"'; $GLOBALS['WrappingOptions'] = $this->BuildGiftWrappingSelect(explode(',', $arrData['prodwrapoptions'])); $GLOBALS['HideGiftWrappingOptions'] = 'display: none'; if($arrData['prodwrapoptions'] == 0) { $GLOBALS['WrappingOptionsDefaultChecked'] = 'checked="checked"'; } else if($arrData['prodwrapoptions'] == -1) { $GLOBALS['WrappingOptionsNoneChecked'] = 'checked="checked"'; } else { $GLOBALS['HideGiftWrappingOptions'] = ''; $GLOBALS['WrappingOptionsCustomChecked'] = 'checked="checked"'; } if ($arrData['prodinvtrack'] == 1) { $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(true);"; } else { $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(false);"; } if ($arrData['prodoptionsrequired'] == 1) { $GLOBALS['OptionsRequired'] = 'checked="checked"'; } if ($arrData['prodtype'] == 1) { $GLOBALS['HideProductInventoryOptions'] = "none"; } $GLOBALS['EnterOptionPrice'] = sprintf(GetLang('EnterOptionPrice'), GetConfig('CurrencyToken'), GetConfig('CurrencyToken')); $GLOBALS['EnterOptionWeight'] = sprintf(GetLang('EnterOptionWeight'), GetConfig('WeightMeasurement')); $GLOBALS['HideCustomFieldLink'] = "none"; if(getConfig('taxEnteredWithPrices') == TAX_PRICES_ENTERED_INCLUSIVE) { $this->template->assign('enterPricesWithTax', true); } $GLOBALS['CustomFields'] = ''; $GLOBALS['CustomFieldKey'] = 0; if (!empty($arrCustomFields)) { foreach ($arrCustomFields as $f) { $GLOBALS['CustomFieldName'] = isc_html_escape($f['name']); $GLOBALS['CustomFieldValue'] = isc_html_escape($f['value']); $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel(($GLOBALS['CustomFieldKey']+1), GetLang('CustomField')); if (!$GLOBALS['CustomFieldKey']) { $GLOBALS['HideCustomFieldDelete'] = 'none'; } else { $GLOBALS['HideCustomFieldDelete'] = ''; } $GLOBALS['CustomFields'] .= $this->template->render('Snippets/CustomFields.html'); $GLOBALS['CustomFieldKey']++; } } // Add one more custom field $GLOBALS['CustomFieldName'] = ''; $GLOBALS['CustomFieldValue'] = ''; $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel(($GLOBALS['CustomFieldKey']+1), GetLang('CustomField')); if (!$GLOBALS['CustomFieldKey']) { $GLOBALS['HideCustomFieldDelete'] = 'none'; } else { $GLOBALS['HideCustomFieldDelete'] = ''; } $GLOBALS['CustomFields'] .= $this->template->render('Snippets/CustomFields.html'); // Get a list of any downloads associated with this product $GLOBALS['DownloadsGrid'] = $this->GetDownloadsGrid(0, $GLOBALS['ProductHash']); $GLOBALS['ISC_LANG']['MaxUploadSize'] = sprintf(GetLang('MaxUploadSize'), GetMaxUploadSize()); if($GLOBALS['DownloadsGrid'] == '') { $GLOBALS['DisplayDownloaadGrid'] = "none"; } // Get the brands as select options $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS'); $GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_ADMIN_BRANDS']->GetBrandsAsOptions($arrData['prodbrandid']); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother'); // Get a list of all layout files $layoutFile = 'product.html'; if($arrData['prodlayoutfile'] != '') { $layoutFile = $arrData['prodlayoutfile']; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("product.html", $layoutFile); $GLOBALS['ProdPageTitle'] = isc_html_escape($arrData['prodpagetitle']); $GLOBALS['ProdMetaKeywords'] = isc_html_escape($arrData['prodmetakeywords']); $GLOBALS['ProdMetaDesc'] = isc_html_escape($arrData['prodmetadesc']); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother'); if(!gzte11(ISC_MEDIUMPRINT)) { $GLOBALS['HideInventoryOptions'] = "none"; } else { $GLOBALS['HideInventoryOptions'] = ''; } // Does this product have a variation assigned to it? $GLOBALS['ProductVariationExisting'] = $arrData['prodvariationid']; if($arrData['prodvariationid'] > 0) { $GLOBALS['IsYesVariation'] = 'checked="checked"'; } else { $GLOBALS['IsNoVariation'] = 'checked="checked"'; $GLOBALS['HideVariationList'] = "none"; $GLOBALS['HideVariationCombinationList'] = "none"; } // Get the list of tax classes and assign them $this->template->assign('taxClasses', array( 0 => getLang('DefaultTaxClass') ) + getClass('ISC_TAX')->getTaxClasses()); // If there are no variations then disable the option to choose one $numVariations = 0; $GLOBALS['VariationOptions'] = $this->GetVariationsAsOptions($numVariations, $arrData['prodvariationid']); if($numVariations == 0) { $GLOBALS['VariationDisabled'] = "DISABLED"; $GLOBALS['VariationColor'] = "#CACACA"; $GLOBALS['IsNoVariation'] = 'checked="checked"'; $GLOBALS['IsYesVariation'] = ""; $GLOBALS['HideVariationCombinationList'] = "none"; } else { // Load the variation combinations if($arrData['prodinvtrack'] == 2) { $show_inv_fields = true; } else { $show_inv_fields = false; } /** * We'll need to duplicate the variation combinations here if we are NOT preserving the post */ if (!$PreservePost) { $this->_CopyVariationData($arrData['productid'], 0, $GLOBALS['ProductHash']); } $GLOBALS['VariationCombinationList'] = $this->_LoadVariationCombinationsTable($arrData['prodvariationid'], $show_inv_fields, 0, $GLOBALS['ProductHash']); } if(!gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorOption'] = 'display: none'; } else { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if(isset($vendorData['vendorid'])) { $GLOBALS['HideVendorSelect'] = 'display: none'; $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']); } else { $GLOBALS['HideVendorLabel'] = 'display: none'; $GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['prodvendorid']); } } // Display the discount rules if ($PreservePost == true) { $GLOBALS['DiscountRules'] = $this->GetDiscountRules(0); } else { $GLOBALS['DiscountRules'] = $this->GetDiscountRules($prodId); } // Hide if we are not enabled if (!GetConfig('BulkDiscountEnabled')) { $GLOBALS['HideDiscountRulesWarningBox'] = ''; $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesNotEnabledWarning'); $GLOBALS['DiscountRulesWithWarning'] = 'none'; // Also hide it if this product has variations } else if (isset($arrData['prodvariationid']) && isId($arrData['prodvariationid'])) { $GLOBALS['HideDiscountRulesWarningBox'] = ''; $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesVariationWarning'); $GLOBALS['DiscountRulesWithWarning'] = 'none'; } else { $GLOBALS['HideDiscountRulesWarningBox'] = 'none'; $GLOBALS['DiscountRulesWithWarning'] = ''; } $GLOBALS['DiscountRulesEnabled'] = (int)GetConfig('BulkDiscountEnabled'); $GLOBALS['EventDateFieldName'] = $arrData['prodeventdatefieldname']; if ($GLOBALS['EventDateFieldName'] == null) { $GLOBALS['EventDateFieldName'] = GetLang('EventDateDefault'); } if ($arrData['prodeventdaterequired'] == 1) { $GLOBALS['EventDateRequired'] = 'checked="checked"'; $from_stamp = $arrData['prodeventdatelimitedstartdate']; $to_stamp = $arrData['prodeventdatelimitedenddate']; } else { $from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y")); $to_stamp = isc_gmmktime(0, 0, 0, isc_date("m")+1, isc_date("d"), isc_date("Y")); } if ($arrData['prodeventdatelimited'] == 1) { $GLOBALS['LimitDates'] = 'checked="checked"'; } $GLOBALS['LimitDateOption1'] = ''; $GLOBALS['LimitDateOption2'] = ''; $GLOBALS['LimitDateOption3'] = ''; switch ($arrData['prodeventdatelimitedtype']) { case 1 : $GLOBALS['LimitDateOption1'] = 'selected="selected"'; break; case 2 : $GLOBALS['LimitDateOption2'] = 'selected="selected"'; break; case 3 : $GLOBALS['LimitDateOption3'] = 'selected="selected"'; break; } // Set the global variables for the select boxes $from_day = isc_date("d", $from_stamp); $from_month = isc_date("m", $from_stamp); $from_year = isc_date("Y", $from_stamp); $to_day = isc_date("d", $to_stamp); $to_month = isc_date("m", $to_stamp); $to_year = isc_date("Y", $to_stamp); $GLOBALS['OverviewFromDays'] = $this->_GetDayOptions($from_day); $GLOBALS['OverviewFromMonths'] = $this->_GetMonthOptions($from_month); $GLOBALS['OverviewFromYears'] = $this->_GetYearOptions($from_year); $GLOBALS['OverviewToDays'] = $this->_GetDayOptions($to_day); $GLOBALS['OverviewToMonths'] = $this->_GetMonthOptions($to_month); $GLOBALS['OverviewToYears'] = $this->_GetYearOptions($to_year); if(!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Create_Category)) { $GLOBALS['HideCategoryCreation'] = 'display: none'; } //Google website optimizer $GLOBALS['HideOptimizerConfigForm'] = 'display:none;'; $GLOBALS['CheckEnableOptimizer'] = ''; $GLOBALS['SkipConfirmMsg'] = 'false'; $GLOBALS['GoogleWebsiteOptimizerIntro'] = GetLang('ProdGoogleWebsiteOptimizerIntro'); $enabledOptimizers = GetConfig('OptimizerMethods'); if(!empty($enabledOptimizers)) { foreach ($enabledOptimizers as $id => $date) { GetModuleById('optimizer', $optimizerModule, $id); if ($optimizerModule->_testPage == 'products' || $optimizerModule->_testPage == 'all') { $GLOBALS['SkipConfirmMsg'] = 'false'; break; } } } if($arrData['product_enable_optimizer'] == '1') { $GLOBALS['HideOptimizerConfigForm'] = ''; $GLOBALS['CheckEnableOptimizer'] = 'Checked'; } $this->template->assign('prodminqty', $arrData['prodminqty']); $this->template->assign('prodmaxqty', $arrData['prodmaxqty']); $optimizer = getClass('ISC_ADMIN_OPTIMIZER'); $GLOBALS['OptimizerConfigForm'] = $optimizer->showPerItemConfigForm('product', $arrData['productid'],prodLink($arrData['prodname'])); if ($arrData['prodpreorder'] && $arrData['prodreleasedateremove'] && time() >= $arrData['prodreleasedate']) { // pre-order release date has passed and remove is ticked, remove it now for the copy form at least - saving it will commit it to the db $arrData['prodpreorder'] = 0; $arrData['prodreleasedate'] = 0; $arrData['prodreleasedateremove'] = 0; } // note: prodpreorder is a database column does not map directly to a form field, it'll be set to 1 if _prodorderable is 'pre', along with prodallowpurchases to 1 // note: _prodorderable is a form field that does not map to a database column if (!$arrData['prodallowpurchases']) { $this->template->assign('_prodorderable', 'no'); } else if ($arrData['prodpreorder']) { $this->template->assign('_prodorderable', 'pre'); } else { $this->template->assign('_prodorderable', 'yes'); } $this->template->assign('prodreleasedateremove', $arrData['prodreleasedateremove']); if (isset($arrData['prodpreordermessage']) && $arrData['prodpreordermessage']) { $this->template->assign('prodpreordermessage', $arrData['prodpreordermessage']); } else { $this->template->assign('prodpreordermessage', GetConfig('DefaultPreOrderMessage')); } if ($arrData['prodreleasedate']) { $this->template->assign('prodreleasedate', isc_date('d/m/Y', $arrData['prodreleasedate'])); } $GLOBALS['ProdCondition' . $arrData['prodcondition'] . 'Selected'] = 'selected="selected"'; if ($arrData['prodshowcondition']) { $GLOBALS['ProdShowCondition'] = 'checked="checked"'; } // Open Graph Settings $this->template->assign('openGraphTypes', ISC_OPENGRAPH::getObjectTypes(true)); $this->template->assign('openGraphSelectedType', $arrData['opengraph_type']); $this->template->assign('openGraphUseProductName', (bool)$arrData['opengraph_use_product_name']); $this->template->assign('openGraphTitle', $arrData['opengraph_title']); $this->template->assign('openGraphUseMetaDescription', (bool)$arrData['opengraph_use_meta_description']); $this->template->assign('openGraphDescription', $arrData['opengraph_description']); $this->template->assign('openGraphUseImage', (bool)$arrData['opengraph_use_image']); // UPC $this->template->assign('ProdUPC', $arrData['upc']); // Google Checkout $this->template->assign('ProdDisableGoogleCheckout', $arrData['disable_google_checkout']); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother'); $this->setupProductLanguageString(); $this->template->display('product.form.tpl'); } else { // The product doesn't exist if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { $this->ManageProducts(GetLang('ProductDoesntExist'), MSG_ERROR); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
private function EditPageStep1($MsgDesc = "", $MsgStatus = "", $IsError = false) { $GLOBALS['Message'] = ''; if ($MsgDesc != "") { $GLOBALS['Message'] .= MessageBox($MsgDesc, $MsgStatus); } $GLOBALS['Message'] .= GetFlashMessageBoxes(); $pageId = (int) $_REQUEST['pageId']; $arrData = array(); if (PageExists($pageId)) { // Was the page submitted with a duplicate page name? if ($IsError) { $this->_GetPageData(0, $arrData); } else { $this->_GetPageData($pageId, $arrData); } // Does this user have permission to edit this product? if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['pagevendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewPages'); } $GLOBALS['PageId'] = (int) $pageId; $GLOBALS['SetupType'] = sprintf("SwitchType(%d);", $arrData['pagetype']); $GLOBALS['Title'] = GetLang('EditPage'); $GLOBALS['FormAction'] = "editPage2"; $GLOBALS['PageTitle'] = isc_html_escape($arrData['pagetitle']); $GLOBALS['PageName'] = isc_html_escape($arrData['pagename']); $wysiwygOptions = array('id' => 'wysiwyg', 'value' => $arrData['pagecontent']); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['PageLink'] = isc_html_escape($arrData['pagelink']); $GLOBALS['PageFeed'] = isc_html_escape($arrData['pagefeed']); $GLOBALS['PageEmail'] = isc_html_escape($arrData['pageemail']); $GLOBALS['ParentPageOptions'] = $this->GetParentPageOptions($arrData['pageparentid'], $pageId, $arrData['pagevendorid']); $GLOBALS['PageKeywords'] = isc_html_escape($arrData['pagekeywords']); $GLOBALS['PageDesc'] = isc_html_escape($arrData['pagedesc']); $GLOBALS['PageSort'] = (int) $arrData['pagesort']; if ($arrData['pagestatus'] == 1) { $GLOBALS['Visible'] = 'checked="checked"'; } if ($arrData['pagecustomersonly'] == 1) { $GLOBALS['IsCustomersOnly'] = "checked=\"checked\""; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "fullname"))) { $GLOBALS['IsContactFullName'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "companyname"))) { $GLOBALS['IsContactCompanyName'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "phone"))) { $GLOBALS['IsContactPhone'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "orderno"))) { $GLOBALS['IsContactOrderNo'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "rma"))) { $GLOBALS['IsContactRMA'] = 'checked="checked"'; } // Is this page the default home page? if ($arrData['pageishomepage'] == 1) { $GLOBALS['IsHomePage'] = 'checked="checked"'; } if (!gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorOption'] = 'display: none'; } else { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if (isset($vendorData['vendorid'])) { $GLOBALS['HideVendorSelect'] = 'display: none'; $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']); } else { $GLOBALS['HideVendorLabel'] = 'display: none'; $GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['pagevendorid']); } } // Get a list of all layout files $layoutFile = 'page.html'; if ($arrData['pagelayoutfile'] != '') { $layoutFile = $arrData['pagelayoutfile']; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("page.html", $layoutFile); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing'); $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("page.form"); $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(); } else { // The news page doesn't exist FlashMessage(GetLang('PageDoesntExist'), MSG_ERROR, 'index.php?ToDo=viewPages'); } }