function getTag($tag) { global $application; switch ($tag) { 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->POST["product_id"]); $request->setProductID($this->POST["product_id"]); $value = $request->getURL(); break; case "ErrorIndex": $value = $this->_error_index; break; case "Error": $value = $this->_error; break; default: $value = getKeyIgnoreCase($tag, $this->_Template_Contents); if ($value === NULL) { $value = getKeyIgnoreCase($tag, $this->_Rate); } break; } return $value; }
function getTag($tag) { if ($tag == '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->product_id); $request->setProductID($this->product_id); return $request->getURL(); } return getKeyIgnoreCase($tag, $this->_Template_Contents); }
/** * @ 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; }