function output() { global $application; if (modApiFunc('Session', 'is_set', 'mustReloadParent')) { modApiFunc('Session', 'un_set', 'mustReloadParent'); $must_reload = true; } else { $must_reload = false; } $prodObj =& $application->getInstance('CProductInfo', $this->product_id); $template_contents = array('Local_ProductBookmarks' => getProductBookmarks('categories', $this->product_id), 'ResultMessage' => $this->outputResultMessage(), 'jsCatsArray' => $this->out_jsCatsArray(), 'ProductID' => $this->product_id, 'ProductName' => $prodObj->getProductTagValue('Name'), 'reloadPrent' => $must_reload ? 'if(!(!window.opener || window.opener.closed)){if (window.opener && window.opener.document.ProductSearchForm && window.opener.document.ProductSearchForm.active && window.opener.document.ProductSearchForm.active.value == \'Y\') window.opener.document.ProductSearchForm.submit(); else window.opener.location.reload();};' : ''); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("catalog/product_categories/", "container.tpl.html", array()); }
function getTag($tag) { global $application; $value = null; switch ($tag) { case 'Local_ProductBookmarks': $value = getProductBookmarks('color_swatch', $this->product_id); break; case 'CurrencySign': $value = modApiFunc("Localization", "getCurrencySign"); break; case 'SelectColorsForm': $numberofcolors = modApiFunc('ColorSwatch', 'getNumberOfColors', $this->product_id); $value = '<select name="colorsnum"> <option value="1" ' . ($numberofcolors == '1' ? 'selected="selected"' : "") . '>1</option> <option value="2" ' . ($numberofcolors == '2' ? 'selected="selected"' : "") . '>2</option> <option value="3" ' . ($numberofcolors == '3' ? 'selected="selected"' : "") . '>3</option> <option value="4" ' . ($numberofcolors == '4' ? 'selected="selected"' : "") . '>4</option> <option value="5" ' . ($numberofcolors == '5' ? 'selected="selected"' : "") . '>5</option> </select>'; break; case 'AddLabelText': $labeltext = modApiFunc('ColorSwatch', 'getLabelText', $this->product_id); $value = '<td class="value" style="background-color:#EEF2F8;"><input size="20" type="text" name="label_text" value="' . $labeltext . '" /> </td>'; break; case 'ListOfColors': $colorinfo = modApiFunc('ColorSwatch', 'getColorSwatchRows', $this->product_id); for ($i = 0; $i < count($colorinfo); $i++) { $colorname = $colorinfo[$i]['name']; $colorid = $colorinfo[$i]['id']; $main_image = $colorinfo[$i]['main_image']; $checked_image = $colorinfo[$i]['checked_image']; $label_text = $colorinfo[$i]['label_text']; $currencysign = modApiFunc("Localization", "getCurrencySign"); $value .= '<tr> <td class="value" style="background-color:#EEF2F8;width:18%"><input size="30" type="text" name="UpdateValues[' . $colorid . '][colorname]" value="' . $colorname . '" readonly="readonly" style="margin-left:50px;"/></td> <td class="value" style="background-color:#EEF2F8;"><input size="56" type="text" name="UpdateValues[' . $colorid . '][main_image]" value="' . $main_image . '" style="margin-left: 50px;" /> </td> <!--<td class="value" style="background-color:#EEF2F8;"><input size="50" type="text" name="UpdateValues[' . $colorid . '][checked_image]" value="' . $checked_image . '" /> </td>--> <!--<td class="value" style="background-color:#EEF2F8;"><input size="20" type="text" name="UpdateValues[' . $colorid . '][label_text]" value="' . $label_text . '" /> </td>--> <td class="value" style="background-color:#EEF2F8; width: 2%;"><input size="10" type="checkbox" value="' . $colorid . '" name="toDeleteValues[' . $colorid . ']" /></td> <input type="hidden" name="UpdateValues[' . $colorid . '][colorid]" value="' . $colorid . '" /> </tr>'; } break; case 'AddNewColor_Form': $value = $this->getAddColorform(); break; case 'ResultMessage': $value = $this->outputResultMessage(); break; case 'SavedOkMessage': $value = $this->getSavedOkMessage(); break; case 'DeleteMessage': $value = $this->outputDeleteMessage(); break; } return $value; }
function output() { global $application; $request = new Request(); $this->product_id = $request->getValueByKey('product_id'); $prod_obj =& $application->getInstance('CProductInfo', $this->product_id); $this->RPLinks = modApiFunc('Related_Products', 'getRPIDsForProduct', $this->product_id); $pbrowser_params = array('show_category_path' => true, 'buttons' => array('add' => array('label' => 'BTN_ADD', 'callback' => 'addProductToRPList(%PID%,%PNAME%);', 'default_state' => 'disabled', 'enable_condition' => 'product_selected')), 'choosed_control_array' => 'related_array'); $request->setView('related_products'); $request->setAction('save_rp_links'); $request->setKey('product_id', $this->product_id); loadClass('ProductsBrowser'); $this->pb_obj = new ProductsBrowser(); $template_contents = array('ProductName' => $prod_obj->getProductTagValue('Name'), 'Local_ProductBookmarks' => getProductBookmarks('related', $this->product_id), 'ResultMessage' => $this->outputResultMessage(), 'Local_ProductsBrowser' => $this->pb_obj->output($pbrowser_params), 'jsRelatedArray' => $this->out_jsRelatedArray(), 'RelatedList' => $this->out_RelatedList(), 'RPFormAction' => $request->getURL(), 'RPSortForm' => $this->out_RPSortForm(), 'jsControlPListFunc' => str_replace(array('%PID%'), array('product_id'), $this->pb_obj->getControlPListFunction())); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("related_products/rp_links_list/", "container.tpl.html", array()); }
function outputActualHeader() { global $application; if ($this->parent_entity == 'product') { $request_to_no = new Request(); $request_to_no->setView('PO_AddOption'); $request_to_no->setKey('parent_entity', $this->parent_entity); $request_to_no->setKey('entity_id', $this->entity_id); $prdobj =& $application->getInstance('CProductInfo', $this->entity_id); $template_contents = array("AddNewOptionLink" => $request_to_no->getURL(), "ProductName" => $prdobj->getProductTagValue("Name"), "Local_ProductBookmarks" => getProductBookmarks('options', $this->entity_id), "settingsButtonDisplay" => count($this->Options) > 0 ? '' : 'none', "sortButtonDisplay" => count($this->Options) > 1 ? '' : 'none'); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("product_options/", "header-for-product-on-options-list.tpl.html", array()); } elseif ($this->parent_entity == 'ptype') { $ptinfo = modApiFunc("Catalog", "getProductType", $this->entity_id); $template_contents = array("ProductTypeName" => $ptinfo['name']); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("product_options/", "header-for-ptype-on-options-list.tpl.html", array()); } }
/** * */ function output() { global $application; loadCoreFile('html_form.php'); $HtmlForm1 = new HtmlForm(); if ($this->ViewState["hasCloseScript"] == "true") { modApiFunc("application", "closeChild_UpdateParent"); return; } $this->CurrentRateUnitValue = "item"; // ? $this->CurrentRateUnit = "Quantity"; $request = new Request(); $request->setView('manage_quantity_discounts_az'); $request->setAction("update_quantity_discounts"); $form_action = $request->getURL(); $settings = modApiFunc("Discounts", "getSettings"); $product =& $application->getInstance('CProductInfo', $this->POST["product_id"]); $template_contents = array("EditQuantityDiscountForm" => $HtmlForm1->genForm($form_action, "POST", "EditQuantityDiscountForm"), "HiddenArrayViewState" => $this->outputViewState(), "Errors" => $this->outputErrors(), "Items" => $this->outputQuantityDiscountRates(), "RvPatternType" => $this->CurrentRateUnitValue, "RvFormat" => modApiFunc("Localization", "format_settings_for_js", $this->CurrentRateUnitValue), "RvFromValue" => modApiFunc("Localization", "FloatToFormatStr", $this->POST["rv_from"], $this->CurrentRateUnitValue), "CostPatternType" => "currency", "CostFormat" => modApiFunc("Localization", "format_settings_for_js", "currency"), "CostValue" => modApiFunc("Localization", "FloatToFormatStr", $this->POST["cost"], "currency"), "CostTypeOptions" => $this->outputCostType(), "Local_ProductBookmarks" => getProductBookmarks('quantity_discounts', $this->POST["product_id"]), "Local_ProductId" => $this->POST["product_id"], "Local_ProductSalePrice" => $product->getProductTagValue("SalePrice"), "ProductName" => $product->getProductTagValue("Name"), "NewPriceOrDiscountOptions" => $this->outputNewPriceOrDiscount(), "ResultMessage" => $this->outputResultMessage(), "MembershipDropDown" => modApiFunc('Customer_Account', 'getGroupsDropDown')); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $obj =& $application->getInstance('MessageResources'); $output = modApiFunc('TmplFiller', 'fill', './../../js/', 'validate.msgs.js.tpl', array("INTEGER" => $obj->getMessage(new ActionMessage(array('PRDADD_001'))), "FLOAT" => $obj->getMessage(new ActionMessage(array('PRDADD_002'))), "STRING1024" => $obj->getMessage(new ActionMessage(array('PRDADD_007'))), "STRING128" => $obj->getMessage(new ActionMessage(array('PRDADD_008'))), "STRING256" => $obj->getMessage(new ActionMessage(array('PRDADD_009'))), "STRING512" => $obj->getMessage(new ActionMessage(array('PRDADD_010'))), "CURRENCY" => addslashes($obj->getMessage(new ActionMessage(array('CURRENCY_FIELD', modApiFunc("Localization", "FloatToFormatStr", 12.35, "currency"), modApiFunc("Localization", "FloatToFormatStr", 34, "currency"), modApiFunc("Localization", "FloatToFormatStr", 99.0, "currency"))))), "WEIGHT" => addslashes($obj->getMessage(new ActionMessage(array('WEIGHT_FIELD', modApiFunc("Localization", "FloatToFormatStr", 23.325, "weight"), modApiFunc("Localization", "FloatToFormatStr", 34, "weight"), modApiFunc("Localization", "FloatToFormatStr", 99.2, "weight"))))), "ITEM" => $obj->getMessage(new ActionMessage(array('ITEM_FIELD'))))); return $output . $this->mTmplFiller->fill("quantity_discounts/list_quantity_discounts/", "quantity_discount_list.tpl.html", array()); }
function output() { global $application; $request =& $application->getInstance('Request'); $this->product_id = $request->getValueByKey('product_id'); $settings = modApiFunc('Product_Images', 'getSettings'); $prod_obj =& $application->getInstance('CProductInfo', $this->product_id); $this->PImages = modApiFunc('Product_Images', 'getImagesListForProduct', $this->product_id); $template_contents = array('ProductName' => $prod_obj->getProductTagValue('Name'), 'Local_ProductBookmarks' => getProductBookmarks('images', $this->product_id), 'ResultMessage' => $this->outputResultMessage(), 'ImagesList' => $this->output_ImagesList(), 'AddImageForm' => $this->output_AddImageForm(), 'SortForm' => $this->outputSortForm(), 'UpdButDisplay' => count($this->PImages) > 0 ? '' : 'none', 'ThumbsPerLine' => $settings['THUMBS_PER_LINE']); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("product_images/images_list/", "container.tpl.html", array()); }
function output() { global $application; $request =& $application->getInstance('Request'); $this->product_id = $request->getValueByKey('product_id'); $prod_obj =& $application->getInstance('CProductInfo', $this->product_id); $this->PFiles = modApiFunc('Product_Files', 'getFilesListForProduct', $this->product_id); $template_contents = array('ProductName' => $prod_obj->getProductTagValue('Name'), 'Local_ProductBookmarks' => getProductBookmarks('files', $this->product_id), 'ResultMessage' => $this->outputResultMessage(), 'FilesList' => $this->output_FilesList(), 'AddFileForm' => $this->output_AddFileForm2(), 'UpdButDisplay' => count($this->PFiles) > 0 ? '' : 'none'); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("product_files/files_list/", "container.tpl.html", array()); }
/** * @ describe the function AddProductInfo->getTag. */ function getTag($tag) { global $application; $obj =& $application->getInstance('MessageResources'); $imagesUrl = $application->getAppIni('URL_IMAGES_DIR'); if ($application->getCurrentProtocol() == "https" && $application->getAppIni('HTTPS_URL_IMAGES_DIR')) { $imagesUrl = $application->getAppIni('HTTPS_URL_IMAGES_DIR'); } $pathImagesDir = $application->getAppIni('PATH_IMAGES_DIR'); $value = null; switch ($tag) { case 'Items': $value = $this->getAttributes(); break; case 'Errors': $value = $this->getErrors(); break; case 'AttributeName': $value = $this->_attr['name']; break; case 'AttributeValue': $value = $this->_attr['value']; break; case 'AttributeDefaultValue': $value = $this->_attr['def_value']; break; case 'AttributeTag': $value = $this->_attr['tag']; break; case 'AttributeTagHidden': $value = $this->_attr['tag_hid']; break; case 'AttributeUnit': $value = $this->_attr['unit']; break; case 'AttributePatternType': $value = $this->_attr['pattern_type']; break; case 'AttributeFormat': $value = modApiFunc("Localization", "format_settings_for_js", $this->_attr['pattern_type']); break; case 'AttributeSize': $value = $this->_attr['size']; break; case 'AttributeMax': $value = $this->_attr['max']; break; case 'Counter': $value = $this->_counter; break; case 'AttributeSelectOptions': $value = ""; foreach ($this->_attr_options as $opt_value) { $this->_attr_option = $opt_value; $value .= $this->TemplateFiller->fill("catalog/product_add/", "attr-select-option.tpl.html", array()); } break; case 'AttributeCheckboxes': $value = ""; foreach ($this->_attr_options as $opt_value) { $this->_attr_option = $opt_value; $value .= $this->TemplateFiller->fill("catalog/product_add/", "attr-checkboxgroup-item.tpl.html", array()); } break; case 'AttributeOptionValue': $value = $this->_attr_option['value']; break; case 'AttributeOptionSelected': if ($this->_attr_option['selected']) { $value = " selected"; } break; case 'AttributeOptionName': if ($this->_attr['tag'] == 'TaxClass' && $this->_attr['tag'] != 'MembershipVisibility') { $value = prepareHTMLDisplay($this->_attr_option['name']); } else { $value = $this->_attr_option['name']; } break; case 'AttributeNextCheckboxColumn': $value = $this->_attr_option['next_column']; break; case 'AddLink': $value = isset($this->_attr['additional_link']) ? $this->_attr['additional_link'] : ""; break; case 'AddLinkText': $value = isset($this->_attr['additional_link_text']) ? $this->_attr['additional_link_text'] : ""; break; case 'ViewStateLargeImage': $value = ''; if ($this->ViewState['LargeImage']) { $images_dir = $imagesUrl; $value = $images_dir . $this->ViewState['LargeImage']; } break; case 'ViewStateSmallImage': $value = ''; if ($this->ViewState['SmallImage']) { $images_dir = $imagesUrl; $value = $images_dir . $this->ViewState['SmallImage']; } break; case 'LargeImageWidth': $value = ''; if ($this->ViewState['LargeImage']) { list($width, $height) = getimagesize($pathImagesDir . $this->ViewState['LargeImage']); $value = $width; } break; case 'LargeImageHeight': $value = ''; if ($this->ViewState['LargeImage']) { list($width, $height) = getimagesize($pathImagesDir . $this->ViewState['LargeImage']); $value = $height; } break; case 'ViewStateSmallImageRelativePath': //Hidden Value $value = ''; if ($this->ViewState['SmallImage']) { $images_dir = $imagesUrl; $value = $images_dir . $this->ViewState['SmallImage']; } break; case 'ViewStateTypeID': $value = $this->ViewState['TypeID']; break; case 'ProductTypeID': $value = $this->product_type_id; break; case 'ProductTypeName': $product_type_desc = modApiFunc('Catalog', 'getProductType', $this->product_type_id); $value = $product_type_desc['name']; break; case 'ViewStateClose': $value = $this->ViewState['hasCloseScript']; break; case 'refreshParent': $value = ''; if (isset($this->POST['addAnother']) && $this->POST['addAnother'] == "true") { $value = "window.opener.location.reload();\n"; $value .= "window.focus();"; } break; case 'ErrorIndex': $value = $this->_error_index; break; case 'Error': $value = $this->_error; break; case 'InputStyleClass': $classes = array(); if ($this->_error != '') { $classes[] = 'error'; } if ($this->allow_html) { $classes[] = 'tiny_mce'; } $value = implode(' ', $classes); break; case 'SubmitUploadImagesScript': $value = 'onclick="if(formElementOnFocus()){CatalogAddProduct.FormSubmitValue.value = \'UploadImages\';CatalogAddProduct.submit();_disableButtons();return true;}"'; break; case 'nOnFocusMode': $value = $this->ViewState['TypeID'] == "" ? 1 : 2; break; case 'UseWYSIWYGFor': $value = array(); foreach ($this->product_type as $view_tag => $attr) { if ($attr['allow_html'] && $attr['visible']) { $value[] = $view_tag; } } $value = implode(', ', $value); break; case 'ImagesUploadErrorMessage': $value = $obj->getMessage("SETUP_WARNING_IMAGE_FOLDER_IS_NOT_WRITABLE", array("0" => modApiFunc("Catalog", "getImagesDir"))); break; case 'RequiredFieldText': $value = $obj->getMessage(new ActionMessage('REQUIRED_FIELD_LABEL')); break; case 'Breadcrumb': $obj =& $application->getInstance('Breadcrumb'); $value = $obj->output(false); break; case 'Local_ProductBookmarks': $value = getProductBookmarks('details', $this->prod_id, 'add'); break; case 'AutoGenSmallImageComment': $is_present_large_image = false; foreach ($this->_group['attr'] as $attr_info) { if ($attr_info['view_tag'] == 'LargeImage' and $attr_info['visible'] == 1) { $is_present_large_image = true; $pi_settings = modApiFunc('Product_Images', 'getSettings'); if ($pi_settings['AUTO_GEN_MAIN_SMALL_IMAGE'] == 'Y' and function_exists('gd_info')) { $value = getMsg('PI', 'COMMENT_AUTO_GEN_SMALL_IMAGE'); } } } break; case 'NoImagePath': $value = $imagesUrl . 'noimage.png'; break; default: list($entity, $tag) = getTagName($tag); if ($entity == 'product') { $value = getKeyIgnoreCase($tag, $this->POST); } elseif ($entity == 'group') { $value = getKeyIgnoreCase($tag, $this->_group); } break; } return $value; }
/** * @ describe the function ProductInfo->getTag. */ function getTag($tag) { global $application; $value = null; switch ($tag) { case 'Items': $value = $this->getAttributes(); break; case 'AttributeName': $value = $this->_attr['name']; break; case 'AttributeValue': if ($this->_attr['tag'] == 'TaxClass') { $value = prepareHTMLDisplay($this->_attr['value']); } else { $value = $this->_attr['value']; } break; case 'AttributeTag': $value = $this->_attr['tag']; break; case 'AttributeUnit': $value = $this->_attr['unit']; break; case 'AttributeImageURL': $value = $this->_attr['ImageURL']; break; case 'AttributeImageWidth': $value = $this->_attr['ImageWidth']; break; case 'AttributeImageHeight': $value = $this->_attr['ImageHeight']; break; case 'AttributeImage': $value = '<img src="' . $this->_attr['ImageURL'] . '" width="' . $this->_attr['ImageWidth'] . '" height="' . $this->_attr['ImageHeight'] . '">'; break; case 'Counter': $value = $this->_counter; break; case 'EditLink': $request = new Request(); $request->setView('Catalog_EditProduct'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $this->prod_id); $value = $request->getURL(); break; case 'Button': $request =& $application->getInstance('Request'); if ($request->getValueByKey('del_info') == "true") { $value = $this->TemplateFiller->fill("catalog/product_info/", "button_close.tpl.html", array()); } else { $value = $this->TemplateFiller->fill("catalog/product_info/", "button_edit.tpl.html", array()); } break; case 'Breadcrumb': $obj =& $application->getInstance('Breadcrumb'); $value = $obj->output(false); break; case 'Local_ProductBookmarks': $value = getProductBookmarks('details', $this->prod_id); break; case 'additionalJS': if (modApiFunc('Session', 'is_set', 'mustReloadParent')) { modApiFunc('Session', 'un_set', 'mustReloadParent'); $value = "if (window.opener && window.opener.document.ProductSearchForm && window.opener.document.ProductSearchForm.active && window.opener.document.ProductSearchForm.active.value == 'Y') window.opener.document.ProductSearchForm.submit(); else if (window.opener) window.opener.location.reload();\n"; } break; default: list($entity, $tag) = getTagName($tag); if ($entity == 'product') { $value = getKeyIgnoreCase($tag, $this->product_info); } elseif ($entity == 'group') { $value = getKeyIgnoreCase($tag, $this->_group); } break; } return $value; }
function getTag($tag) { global $application; $value = null; switch ($tag) { case 'Local_ProductBookmarks': $value = getProductBookmarks('color_swatch', $this->product_id); break; case 'CurrencySign': $value = modApiFunc("Localization", "getCurrencySign"); break; case 'Local_ProductID': $value = $this->product_id; break; case 'Local_ColorSwatchItems': $value = $this->templateFiller->fill('BlockItem'); break; case 'Local_ColorSwatchOnProductListPage': $value = $this->templateFiller->fill('ColorSwatchListContainer'); break; case 'Local_ColorSwatchOnProductListPageItems': $value = $this->templateFiller->fill('ColorSwatchListItem'); break; case 'Local_ColorSwatchNumbers': $value = modApiFunc('ColorSwatch', 'getNumberOfColors', $this->product_id); break; case 'Local_ColorSwatchLabelText': $value = modApiFunc('ColorSwatch', 'getLabelText', $this->product_id); break; case 'Local_ColorSwatchImages': $siteurl = $application->getAppIni('URL_IMAGES_DIR'); $productid = $this->product_id; $colorname = modApiFunc('ColorSwatch', 'getColorSwatchInfo', $productid); $numberofcolors = modApiFunc('ColorSwatch', 'getNumberOfColors', $productid); if (!empty($colorname)) { $colorswatchimgdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); $colorswatchimagesinfolder = scandir($colorswatchimgdir . "/avactis-images/color_swatch", 1); $checkedimagesinfolder = scandir($colorswatchimgdir . "/avactis-images/color_checked", 1); $colorimagesfldr = implode(",", $colorswatchimagesinfolder); $checkedimages = implode(",", $checkedimagesinfolder); $expcolorimagesfldr = explode(",", $colorimagesfldr); $expcolorname = explode(",", $colorname); $query = execQuery('SELECT_COLOR_SWATCH_ALL_ROWS', array('product_id' => $productid)); foreach ($query as $row) { $titlecolor = $row['name']; $indcolorname = $row['name']; if (strpos($indcolorname, ' ') !== false) { $indcolorname = str_replace(" ", "_", $indcolorname); } $mainimage = $row['main_image']; $checkedimagetag = $row['checked_image']; $expmainimage = explode("'", $mainimage); $expcheckedimg = explode("'", $checkedimagetag); $mainimgsrc = isset($expmainimage[1]) ? $expmainimage[1] : NULL; $checkedimgsrc = isset($expcheckedimg[1]) ? $expcheckedimg[1] : NULL; $value .= "<img style='cursor:pointer;margin-right: -2px;border:none !important;' title='{$titlecolor}' id='" . $indcolorname . "_" . $productid . "' src='{$mainimage}' /> "; $value .= '<script type="text/javascript"> jQuery(document).ready(function($){ $("#colorsw_' . $productid . ' img").click(function(){ var idval = $(this).attr("id"); if((idval == "' . $indcolorname . "_" . $productid . '")) { $("#' . $indcolorname . "_" . $productid . '").attr("disabled","disabled"); $("#' . $indcolorname . "_" . $productid . '").after("<span id=\\"checkedimg_' . $indcolorname . "_" . $productid . '\\" style=\\"display:inline; cursor:pointer; margin-left: -25px; margin-top: 6px;position: absolute; \\" ><img class=\\"chimg\\" src=\\"' . $siteurl . 'color_checked/checkmark.png\\"></span>"); if(($(".chimg:visible").length) > ' . $numberofcolors . ') { $("#checkedimg_' . $indcolorname . "_" . $productid . '").css("display","none"); $("#checkedimg_' . $indcolorname . "_" . $productid . '").removeAttr("disabled"); $("#' . $indcolorname . "_" . $productid . '").removeAttr("disabled"); $("#colsw_msg").css("display","block"); $("#colsw_msg").text("*You can only choose ' . $numberofcolors . ' color(s)."); } else{ $("#colsw_msg").css("display","none"); } // Start title if(($("#' . $indcolorname . "_" . $productid . '").attr("disabled")) == "disabled") { var colortitle = $(this).attr("title"); var currentname = $("#colorname").val(); if(currentname == "") { currentname = colortitle; } else { currentname = currentname + "," + colortitle; } currentname = currentname.replace(",,",","); $("#colorname").attr("value", currentname); colortitle =""; } // End title } $("#checkedimg_' . $indcolorname . "_" . $productid . '").click(function(){ if($("#checkedimg_' . $indcolorname . "_" . $productid . '").is(":visible")) { $("#checkedimg_' . $indcolorname . "_" . $productid . '").css("display","none"); $("#checkedimg_' . $indcolorname . "_" . $productid . '").attr("disabled","false"); $("#' . $indcolorname . "_" . $productid . '").attr("disabled","false"); var colortitle = $("#' . $indcolorname . "_" . $productid . '").attr("title"); var currentname = $("#colorname").val(); currentname = currentname.replace(colortitle + "," , ""); currentname = currentname.replace(","+colortitle , ""); currentname = currentname.replace(colortitle , ""); currentname = currentname.replace(",,", ","); $("#colorname").attr("value", currentname); } }); }); }); </script>'; } } break; case 'Local_ColorSwatchImagesProductList': $siteurl = $application->getAppIni('URL_IMAGES_DIR'); $productid = $this->product_id; $colorname = modApiFunc('ColorSwatch', 'getColorSwatchInfo', $productid); $numberofcolors = modApiFunc('ColorSwatch', 'getNumberOfColors', $productid); if (!empty($colorname)) { $colorswatchimgdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); $colorswatchimagesinfolder = scandir($colorswatchimgdir . "/avactis-images/color_swatch", 1); $checkedimagesinfolder = scandir($colorswatchimgdir . "/avactis-images/color_checked", 1); $colorimagesfldr = implode(",", $colorswatchimagesinfolder); $checkedimages = implode(",", $checkedimagesinfolder); $expcolorimagesfldr = explode(",", $colorimagesfldr); $expcolorname = explode(",", $colorname); $query = execQuery('SELECT_COLOR_SWATCH_ALL_ROWS', array('product_id' => $productid)); foreach ($query as $row) { $indcolorname = $row['name']; $mainimage = $row['main_image']; $checkedimagetag = $row['checked_image']; $expmainimage = explode("'", $mainimage); $expcheckedimg = explode("'", $checkedimagetag); $mainimgsrc = isset($expmainimage[1]) ? $expmainimage[1] : NULL; $checkedimgsrc = isset($expcheckedimg[1]) ? $expcheckedimg[1] : NULL; $value .= "<img class='prdswtchimg' style='margin-right: -2px;border:none !important;' title='{$indcolorname}' id='" . $indcolorname . "_" . $productid . "' src='{$mainimage}' /> "; } } break; } return $value; }
/** * @ describe the function EditProductInfo->getTag. */ function getTag($tag) { global $application; $imagesUrl = $application->getAppIni('URL_IMAGES_DIR'); if ($application->getCurrentProtocol() == "https" && $application->getAppIni('HTTPS_URL_IMAGES_DIR')) { $imagesUrl = $application->getAppIni('HTTPS_URL_IMAGES_DIR'); } $value = null; switch ($tag) { case 'Items': $value = $this->getAttributes(); break; case 'InvEditorLink': $value = isset($this->_attr['InvEditorLink']) ? $this->_attr['InvEditorLink'] : ''; break; case 'Errors': $value = $this->getErrors(); break; case "Error_List": $value = $this->_error_list; break; case 'AttributeName': $value = $this->_attr['name']; break; case 'AttributeValue': $value = $this->_attr['value']; break; case 'AttributeValueEscaped': $value = $this->_attr['value_escaped']; break; case 'AttributeTag': $value = $this->_attr['tag']; break; case 'AttributeUnit': $value = $this->_attr['unit']; break; case 'AttributePatternType': $value = $this->_attr['pattern_type']; break; case 'AttributeFormat': $value = modApiFunc("Localization", "format_settings_for_js", $this->_attr['pattern_type']); break; case 'AttributeImageURL': // there appears a bug if this string is used - // $this->_attr['ImageURL']; $value = $imagesUrl . $this->ViewState['LargeImage']; break; case 'AttributeImageWidth': $value = $this->_attr['ImageWidth']; break; case 'AttributeImageHeight': $value = $this->_attr['ImageHeight']; break; case 'AttributeSize': $value = $this->_attr['size']; break; case 'AttributeMax': $value = $this->_attr['max']; break; case 'Counter': $value = $this->_counter; break; case 'AttributeSelectOptions': $value = ""; foreach ($this->_attr_options as $opt_value) { $this->_attr_option = $opt_value; $value .= $this->TemplateFiller->fill("catalog/product_edit/", "attr-select-option.tpl.html", array()); } break; case 'AttributeCheckboxes': $value = ""; foreach ($this->_attr_options as $opt_value) { $this->_attr_option = $opt_value; $value .= $this->TemplateFiller->fill("catalog/product_edit/", "attr-checkboxgroup-item.tpl.html", array()); } break; case 'AttributeNextCheckboxColumn': $value = $this->_attr_option['next_column']; break; case 'AttributeCheckedCheckbox': $value = $this->_attr_option['checked']; break; case 'AttributeDisabledCheckbox': $value = $this->_attr_option['disabled']; break; case 'AttributeWorldVisible': $value = @$this->_attr_option['world']; break; case 'AttributeCustomVisible': $value = @$this->_attr_option['custom']; break; case 'AttributeOptionValue': $value = $this->_attr_option['value']; break; case 'AttributeOptionSelected': if ($this->_attr_option['selected']) { $value = " selected"; } break; case 'AttributeOptionName': $name = $this->_attr_option['name']; $value = $this->_attr['tag'] != 'MembershipVisibility' ? prepareHTMLDisplay($name) : $name; break; case 'AddLink': $value = isset($this->_attr['additional_link']) ? $this->_attr['additional_link'] : ""; break; case 'AddLinkText': $value = isset($this->_attr['additional_link_text']) ? $this->_attr['additional_link_text'] : ""; break; case 'ViewStateLargeImage': $value = ''; if ($this->ViewState['LargeImage']) { $value = $imagesUrl . $this->ViewState['LargeImage']; } break; case 'ViewStateLargeImageWidth': $value = ''; if ($this->ViewState['LargeImage']) { $image_path = $application->getAppIni('PATH_IMAGES_DIR') . $this->ViewState['LargeImage']; $sizes = getimagesize($image_path); $value = $sizes[0]; } break; case 'ViewStateLargeImageHeight': $value = ''; if ($this->ViewState['LargeImage']) { $image_path = $application->getAppIni('PATH_IMAGES_DIR') . $this->ViewState['LargeImage']; $sizes = getimagesize($image_path); $value = $sizes[1]; } break; case 'ViewStateSmallImage': $value = ''; if ($this->ViewState['SmallImage']) { $value = $imagesUrl . $this->ViewState['SmallImage']; } break; case 'ViewStateSmallImageRelativePath': //Hidden Value $value = ''; if ($this->ViewState['SmallImage']) { $value = $imagesUrl . $this->ViewState['SmallImage']; } break; case 'ViewStateClose': $value = $this->ViewState['hasCloseScript']; break; case 'ErrorIndex': $value = $this->_error_index; break; case 'Error': $value = $this->_error; break; case 'SavedOkMessage': $value = $this->getSavedOkMessage(); break; case 'InputStyleClass': $classes = array(); if ($this->_error != '') { $classes[] = 'error'; } if ($this->allow_html) { $classes[] = 'tiny_mce'; } $value = implode(' ', $classes); break; case 'SubmitUploadImagesScript': $value = 'onclick="CatalogEditProduct.FormSubmitValue.value = \'UploadImages\';CatalogEditProduct.submit();disableButtons(new Array(\'SaveButton1\', \'SaveButton2\', \'CancelButton1\', \'CancelButton2\', \'UploadButton\'));return true;"'; break; case 'ImagesUploadErrorMessage': $value = $this->MessageResources->getMessage("SETUP_WARNING_IMAGE_FOLDER_IS_NOT_WRITABLE", array("0" => modApiFunc("Catalog", "getImagesDir"))); break; case 'UseWYSIWYGFor': $value = array(); foreach ($this->product_info['attributes'] as $view_tag => $attr) { // , PriceExcludingTaxes. if (isset($attr['allow_html'])) { if ($attr['allow_html'] && $attr['visible']) { $value[] = $view_tag; } } } $value = implode(', ', $value); break; case 'Breadcrumb': $obj =& $application->getInstance('Breadcrumb'); $value = $obj->output(false); break; case 'Local_ProductBookmarks': $value = getProductBookmarks('details', $this->prod_id, 'edit'); break; case 'CancelLink': $req = new Request(); $req->setView('Catalog_ProdInfo'); $req->setAction('SetCurrentProduct'); $req->setKey('prod_id', $this->prod_id); $value = $req->getURL(); break; case 'additionalJS': if (modApiFunc('Session', 'is_set', 'mustReloadParent')) { modApiFunc('Session', 'un_set', 'mustReloadParent'); $value = "if (window.opener && window.opener.document.ProductSearchForm && window.opener.document.ProductSearchForm.active && window.opener.document.ProductSearchForm.active.value == 'Y') window.opener.document.ProductSearchForm.submit(); else if (window.opener) window.opener.location.reload();\n"; } break; /*( case 'AutoGenSmallImageComment': $is_present_large_image = false; foreach($this->_group['attr'] as $attr_info) { if($attr_info['view_tag'] == 'LargeImage' and $attr_info['visible'] == 1) { $is_present_large_image = true; }; }; if($this->_attr['tag'] == 'SmallImage' and $is_present_large_image and $this->ViewState['LargeImage'] == '') { $pi_settings = modApiFunc('Product_Images','getSettings'); if($pi_settings['AUTO_GEN_MAIN_SMALL_IMAGE'] == 'Y' and function_exists('gd_info')) { $value = getMsg('PI','COMMENT_AUTO_GEN_SMALL_IMAGE'); }; }; */ /*( case 'AutoGenSmallImageComment': $is_present_large_image = false; foreach($this->_group['attr'] as $attr_info) { if($attr_info['view_tag'] == 'LargeImage' and $attr_info['visible'] == 1) { $is_present_large_image = true; }; }; if($this->_attr['tag'] == 'SmallImage' and $is_present_large_image and $this->ViewState['LargeImage'] == '') { $pi_settings = modApiFunc('Product_Images','getSettings'); if($pi_settings['AUTO_GEN_MAIN_SMALL_IMAGE'] == 'Y' and function_exists('gd_info')) { $value = getMsg('PI','COMMENT_AUTO_GEN_SMALL_IMAGE'); }; }; */ case 'AutoGenSmallImageComment': $is_present_large_image = false; foreach ($this->_group['attr'] as $attr_info) { if ($attr_info['view_tag'] == 'LargeImage' && $attr_info['visible'] == 1) { $is_present_large_image = true; $pi_settings = modApiFunc('Product_Images', 'getSettings'); if ($pi_settings['AUTO_GEN_MAIN_SMALL_IMAGE'] == 'Y' && function_exists('gd_info')) { $value = getMsg('PI', 'COMMENT_AUTO_GEN_SMALL_IMAGE'); } } } break; case 'ResultMessageRow': $value = $this->outputResultMessage(); break; case 'ResultMessage': $value = $this->_Template_Contents[$tag]; break; case 'ProductInfoLink': $cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list(); LayoutConfigurationManager::static_activate_cz_layout(array_shift(array_keys($cz_layouts))); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $this->prod_id); $request->setProductID($this->prod_id); $value = $request->getURL(); break; case 'NoImagePath': $value = $imagesUrl . 'noimage.png'; break; default: if (_ml_strpos($tag, 'Product') === 0) { // $tag = preg_replace('/_/', '', $tag); // $tag = preg_replace('/([A-Z]{1,})/', '_$1', $tag); // $arr = preg_split('/_/', $tag, -1, PREG_SPLIT_NO_EMPTY); // $entity = _ml_strtolower(array_shift($arr)); // $tag = implode('', $arr); $tag = _ml_substr($tag, _ml_strlen('Product')); if (array_key_exists($tag, $this->POST)) { $value = $this->POST[$tag]; } } if (_ml_strpos($tag, 'Group') === 0) { // $tag = preg_replace('/_/', '', $tag); // $tag = preg_replace('/([A-Z]{1,})/', '_$1', $tag); // $arr = preg_split('/_/', $tag, -1, PREG_SPLIT_NO_EMPTY); // $entity = _ml_strtolower(array_shift($arr)); // $tag = _ml_strtolower(implode('', $arr)); $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('Group'))); if (array_key_exists($tag, $this->_group)) { $value = $this->_group[$tag]; } } break; } return $value; }