function outputCZLayoutHTTPSSettings() { global $application; //1. Layout- CZ FS. //2. Layout- CZ . //3. 2 1, // . //4. 2. . $layouts_from_fs = LayoutConfigurationManager::static_get_cz_layouts_list(); $layouts_from_bd = modApiFunc("Configuration", "getLayoutSettings"); foreach ($layouts_from_fs as $fname => $info) { if (!array_key_exists($fname, $layouts_from_bd)) { execQuery('INSERT_LAYOUT_HTTPS_SETTINGS', array('layout_full_file_name' => $fname)); } } $layouts_from_bd = modApiFunc("Configuration", "getLayoutSettings"); if (sizeof($layouts_from_bd) > 0) { $CZHTTPSLayouts = ""; foreach ($layouts_from_bd as $fname => $info) { $config = LayoutConfigurationManager::static_parse_layout_config_file($fname); if (!empty($config)) { $this->_Template_Contents['CZHTTPSLayoutId'] = $info['id']; //CZHTTPSLayouts //CZHTTPSLayoutSections $map = modApiFunc("Configuration", "getLayoutSettingNameByCZLayoutSectionNameMap"); $CZHTTPSLayoutSections = ""; $checked_sections = array(); foreach ($info as $key => $value) { if (in_array($key, $map)) { // $this->_Template_Contents['_hinttext'] = gethinttext('HTTPS_FIELD_' . $key); $this->_Template_Contents['CZHTTPSSectionName'] = getMsg('CFG', 'HTTPS_KEY_NAME_' . $key); $this->_Template_Contents['CZHTTPSSectionKey'] = $key; $this->_Template_Contents['CZHTTPSSectionValue'] = $value == DB_TRUE ? " CHECKED " : ""; if ($value == DB_TRUE) { $checked_sections[] = $key; } $application->registerAttributes($this->_Template_Contents); $CZHTTPSLayoutSections .= modApiFunc('TmplFiller', 'fill', "configuration/cz_https/", "section.tpl.html", array()); } } $this->_Template_Contents['CZHTTPSLayoutFileName'] = $fname; $this->_Template_Contents['CZHTTPSLayoutURL'] = $config['SITE_URL']; $this->_Template_Contents['CZHTTPSLayoutId'] = $info['id']; $this->_Template_Contents['CZHTTPSLayoutSections'] = $CZHTTPSLayoutSections; $this->_Template_Contents['CZHTTPSLayoutCheckedSections'] = implode('|', $checked_sections); $application->registerAttributes($this->_Template_Contents); $CZHTTPSLayouts .= modApiFunc('TmplFiller', 'fill', "configuration/cz_https/", "item.tpl.html", array()); } } $this->_Template_Contents['CZHTTPSLayouts'] = $CZHTTPSLayouts; $application->registerAttributes($this->_Template_Contents); return modApiFunc('TmplFiller', 'fill', "configuration/cz_https/", "container.tpl.html", array()); } else { // : layout . return modApiFunc('TmplFiller', 'fill', "configuration/cz_https/", "container-empty.tpl.html", array()); } }
function MR_Settings() { loadCoreFile('html_form.php'); if (modApiFunc('Session', 'is_set', 'MR_sets')) { $this->mr_settings = modApiFunc('Session', 'get', 'MR_sets'); modApiFunc('Session', 'un_set', 'MR_sets'); } else { $this->mr_settings = modApiFunc('Mod_Rewrite', 'getSettings'); } $this->cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list(); $this->_form_disabled = true; }
function outputStorefrontLinks() { $html_code = ""; $config_array = LayoutConfigurationManager::static_get_cz_layouts_list(); if (sizeof($config_array) > 0) { $i = 1; foreach ($config_array as $layout_config_ini_path => $config) { $layout_config_ini_path = str_replace('//', '/', $layout_config_ini_path); $html_code .= '<input style="margin: 1px;" name="storefront_link" type="radio" value="' . $layout_config_ini_path . '" ' . ($i == 1 ? 'checked' : '') . '> <A HREF="' . $config['SITE_URL'] . '" target="_blank" style="font-size: 10pt; color: blue;">' . $config['SITE_URL'] . '</A><br>'; $i++; } } else { $html_code .= '<span style="color: red;">' . getMsg('FRG', 'FG_WRN_NOT_FOUND_STOREFRONTS') . '</span>'; } return $html_code; }
function output() { global $application; $this->_messageResources =& Subscriptions::getMessageResources(); $this->_tmplFiller = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/'); $this->initFormData(); if ($this->ViewState['hasCloseScript'] == 'true') { modApiFunc('application', 'closeChild'); return; } $config_array = LayoutConfigurationManager::static_get_cz_layouts_list(); $config = reset($config_array); $url = $config['SITE_URL'] . 'unsubscribe.php?key=%KEY_UNSUBSCRIBE%'; $signature = modApiFunc('Configuration', 'getValue', SYSCONFIG_NEWSLETTERS_SIGNATURE); $vars = array('FormAction' => $this->urlSaveSignature(), 'SignatureHtml' => htmlspecialchars($signature), 'TipUnsubscribe' => getMsg('SUBSCR', 'TIP_SIGNATURE', $url)); $retval = $this->_tmplFiller->fill('', 'signature.tpl.html', $vars); return $retval; }
function outputLayoutConfigs() { global $application; $retval = ""; $config_array = LayoutConfigurationManager::static_get_cz_layouts_list(); if (sizeof($config_array) > 0) { $i = 1; foreach ($config_array as $layout_config_ini_path => $config) { LayoutConfigurationManager::static_activate_cz_layout($layout_config_ini_path); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', "1"); $template_contents = array("LayoutN" => $i, "LayoutName" => $config["SITE_URL"], "CZStorefrontHref" => $config["SITE_URL"], "CZStorefrontProductInfoHref" => $request->getURL()); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $retval .= modApiFunc('TmplFiller', 'fill', "tools/cz_layouts/", "layout_config_item.tpl.html", array()); $i++; } } else { $retval .= modApiFunc('TmplFiller', 'fill', "tools/cz_layouts/", "layout_config_no_item.tpl.html", array()); } return $retval; }
function getSystemPageList() { global $application; $result = array(); // getting the list of sections if (!isset($application->Configs_array['Layouts'])) { LayoutConfigurationManager::static_get_cz_layouts_list(); } if (is_array($application->Configs_array['Layouts'])) { foreach ($application->Configs_array['Layouts'] as $k => $v) { if ($k != 'Site' && $k != 'Templates') { $result[] = $k; } } } return $result; }
function getTag($tag) { global $application; $value = null; switch ($tag) { case 'GSOnline': $this->_input_control = array('name' => SYSCONFIG_STORE_ONLINE, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ONLINE), 'options' => array('1' => $this->MessageResources->getMessage("GNRL_SET_ONLINE_LABEL"), '0' => $this->MessageResources->getMessage("GNRL_SET_CLOSED_LABEL"))); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSOfflineKey': $this->_input_control = array('name' => SYSCONFIG_STORE_OFFLINE_KEY, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_OFFLINE_KEY), 'size' => 20, 'event' => "id=\"store_offline_key\" onkeyup=\"javascript: showOfflineKey(this);\" onfocus=\"javascript: showOfflineKey(this);\""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case "GSStoreURL": $i = 0; $value = ""; $config_array = LayoutConfigurationManager::static_get_cz_layouts_list(); foreach ($config_array as $k => $v) { $value .= " url[{$i}] = \"" . $v["SITE_URL"] . "index.php?\" + key;\n"; $i++; } $value = " i={$i};\n" . $value; break; case 'GSTime': $value = modApiFunc("Localization", "timestamp_time_format", time()) . ", " . modApiFunc("Localization", "timestamp_date_format", time()); break; case 'GSTimeShift': $hours = array(); for ($h = -24; $h <= 24; $h++) { $hours[$h] = $h; } $this->_input_control = array('name' => SYSCONFIG_STORE_TIME_SHIFT, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_TIME_SHIFT), 'options' => $hours); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSSignCount': $SignInCount = modApiFunc("Users", "getIncorrectLoginTimeCountArray"); $this->_input_control = array('name' => SYSCONFIG_STORE_SIGNIN_COUNT, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_SIGNIN_COUNT), 'options' => $SignInCount); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSSignTimeout': $Timeout = modApiFunc("Users", "getLoginBlockTimeArray"); $this->_input_control = array('name' => SYSCONFIG_STORE_SIGNIN_TIMEOUT, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_SIGNIN_TIMEOUT), 'options' => $Timeout); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSShowAbsent': $current = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_SHOW_ABSENT); $this->_input_control = array('name' => SYSCONFIG_STORE_SHOW_ABSENT, 'value' => STORE_SHOW_ABSENT_SHOW_BUY, 'label' => $this->MessageResources->getMessage("GNRL_SET_SHOW_ABSENT_SHOW_BUY_LABEL"), 'checked' => $current == STORE_SHOW_ABSENT_SHOW_BUY); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "radio-box.tpl.html", array()); $this->_input_control = array('name' => SYSCONFIG_STORE_SHOW_ABSENT, 'value' => STORE_SHOW_ABSENT_SHOW_NOT_BUY, 'label' => $this->MessageResources->getMessage("GNRL_SET_SHOW_ABSENT_SHOW_NOT_BUY_LABEL"), 'checked' => $current == STORE_SHOW_ABSENT_SHOW_NOT_BUY); $value .= modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "radio-box.tpl.html", array()); $this->_input_control = array('name' => SYSCONFIG_STORE_SHOW_ABSENT, 'value' => STORE_SHOW_ABSENT_NOT_SHOW_NOT_BUY, 'label' => $this->MessageResources->getMessage("GNRL_SET_SHOW_ABSENT_NOT_SHOW_NOT_BUY_LABEL"), 'checked' => $current == STORE_SHOW_ABSENT_NOT_SHOW_NOT_BUY); $value .= modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "radio-box.tpl.html", array()); break; case 'GSAllowBuyMoreThanStock': $this->_input_control = array('name' => SYSCONFIG_STORE_ALLOW_BUY_MORE_THAN_STOCK, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ALLOW_BUY_MORE_THAN_STOCK), 'options' => array('1' => $this->MessageResources->getMessage("GNRL_SET_YES_LABEL"), '0' => $this->MessageResources->getMessage("GNRL_SET_NO_LABEL"))); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case "GSReturnProductToStockOrderDeleted": $this->_input_control = array('name' => SYSCONFIG_STORE_RETURN_PRODUCT_TO_STOCK_ORDER_DELETED, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_RETURN_PRODUCT_TO_STOCK_ORDER_DELETED), 'options' => array('1' => $this->MessageResources->getMessage("GNRL_SET_YES_LABEL"), '0' => $this->MessageResources->getMessage("GNRL_SET_NO_LABEL"))); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case "GSReturnProductToStockOrderCancelled": $this->_input_control = array('name' => SYSCONFIG_STORE_RETURN_PRODUCT_TO_STOCK_ORDER_CANCELLED, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_RETURN_PRODUCT_TO_STOCK_ORDER_CANCELLED), 'options' => array('1' => $this->MessageResources->getMessage("GNRL_SET_YES_LABEL"), '0' => $this->MessageResources->getMessage("GNRL_SET_NO_LABEL"))); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case "GSEnableWishList": $this->_input_control = array('name' => SYSCONFIG_STORE_ENABLE_WISHLIST, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ENABLE_WISHLIST), 'options' => array('1' => $this->MessageResources->getMessage("GNRL_SET_YES_LABEL"), '0' => $this->MessageResources->getMessage("GNRL_SET_NO_LABEL"))); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSShowCart': $current = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_SHOW_CART); $this->_input_control = array('name' => SYSCONFIG_STORE_SHOW_CART, 'value' => 1, 'label' => $this->MessageResources->getMessage("GNRL_SET_ENABLED_LABEL"), 'checked' => $current); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "radio-box.tpl.html", array()); $this->_input_control = array('name' => SYSCONFIG_STORE_SHOW_CART, 'value' => 0, 'label' => $this->MessageResources->getMessage("GNRL_SET_DISABLED_LABEL"), 'checked' => !$current); $value .= modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "radio-box.tpl.html", array()); break; case 'GSMinSubtotalToCheckout': $this->_input_control = array('name' => SYSCONFIG_MIN_SUBTOTAL_TO_BEGIN_CHECKOUT, 'value' => modApiFunc("Localization", "FloatToFormatStr", modApiFunc('Configuration', 'getValue', SYSCONFIG_MIN_SUBTOTAL_TO_BEGIN_CHECKOUT), "currency"), 'size' => 10, 'event' => modApiFunc("Localization", "format_settings_for_js", "currency") . " onblur=\"formatInput(this);\" patterntype=\"currency\""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'GSPaginatorPagesPerLineAZ': case 'GSPaginatorPagesPerLineCZ': if ($tag == 'GSPaginatorPagesPerLineAZ') { $const_pages_per_line = SYSCONFIG_STORE_PAGINATOR_PAGES_PER_LINE_AZ; } else { $const_pages_per_line = SYSCONFIG_STORE_PAGINATOR_PAGES_PER_LINE_CZ; } $this->_input_control = array('name' => $const_pages_per_line, 'value' => modApiFunc('Configuration', 'getValue', $const_pages_per_line), 'size' => 5, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'GSPaginatorDefaultRowsPerPageAZ': case 'GSPaginatorDefaultRowsPerPageCZ': if ($tag == 'GSPaginatorDefaultRowsPerPageAZ') { $const_rows_per_page = SYSCONFIG_STORE_PAGINATOR_DEFAULT_ROWS_PER_PAGE_AZ; $const_rows_per_page_values = SYSCONFIG_STORE_PAGINATOR_ROWS_PER_PAGE_VALUES_AZ; } else { $const_rows_per_page = SYSCONFIG_STORE_PAGINATOR_DEFAULT_ROWS_PER_PAGE_CZ; $const_rows_per_page_values = SYSCONFIG_STORE_PAGINATOR_ROWS_PER_PAGE_VALUES_CZ; } $rows_per_page_values = unserialize(modApiFunc('Configuration', 'getValue', $const_rows_per_page_values)); $rows_per_page_array = array(); foreach ($rows_per_page_values as $val) { $rows_per_page_array[$val] = $val; } $this->_input_control = array('name' => $const_rows_per_page, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', $const_rows_per_page), 'options' => $rows_per_page_array); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSPaginatorRowsPerPageValuesAZ': case 'GSPaginatorRowsPerPageValuesCZ': if ($tag == 'GSPaginatorRowsPerPageValuesAZ') { $const_rows_per_page = SYSCONFIG_STORE_PAGINATOR_DEFAULT_ROWS_PER_PAGE_AZ; $const_rows_per_page_values = SYSCONFIG_STORE_PAGINATOR_ROWS_PER_PAGE_VALUES_AZ; } else { $const_rows_per_page = SYSCONFIG_STORE_PAGINATOR_DEFAULT_ROWS_PER_PAGE_CZ; $const_rows_per_page_values = SYSCONFIG_STORE_PAGINATOR_ROWS_PER_PAGE_VALUES_CZ; } $rows_per_page_values = unserialize(modApiFunc('Configuration', 'getValue', $const_rows_per_page_values)); $rows_per_page_array = array(); foreach ($rows_per_page_values as $val) { $rows_per_page_array[$val] = $val; } $this->_input_control = array('name' => $const_rows_per_page_values, 'size' => sizeof($rows_per_page_array) > 3 ? sizeof($rows_per_page_array) : 3, 'selected' => "", 'options' => $rows_per_page_array, 'value' => implode("|", $rows_per_page_array), 'dependent_cntrol' => $const_rows_per_page); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box-and-text-field.tpl.html", array()); break; case 'GSAddToCartDefaultQuantity': $this->_input_control = array('name' => SYSCONFIG_STORE_ADD_TO_CART_DEFAULT_QUANTITY, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ADD_TO_CART_DEFAULT_QUANTITY), 'size' => 5, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'GSAddToCartMaxQuantity': $this->_input_control = array('name' => SYSCONFIG_STORE_ADD_TO_CART_MAX_QUANTITY, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ADD_TO_CART_MAX_QUANTITY), 'size' => 5, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'GSAddToCartLimitMaxQuantityByStock': $this->_input_control = array('name' => SYSCONFIG_STORE_ADD_TO_CART_LIMIT_MAX_QUANTITY_BY_STOCK, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ADD_TO_CART_LIMIT_MAX_QUANTITY_BY_STOCK), 'options' => array('1' => $this->MessageResources->getMessage("GNRL_SET_YES_LABEL"), '0' => $this->MessageResources->getMessage("GNRL_SET_NO_LABEL"))); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSAddToCartAddNotReplace': $this->_input_control = array('name' => SYSCONFIG_STORE_ADD_TO_CART_ADD_NOT_REPLACE, 'size' => 1, 'selected' => modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ADD_TO_CART_ADD_NOT_REPLACE), 'options' => array('1' => $this->MessageResources->getMessage("GNRL_SET_FIELD_017_ADD"), '0' => $this->MessageResources->getMessage("GNRL_SET_FIELD_017_REPLACE"))); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "select-box.tpl.html", array()); break; case 'GSNextOrderId': $this->_input_control = array('name' => SYSCONFIG_STORE_NEXT_ORDER_ID, 'value' => modApiFunc('Checkout', 'getNextOrderId'), 'size' => 10, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'InputControlName': $value = $this->_input_control['name']; break; case 'InputControlValue': $value = $this->_input_control['value']; break; case 'InputControlLabel': $value = $this->_input_control['label']; break; case 'InputControlSize': $value = $this->_input_control['size']; break; case 'InputControlChecked': $value = $this->_input_control['checked'] ? " checked" : ""; break; case 'ElementEvent': $value = isset($this->_input_control['event']) ? $this->_input_control['event'] : ""; break; case 'DependentControl': $value = isset($this->_input_control['dependent_cntrol']) ? $this->_input_control['dependent_cntrol'] : ""; break; case 'InputControlOptions': $value = ""; foreach ($this->_input_control['options'] as $key => $label) { $selected = ""; if (isset($this->_input_control['selected']) && $this->_input_control['selected'] == $key) { $selected = " selected"; } $value .= "<option value=\"{$key}\"{$selected}>{$label}</option>"; } break; //================== related products =============================== //================== related products =============================== case 'RPperLine': $this->_input_control = array('name' => SYSCONFIG_RP_PER_LINE, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_RP_PER_LINE), 'size' => 10, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'RP_RandomCheckbox': $checked = modApiFunc('Configuration', 'getValue', SYSCONFIG_RP_RANDOM_CHECKBOX); $this->_input_control = array('name' => SYSCONFIG_RP_RANDOM_CHECKBOX, 'checked' => $checked, 'value' => 'on', 'label' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "check-box.tpl.html", array()); break; case 'RP_RandomThreshold': $this->_input_control = array('name' => SYSCONFIG_RP_RANDOM_THRESHOLD, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_RP_RANDOM_THRESHOLD), 'size' => 6, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; //================== related products =============================== //================== featured products =============================== //================== related products =============================== //================== featured products =============================== case 'FPperLine': $this->_input_control = array('name' => SYSCONFIG_FP_PER_LINE, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_FP_PER_LINE), 'size' => 10, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'FP_RandomCheckbox': $checked = modApiFunc('Configuration', 'getValue', SYSCONFIG_FP_RANDOM_CHECKBOX); $this->_input_control = array('name' => SYSCONFIG_FP_RANDOM_CHECKBOX, 'checked' => $checked, 'value' => 'on', 'label' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "check-box.tpl.html", array()); break; case 'FP_RandomThreshold': $this->_input_control = array('name' => SYSCONFIG_FP_RANDOM_THRESHOLD, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_FP_RANDOM_THRESHOLD), 'size' => 6, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; //================== featured products =============================== //================== bestsellers =============================== //================== featured products =============================== //================== bestsellers =============================== case 'BSperLine': $this->_input_control = array('name' => SYSCONFIG_BS_PER_LINE, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_BS_PER_LINE), 'size' => 10, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; case 'BS_RandomCheckbox': $checked = modApiFunc('Configuration', 'getValue', SYSCONFIG_BS_RANDOM_CHECKBOX); $this->_input_control = array('name' => SYSCONFIG_BS_RANDOM_CHECKBOX, 'checked' => $checked, 'value' => 'on', 'label' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "check-box.tpl.html", array()); break; case 'BS_RandomThreshold': $this->_input_control = array('name' => SYSCONFIG_BS_RANDOM_THRESHOLD, 'value' => modApiFunc('Configuration', 'getValue', SYSCONFIG_BS_RANDOM_THRESHOLD), 'size' => 6, 'event' => ""); $value = modApiFunc('TmplFiller', 'fill', "configuration/general_settings/", "text-field.tpl.html", array()); break; //================== bestsellers =============================== //================== bestsellers =============================== case 'ResultMessageRow': $value = $this->outputResultMessage(); break; case 'ResultMessage': $value = $this->_Template_Contents['ResultMessage']; break; //================== errors =============================== //================== errors =============================== case 'FormErrors': $value = $this->getErrors(); break; case 'ErrorIndex': $value = $this->_error_index; break; case 'Error': $value = $this->_error; break; default: break; } return $value; }
| ============================================= | This source code is released under the Avactis License Agreement. | The latest version of this license can be found here: | http://www.avactis.com/license.php | | By using this software, you acknowledge having read this license agreement | and agree to be bound thereby. | ***********************************************************************/ ?> <!-- header --> <?php $admin_info = modApiFunc("Users", "getUserInfo", modApiFunc("Users", "getCurrentUserID")); $store_status = (bool) (!modApiFunc("Configuration", "getValue", "store_online")); $storefront_list = array(); $config_array = LayoutConfigurationManager::static_get_cz_layouts_list(); $timeline = modApiFunc('Timeline', 'getTimelineRecsCount'); $timeline = $timeline == 0 ? getMsg("SYS", "ADMIN_PHP_FILES_NO_LOG_RECORDS") : $timeline . getMsg("SYS", "ADMIN_PHP_FILES_LOG_RECORDS"); foreach ($config_array as $k => $v) { if (preg_match('/^.*\\.ini$/', $v['PATH_LAYOUTS_CONFIG_FILE'])) { $storefront_list[] = $v['SITE_URL']; } } ?> <SCRIPT LANGUAGE="JavaScript"> <!-- function clearInstance(instance) { jQuery('#i-'+instance).html('<img src="images/ajax/snake.gif">'); jQuery.post('jquery_ajax_handler.php',
function doWork($data) { $str = new CString(); foreach ($data as $i => $product) { $product_info = $product; $prodObj = new CProductInfo($product_info["ProductID"]); /* if($prodObj->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA) == PRODUCT_STATUS_OFFLINE) continue; $cats = $product_info["ProductAllCategoryPath"]; if(!empty($cats) && is_array($cats) && !empty($cats[0]) && is_array($cats[0])) { foreach($cats[0] as $cat) { $objCurrentCat = new CCategoryInfo($cat["id"]); if($objCurrentCat->getCategoryTagValue('RecursiveStatus')==CATEGORY_STATUS_OFFLINE) continue 2; } } */ $product_entry = array(); // Availablity if ($prodObj->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA) == PRODUCT_STATUS_OFFLINE) { $product_entry[] = FG_GOOGLE_PRODUCT_STATUS_OUT_OF_STOCK; } else { $product_entry[] = FG_GOOGLE_PRODUCT_STATUS_IN_STOCK; } // id $product_entry[] = $product_info["ProductID"]; $product_entry[] = $product_info["ProductTypeName"]; // product_type // we have to delete ";"-symbol, as Google Base treats it as a delimiter if (!empty($product_info["ProductCategoryPath"])) { $categories = array(); foreach ($product_info["ProductCategoryPath"] as $cat) { $categories[] = $this->sterilizeTextField($cat["name"]); } array_shift($categories); $product_entry[] = implode(", ", $categories); } // title // we have to delete ";"-symbol, as Google Base treats it as a delimiter $product_entry[] = $this->sterilizeTextField($product_info["ProductName"]); // description // we have to delete ";"-symbol, as Google Base treats it as a delimiter $product_entry[] = $this->sterilizeTextField($product_info["ProductShortDescription"]); // price // sale price + , $options_modifiers = modApiFunc("Product_Options", "getModifiersOfDefaultCombination", "product", $product_info["ProductID"]); $price_modifier_summ = $options_modifiers['price']; $price_modifier_summ += $product_info["ProductSalePrice"]; if ($price_modifier_summ < 0) { $price_modifier_summ = 0; } $product_entry[] = number_format($price_modifier_summ, 2, ".", ""); // condition $product_entry[] = "new"; // link LayoutConfigurationManager::static_activate_cz_layout($this->_settings['froogle_storefront_link']); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $product_info["ProductID"]); $product_entry[] = $request->getURL("", false, 'froogle'); // image_link if (!empty($product_info["ProductLargeImageSrc"])) { $product_entry[] = $product_info["ProductLargeImageSrc"]; } // expiration_date $product_entry[] = $this->_settings["froogle_expires_date"]; // gtin $product_entry[] = $this->getGTIN($product_info); // brand $manufacturer_info = modApiFunc("Manufacturers", "getManufacturerInfo", $prodObj->getProductTagValue('Manufacturer', PRODUCTINFO_NOT_LOCALIZED_DATA)); $product_entry[] = isset($manufacturer_info["manufacturer_name"]) ? $this->sterilizeTextField($manufacturer_info["manufacturer_name"]) : ''; // mpn $product_entry[] = isset($product_info["ProductMPN"]) ? $this->sterilizeTextField($product_info["ProductMPN"]) : ''; // google_product_category $product_entry[] = isset($product_info["ProductGpc"]) && $product_info["ProductGpc"] != getMsg('SYS', 'PRTYPE_VALUE_NOT_SELECTED') ? $product_info["ProductGpc"] : ''; // gender $product_entry[] = isset($product_info["ProductGender"]) && $product_info["ProductGender"] != getMsg('SYS', 'PRTYPE_VALUE_NOT_SELECTED') ? $product_info["ProductGender"] : ''; // age_group $product_entry[] = isset($product_info["ProductAgegroup"]) && $product_info["ProductAgegroup"] != getMsg('SYS', 'PRTYPE_VALUE_NOT_SELECTED') ? $product_info["ProductAgegroup"] : ''; // apparel size $product_entry[] = isset($product_info["ProductApparelsize"]) ? $this->sterilizeTextField($product_info["ProductApparelsize"]) : ''; // Apparel color $product_entry[] = isset($product_info["ProductApparelcolor"]) ? $this->sterilizeTextField($product_info["ProductApparelcolor"]) : ''; // location if (isset($this->_settings["froogle_location"]) && $this->_settings["froogle_location"] != null) { $product_entry[] = $this->sterilizeTextField($this->_settings["froogle_location"]); } // payment_notes if (isset($this->_settings["froogle_payment_notes"]) && $this->_settings["froogle_payment_notes"] != null) { $product_entry[] = $this->sterilizeTextField($this->_settings["froogle_payment_notes"]); } // payment_accepted if (isset($this->_settings["froogle_payment_accepted"]) && $this->_settings["froogle_payment_accepted"] != null) { $product_entry[] = $this->sterilizeTextField($this->_settings["froogle_payment_accepted"]); } $result = implode("\t", $product_entry); fwrite($this->_fileForExport, $result); fwrite($this->_fileForExport, "\n"); } }
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); }
function urlStorefrontBase() { global $application; $storefront_list = array(); $config_array = LayoutConfigurationManager::static_get_cz_layouts_list(); foreach ($config_array as $k => $v) { if (preg_match('/^.*\\.ini$/', $v['PATH_LAYOUTS_CONFIG_FILE'])) { if ($application->getCurrentProtocol() == "https") { $storefront_list[] = $application->appIni['HTTPS_URL']; } else { $storefront_list[] = $v['SITE_URL']; } } } return sizeof($storefront_list) ? reset($storefront_list) : ''; }
/** * build apache mod_rewrite block for .htaccess file */ function genRewriteBlock($cz_layout_file_path) { global $application; $cz_layouts = array_keys(LayoutConfigurationManager::static_get_cz_layouts_list()); for ($i = 0; $i < count($cz_layouts); $i++) { $cz_layouts[$i] = $this->_prepareAbsFilePath($cz_layouts[$i]); } if (!in_array($cz_layout_file_path, $cz_layouts)) { return null; } $parsed_info = _parse_cz_layout_ini_file($cz_layout_file_path, true); # prepare info for categories pages $cats_info = array('by_id' => array(), 'as_sub' => array(), 'default' => ''); foreach ($parsed_info['ProductList'] as $layout_key => $rel_script_path) { // $layout_key = str_replace(' ', '', $layout_key); if (_ml_strtolower($layout_key) == 'default') { $cats_info['default'] = trim(_ml_strtolower($rel_script_path)); continue; } if (preg_match("/^categories\\s*\\{([0-9\\,\\+]+)\\}\$/i", trim(_ml_strtolower($layout_key)), $matches)) { $row_ids = array_map("trim", explode(",", $matches[1])); foreach ($row_ids as $row_id) { if (_ml_strpos($row_id, '+') === false) { $fine_id = intval($row_id); $cats_info['by_id'][trim(_ml_strtolower($rel_script_path))][] = $fine_id; } else { $fine_id = intval($row_id); $cats_info['as_sub'][trim(_ml_strtolower($rel_script_path))][] = $fine_id; } } } } $rw_strings = array(); # 1. , ID if (!empty($cats_info['by_id'])) { foreach ($cats_info['by_id'] as $rel_script_path => $ids_array) { $str = str_replace(array('%category_id%', '%page_number%', '%parent_cid%', '%query_cat_prefix%', '%seo_cat_prefix%'), array(implode('|', $ids_array), '[0-9]+', '', $this->queries_prefixes['category'], '.*'), $this->rewrite_scheme['category']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['category'] . ' [L]'; # . //$rw_strings[]='RewriteRule ^'.$this->queries_prefixes['category'].'/('.implode('|',$ids_array).')/([0-9])+/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['category'].' [L]'; } } # 2. ID+ if (!empty($cats_info['as_sub'])) { foreach ($cats_info['as_sub'] as $rel_script_path => $ids_array) { $str = str_replace(array('%category_id%', '%page_number%', '%parent_cid%', '%query_cat_prefix%', '%seo_cat_prefix%'), array('[0-9]+', '[0-9]+', '-' . (count($ids_array) > 1 ? '(' : '') . implode('|', $ids_array) . (count($ids_array) > 1 ? ')' : '') . '\\+', $this->queries_prefixes['category'], '.*'), $this->rewrite_scheme['category']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['category'] . ' [L]'; # . //$rw_strings[]='RewriteRule ^'.$this->queries_prefixes['category'].'/([0-9])+/([0-9])+/('.(implode('|',$ids_array)).'\+)/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['category'].' [L]'; } } # 3. $str = str_replace(array('%category_id%', '%page_number%', '%parent_cid%', '%query_cat_prefix%', '%seo_cat_prefix%'), array('[0-9]+', '[0-9]+', '', $this->queries_prefixes['category'], '.*'), $this->rewrite_scheme['category']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $cats_info['default'] . '?' . $this->queries_suffixes['category'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['category'].'/([0-9])+/([0-9])+/.*\.html '.$cats_info['default'].'?'.$this->queries_suffixes['category'].' [L]'; $prods_info = array('by_id' => array(), 'as_cat_child' => array('by_id' => array(), 'as_sub' => array()), 'default' => ''); foreach ($parsed_info['ProductInfo'] as $layout_key => $rel_script_path) { // $layout_key = str_replace(' ', '', $layout_key); if (_ml_strtolower($layout_key) == 'default') { $prods_info['default'] = trim(_ml_strtolower($rel_script_path)); continue; } if (preg_match("/products\\s*\\{([0-9\\,]+)\\}/i", $layout_key, $matches)) { $row_ids = array_map("trim", explode(",", $matches[1])); foreach ($row_ids as $row_id) { $fine_id = intval($row_id); $prods_info['by_id'][trim(_ml_strtolower($rel_script_path))][] = $fine_id; } continue; } if (preg_match("/categories\\s*\\{([0-9\\,\\+]+)\\}/i", $layout_key, $matches)) { $row_ids = array_map("trim", explode(",", $matches[1])); foreach ($row_ids as $row_id) { if (_ml_strpos($row_id, "+") === false) { $fine_id = intval($row_id); $prods_info['as_cat_child']['by_id'][trim(_ml_strtolower($rel_script_path))][] = $fine_id; } else { $fine_id = intval($row_id); $prods_info['as_cat_child']['as_sub'][trim(_ml_strtolower($rel_script_path))][] = $fine_id; } } } } # 1. ID if (!empty($prods_info['by_id'])) { foreach ($prods_info['by_id'] as $rel_script_path => $ids_array) { $str = str_replace(array('%product_id%', '%parent_cid%', '%query_prod_prefix%', '%seo_prod_prefix%'), array(implode('|', $ids_array), '', $this->queries_prefixes['product'], '.*'), $this->rewrite_scheme['product']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['product'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/('.implode('|',$ids_array).')/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['product'].' [L]'; } } # 2. ID if (!empty($prods_info['as_cat_child']['by_id'])) { foreach ($prods_info['as_cat_child']['by_id'] as $rel_script_path => $ids_array) { $str = str_replace(array('%product_id%', '%parent_cid%', '%query_prod_prefix%', '%seo_prod_prefix%'), array('[0-9]+', '-' . (count($ids_array) > 1 ? '(' : '') . implode('|', $ids_array) . (count($ids_array) > 1 ? ')' : ''), $this->queries_prefixes['product'], '.*'), $this->rewrite_scheme['product']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['product'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/([0-9]+)/('.implode('|',$ids_array).')/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['product'].' [L]'; } } # 3. ID+ if (!empty($prods_info['as_cat_child']['as_sub'])) { foreach ($prods_info['as_cat_child']['as_sub'] as $rel_script_path => $ids_array) { $str = str_replace(array('%product_id%', '%parent_cid%', '%query_prod_prefix%', '%seo_prod_prefix%'), array('[0-9]+', '-' . (count($ids_array) > 1 ? '(' : '') . implode('|', $ids_array) . (count($ids_array) > 1 ? ')' : '') . '\\+', $this->queries_prefixes['product'], '.*'), $this->rewrite_scheme['product']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['product'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/([0-9]+)/('.implode('|',$ids_array).'\+)/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['product'].' [L]'; } } # 4. $str = str_replace(array('%product_id%', '%parent_cid%', '%query_prod_prefix%', '%seo_prod_prefix%'), array('[0-9]+', '', $this->queries_prefixes['product'], '.*'), $this->rewrite_scheme['product']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $prods_info['default'] . '?' . $this->queries_suffixes['product'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/([0-9])+/.*\.html '.$prods_info['default'].'?'.$this->queries_suffixes['product'].' [L]'; $cms_info = array('by_id' => array(), 'as_sub' => array(), 'default' => ''); foreach ($parsed_info['CMSPage'] as $layout_key => $rel_script_path) { // $layout_key = str_replace(' ', '', $layout_key); if (_ml_strtolower($layout_key) == 'default') { $cms_info['default'] = trim(_ml_strtolower($rel_script_path)); continue; } if (preg_match("/cmspage\\s*\\{([0-9\\,]+)\\}/i", $layout_key, $matches)) { $row_ids = array_map("trim", explode(",", $matches[1])); foreach ($row_ids as $row_id) { $fine_id = intval($row_id); $cms_info['by_id'][trim(_ml_strtolower($rel_script_path))][] = $fine_id; } continue; } } # . ID if (!empty($cms_info['by_id'])) { foreach ($cms_info['by_id'] as $rel_script_path => $ids_array) { $str = str_replace(array('%page_id%', '%query_cms_prefix%', '%seo_cms_prefix%'), array(implode('|', $ids_array), $this->queries_prefixes['cmspage'], '.*'), $this->rewrite_scheme['cmspage']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['cmspage'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/('.implode('|',$ids_array).')/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['product'].' [L]'; } } # 2. ID if (!empty($cms_info['as_cat_child']['by_id'])) { foreach ($cms_info['as_cat_child']['by_id'] as $rel_script_path => $ids_array) { $str = str_replace(array('%page_id%', '%query_cms_prefix%', '%seo_cms_prefix%'), array('[0-9]+', '-' . (count($ids_array) > 1 ? '(' : '') . implode('|', $ids_array) . (count($ids_array) > 1 ? ')' : ''), $this->queries_prefixes['cmspage'], '.*'), $this->rewrite_scheme['cmspage']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['cmspage'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/([0-9]+)/('.implode('|',$ids_array).')/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['product'].' [L]'; } } # 3. ID+ if (!empty($cms_info['as_cat_child']['as_sub'])) { foreach ($cms_info['as_cat_child']['as_sub'] as $rel_script_path => $ids_array) { $str = str_replace(array('%page_id%', '%query_cms_prefix%', '%seo_cms_prefix%'), array('[0-9]+', '-' . (count($ids_array) > 1 ? '(' : '') . implode('|', $ids_array) . (count($ids_array) > 1 ? ')' : '') . '\\+', $this->queries_prefixes['cmspage'], '.*'), $this->rewrite_scheme['cmspage']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $rel_script_path . '?' . $this->queries_suffixes['cmspage'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/([0-9]+)/('.implode('|',$ids_array).'\+)/.*\.html '.$rel_script_path.'?'.$this->queries_suffixes['product'].' [L]'; } } # 4. $str = str_replace(array('%page_id%', '%query_cms_prefix%', '%seo_cms_prefix%'), array('[0-9]+', $this->queries_prefixes['cmspage'], '.*'), $this->rewrite_scheme['cmspage']); $rw_strings[] = 'RewriteRule ' . $str . ' ' . $cms_info['default'] . '?' . $this->queries_suffixes['cmspage'] . ' [L]'; # . //$rw_strings[] = 'RewriteRule ^'.$this->queries_prefixes['product'].'/([0-9])+/.*\.html '.$prods_info['default'].'?'.$this->queries_suffixes['product'].' [L]'; loadCoreFile('URI.class.php'); $uriObj = new URI($parsed_info['Site']['SiteURL']); # Options +FollowSymLinks //if($application->getAppIni('MR_ADD_FSL_STRING') == 'YES') if ($this->settings['ADD_FSL_STRING'] == 'Y') { $fsl_string = 'Options +FollowSymLinks'; } else { $fsl_string = ''; } # $rw_first = str_replace(array('%http_site_url%', '%url_dir%', '%mr_fsl_string%'), array($parsed_info['Site']['SiteURL'], $uriObj->getPart('dir') . (_ml_substr($uriObj->getPart('dir'), -1) != '/' ? '/' : ''), $fsl_string), file_get_contents(dirname(__FILE__) . '/includes/rewrite_block_first_strings')); # $rw_scheme_block = str_replace(array('%category_prefix%', '%product_prefix%', '%cms_prefix%'), array($this->queries_prefixes['category'], $this->queries_prefixes['product'], $this->queries_prefixes['cmspage']), file_get_contents(dirname(__FILE__) . '/includes/rewrite_block_for_' . $this->settings['rewrite_scheme_name'])); # $rw_last = file_get_contents(dirname(__FILE__) . '/includes/rewrite_block_last_strings'); $rw_block = REWRITE_BLOCK_IDENT_BEGIN . "\n" . $rw_first . "\n" . $rw_scheme_block . "\n" . implode("\n", $rw_strings) . "\n" . $rw_last . "\n" . REWRITE_BLOCK_IDENT_END . "\n"; return $rw_block; }
/** * [ ]. * , . * , * static_get_cz_layouts_list(). * * . application , * . : . */ function static_activate_cz_layout($layout_config_ini_path) { global $application; $config_parsing_results = LayoutConfigurationManager::static_parse_layout_config_file($layout_config_ini_path); if (empty($config_parsing_results["MAIN_ERROR_PARAMETERS"])) { // , : //: , // . . $config_check_results = LayoutConfigurationManager::static_checkLayoutFile($layout_config_ini_path, $config_parsing_results["SITE_PATH"], $config_parsing_results["PATH_LAYOUTS_CONFIG_FILE"]); // - - . if (empty($config_check_results["MAIN_ERROR_PARAMETERS"])) { $application->readLayoutsINI(); //Merge parse results with appIni $application->appIni = array_merge($application->appIni, $config_parsing_results); } } }
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; }
/** * @ 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; }
/** * Prepares an email text and the subject to send. */ function prepareEmailTextAndSubject() { global $application; $this->customerEmail = null; $this->product_obj = null; $pushedCurrency = false; switch ($this->actionId) { case '1': case '2': case '3': case '4': case '5': case '16': $pushedCurrency = true; $currencyId = modApiFunc("Localization", "whichCurrencyToDisplayOrderIn", $this->orderId); $orderInfo = modApiFunc("Checkout", "getOrderInfo", $this->orderId, $currencyId); modApiFunc("Localization", "pushDisplayCurrency", $currencyId, $currencyId); $customer_id = $orderInfo['PersonId']; $account_name = modApiFunc('Customer_Account', 'getCustomerAccountNameByCustomerID', $customer_id); $this->customer_obj =& $application->getInstance('CCustomerInfo', $account_name); // $this->customerEmail = $this->customer_obj->getPersonInfo('Email','Customer'); $taxExemptEnabled = modApiFunc('Settings', 'getParamValue', 'TAXES_PARAMS', 'ALLOW_FULL_TAX_EXEMPTS'); $taxExemptInfo = modApiFunc("TaxExempts", "getOrderFullTaxExempts", $this->orderId, false); break; case '6': // if(array_key_exists('Email',$this->customerRegData['info'])) // $this->customerEmail = $this->customerRegData['info']['Email']; $this->customer_obj =& $application->getInstance('CCustomerInfo', $this->customerRegData['account']); break; case '7': case '8': case '9': case '10': case '11': case '12': case '13': $this->customer_obj =& $application->getInstance('CCustomerInfo', $this->customerAccount); // $this->customerEmail = $this->customer_obj->getPersonInfo('Email','Customer'); break; case '14': $this->product_obj =& $application->getInstance('CProductInfo', $this->inventory_info['entity_id']); break; case '15': $this->product_obj =& $application->getInstance('CProductInfo', $this->review_data['product_id']); break; case '18': $this->customer_obj =& $application->getInstance('CCustomerInfo', $this->customerAccount); $this->product_obj =& $application->getInstance('CProductInfo', $this->review_data['product_id']); break; } // reloading the notification info since it may be different for each language $this->getNotificationInfo($this->notificationId); $tagsList = modApiFunc("Notifications", "getAvailableTagsList", array('0' => array('Id' => $this->actionId))); //initialize infotags $infotags = array(); foreach ($tagsList[$this->actionId]['InfoTags'] as $infotag) { if (_ml_strpos($infotag, "Order") == 1) { $tag = _ml_substr($infotag, 6, _ml_strlen($infotag) - 7); switch ($tag) { case 'Date': $infotags[$infotag] = modApiFunc("Localization", "date_format", $orderInfo[$tag]); break; case 'GlobalDiscount': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalGlobalDiscount']); break; case 'PromoCodeDiscount': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalPromoCodeDiscount']); break; case 'QuantityDiscount': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['QuantityDiscount']); break; case 'DiscountedSubtotal': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['DiscountedSubtotal']); break; case 'TotalShippingAndHandlingCost': $ShippingCost = $orderInfo['Price']['TotalShippingAndHandlingCost'] == PRICE_N_A ? 0.0 : $orderInfo['Price']['TotalShippingAndHandlingCost']; $infotags[$infotag] = modApiFunc("Localization", "currency_format", $ShippingCost); break; case 'Tax': $infotags[$infotag] = ""; $taxes = array(); foreach ($orderInfo['Price'] as $key => $value) { $tax_name_patern = "/^Taxes\\['(.+)'\\]\$/"; $matches = array(); if (preg_match($tax_name_patern, $key, $matches)) { $taxes[$matches[1]] = $value; } } foreach ($taxes as $name => $value) { $infotags[$infotag] .= $name . " " . modApiFunc("Localization", "currency_format", $value) . "\n"; } break; case 'OldStatus': if ($this->actionId == '2') { $infotags[$infotag] = $this->OrderOldStatus; } break; case 'OldPaymentStatus': if ($this->actionId == '3') { $infotags[$infotag] = $this->OrderOldPaymentStatus; } break; case 'Total': case 'Subtotal': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo[$tag]); break; case 'PaymentMethodText': $pm_uid = $orderInfo['PaymentModuleId']; $infotags[$infotag] = modApiFunc("Checkout", "getPaymentMethodText", $pm_uid); break; case "PromoCode": $couponInfo = modApiFunc("PromoCodes", "getOrderCoupons", $this->orderId); if (isset($couponInfo[0]["coupon_promo_code"])) { $infotags[$infotag] = $couponInfo[0]["coupon_promo_code"]; } else { $infotags[$infotag] = ""; } break; case "TaxExptMark": if ($taxExemptEnabled == "true" && isset($taxExemptInfo[0]["exempt_status"]) && $taxExemptInfo[0]["exempt_status"] == "true") { $infotags[$infotag] = getMsg("SYS", "FULL_TAX_EXEMPT_YES_MSG"); } else { $infotags[$infotag] = getMsg("SYS", "FULL_TAX_EXEMPT_NO_MSG"); } break; case "TaxExptAmount": if ($taxExemptEnabled == "true" && isset($taxExemptInfo[0]["exempt_status"]) && $taxExemptInfo[0]["exempt_status"] == "true") { $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo["Price"]["OrderTaxTotal"]); } else { $infotags[$infotag] = modApiFunc("Localization", "currency_format", "0.0000"); } break; case "TaxExptInput": if ($taxExemptEnabled == "true" && isset($taxExemptInfo[0]["exempt_status"]) && $taxExemptInfo[0]["exempt_status"] == "true") { $infotags[$infotag] = $taxExemptInfo[0]["exempt_reason_customer_input"]; } else { $infotags[$infotag] = ''; } break; case 'OrderTotalToPay': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalToPay']); break; case 'OrderTotalPrepaidByGC': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalPrepaidByGC']); break; default: $infotags[$infotag] = $orderInfo[$tag]; break; } } elseif (_ml_strpos($infotag, 'CustomerReview') == 1) { $tag = _ml_substr($infotag, 15, _ml_strlen($infotag) - 16); $tag_value = ''; if ($this->review_data) { switch ($tag) { case 'Date': $tag_value = $this->review_data['date']; break; case 'Time': $tag_value = $this->review_data['time']; break; case 'Author': $tag_value = _ml_substr($this->review_data['author'], 0, 56) . (_ml_strlen($this->review_data['author']) > 56 ? '...' : ''); break; case 'IP': $tag_value = $this->review_data['ip_address']; break; case 'Status': if ($this->review_data['status'] == 'A') { $tag_value = getMsg('CR', 'CR_STATUS_APPROVED'); } elseif ($this->review_data['status'] == 'P') { $tag_value = getMsg('CR', 'CR_STATUS_PENDING'); } else { $tag_value = getMsg('CR', 'CR_STATUS_NOTAPPROVED'); } break; case 'Text': $tag_value = $this->review_data['review']; break; case 'OverallRating': $tag_value = getMsg('CR', 'CR_RECORD_NO_RATE'); if (is_array($this->review_data['rating']) && !empty($this->review_data['rating'])) { $sum = 0; foreach ($this->review_data['rating'] as $v) { $sum += $v['rate']; } $tag_value = sprintf("%.2f", $sum / count($this->review_data['rating'])); } break; } } $infotags[$infotag] = $tag_value; } elseif (_ml_strpos($infotag, "Customer") == 1) { $tag = _ml_substr($infotag, 9, _ml_strlen($infotag) - 10); $infotags[$infotag] = $this->customer_obj->getPersonInfo($tag, 'Customer'); switch (_ml_strtolower($tag)) { case 'country': $infotags[$infotag] = modApiFunc('Location', 'getCountry', $infotags[$infotag]); break; case 'state': if (modApiFunc('Location', 'getStateCode', $infotags[$infotag]) != '') { $infotags[$infotag] = modApiFunc('Location', 'getState', $infotags[$infotag]); } else { $infotags[$infotag] = $infotags[$infotag]; } break; } } elseif (_ml_strpos($infotag, "Shipping") == 1) { $tag = _ml_substr($infotag, 9, _ml_strlen($infotag) - 10); $infotags[$infotag] = isset($orderInfo['Shipping']['attr'][$tag]['value']) ? $orderInfo['Shipping']['attr'][$tag]['value'] : (isset($orderInfo['Shipping']['attr'][$tag . "NULL"]['value']) ? $orderInfo['Shipping']['attr'][$tag . "NULL"]['value'] : ""); } elseif (_ml_strpos($infotag, "Billing") == 1) { $tag = _ml_substr($infotag, 8, _ml_strlen($infotag) - 9); $infotags[$infotag] = isset($orderInfo['Billing']['attr'][$tag]['value']) ? $orderInfo['Billing']['attr'][$tag]['value'] : ""; } elseif (_ml_strpos($infotag, "StoreOwner") == 1) { $tag = _ml_substr($infotag, 11, _ml_strlen($infotag) - 12); switch ($tag) { case "StreetLine1": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_street_line_1"); break; case "StreetLine2": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_street_line_2"); break; case "SiteAdministratorEmail": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_site_administrator_email"); break; case "OrdersDepartmentEmail": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_orders_department_email"); break; case "Country": $infotags[$infotag] = modApiFunc("Location", "getCountry", modApiFunc("Configuration", "getValue", "store_owner_country")); break; case "State": $state = modApiFunc("Configuration", "getValue", "store_owner_state"); $states_in_country = modApiFunc("Location", "getStates", modApiFunc("Configuration", "getValue", "store_owner_country")); if (array_key_exists($state, $states_in_country)) { $infotags[$infotag] = modApiFunc("Location", "getState", $state); } else { $infotags[$infotag] = $state; } break; default: $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_" . _ml_strtolower($tag)); break; } } elseif (_ml_strpos($infotag, "TrackingNumber") == 1) { $infotags[$infotag] = $orderInfo["TrackId"]; } elseif (_ml_strpos($infotag, 'AccountActivationLink') == 1) { $r = new Request(); $r->setView('AccountActivation'); $r->setAction('activate_account'); $r->setKey('key', modApiFunc('Customer_Account', 'getActivationKey', $this->customerAccount)); $infotags[$infotag] = $r->getURL(); } elseif (_ml_strpos($infotag, 'AccountName') == 1) { $infotags[$infotag] = $this->customerAccount; } elseif (_ml_strpos($infotag, 'AccountNewPasswordLink') == 1) { $cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list(); LayoutConfigurationManager::static_activate_cz_layout(array_shift(array_keys($cz_layouts))); $r = new CZRequest(); $r->setView('CustomerNewPassword'); $r->setKey('key', modApiFunc('Customer_Account', 'getActivationKey', $this->customerAccount)); $infotags[$infotag] = $r->getURL(); } elseif (preg_match('/^\\{combination(.+)\\}$/i', $infotag, $matches)) { $tag_value = ''; switch (_ml_strtolower($matches[1])) { case 'sku': $tag_value = $this->inventory_info['sku']; break; case 'quantityinstock': $tag_value = $this->inventory_info['quantity']; break; case 'description': $tag_value = modApiFunc('Product_Options', 'convertCombinationToString', modApiFunc('Product_Options', '_unserialize_combination', $this->inventory_info['combination']), '; '); break; default: $tag_value = ''; break; } $infotags[$infotag] = $tag_value; } elseif (preg_match('/^\\{product(.+)\\}$/i', $infotag, $matches) and $this->product_obj != null) { $infotags[$infotag] = $this->product_obj->getProductTagValue($matches[1], PRODUCTINFO_LOCALIZED_DATA); } elseif (_ml_strpos($infotag, 'GiftCertificateRecipient') == 1) { if ($this->gift_cert != null) { $infotags[$infotag] = $this->gift_cert->to; } } } //initialize blocktags foreach ($tagsList[$this->actionId]['BlockTags'] as $blocktagId => $blocktagInfo) { $infotags[$blocktagInfo['BlockTag']] = ""; switch ($blocktagInfo['BlockTag']) { case '{OrderContentBlock}': foreach ($orderInfo['Products'] as $productInfo) { # settings default values for all infotags foreach ($blocktagInfo['BlockInfoTags'] as $t) { $t = strtr($t, array('{' => '\\{', '}' => '\\}')); $init_productInfoTags[$t] = ""; } $productInfoTags = array("{ProductID}" => $productInfo['storeProductID'], "{ProductName}" => $productInfo['name'], "{ProductQuantity}" => $productInfo['qty'], "{ProductPrice}" => modApiFunc("Localization", "currency_format", $productInfo['SalePrice']), "{ProductAmount}" => modApiFunc("Localization", "currency_format", $productInfo['qty'] * $productInfo['SalePrice']), "{ProductOptions}" => modApiFunc("Product_Options", "prepareTextForNotificaton", $productInfo['options'])); $productInfoTags = array_merge($init_productInfoTags, $productInfoTags); foreach ($productInfo['attr'] as $attr => $attr_value) { if ($attr == "SalePrice" || $attr == "ListPrice" || $attr == "PerItemShippingCost" || $attr == "PerItemHandlingCost") { $productInfoTags["{Product" . $attr . "}"] = modApiFunc("Localization", "currency_format", $attr_value["value"]); } elseif ($attr == "FreeShipping" || $attr == "NeedShipping") { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"] == PRODUCT_FREESHIPPING_YES ? $this->MessageResources->getMessage("NTFCTN_INFO_YES_LABEL") : $this->MessageResources->getMessage("NTFCTN_INFO_NO_LABEL"); } else { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"]; } } foreach ($productInfo['custom_attributes'] as $custom_attr_info) { $productInfoTags["{Product" . $custom_attr_info["tag"] . "Custom}"] = $custom_attr_info["value"]; } $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($productInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body . "\n"; } break; case '{LowLevelProductsBlock}': foreach ($orderInfo['Products'] as $productInfo) { if (!in_array($productInfo['storeProductID'], $this->_LowLevelProducts)) { continue; } $_productInfo = new CProductInfo($productInfo['storeProductID']); if ($_productInfo->whichStockControlMethod() == PRODUCT_OPTIONS_INVENTORY_TRACKING) { $productQuantityInStock = modApiFunc('Product_Options', 'getQuantityInStockByInventoryTable', 'product', $productInfo['storeProductID']); } else { $productQuantityInStock = $_productInfo->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA); } $productLowLevelInStock = $_productInfo->getProductTagValue('LowStockLevel', PRODUCTINFO_NOT_LOCALIZED_DATA); $productInfoTags = array("{ProductID}" => $productInfo['storeProductID'], "{ProductName}" => $productInfo['name'], "{ProductPrice}" => modApiFunc("Localization", "currency_format", $productInfo['SalePrice']), "{ProductQuantityInStock}" => (string) $productQuantityInStock); foreach ($productInfo['attr'] as $attr => $attr_value) { if ($attr == "SalePrice" || $attr == "ListPrice" || $attr == "PerItemShippingCost" || $attr == "PerItemHandlingCost") { $productInfoTags["{Product" . $attr . "}"] = modApiFunc("Localization", "currency_format", $attr_value["value"]); } elseif ($attr == "FreeShipping" || $attr == "NeedShipping") { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"] == PRODUCT_FREESHIPPING_YES ? $this->MessageResources->getMessage("NTFCTN_INFO_YES_LABEL") : $this->MessageResources->getMessage("NTFCTN_INFO_NO_LABEL"); } else { if ($attr != "QuantityInStock") { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"]; } } } foreach ($productInfo['custom_attributes'] as $custom_attr_info) { $productInfoTags["{Product" . $custom_attr_info["tag"] . "Custom}"] = $custom_attr_info["value"]; } $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($productInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body . "\n"; } break; case '{OrderDiscountsBlock}': $promoInfo = modApiFunc("PromoCodes", "getOrderCoupons", $this->orderId); $promoCode = isset($promoInfo[0]["coupon_promo_code"]) ? $promoInfo[0]["coupon_promo_code"] : ""; $discountsInfoTags = array("{OrderGlobalDiscount}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalGlobalDiscount']), "{OrderPromoCode}" => $promoCode, "{OrderPromoCodeDiscount}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalPromoCodeDiscount']), "{OrderQuantityDiscount}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['QuantityDiscount']), "{OrderDiscountedSubtotal}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['DiscountedSubtotal']), "{OrderSubtotal}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderSubtotal']), "{OrderTotalToPay}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalToPay']), "{OrderTotalPrepaidByGC}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalPrepaidByGC'])); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($discountsInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; break; case '{OrderDownloadLinksBlock}': $hotlinks = modApiFunc('Product_Files', 'getHotlinksListForOrder', $this->orderId); foreach ($hotlinks as $k => $hotlink_info) { $file_info = modApiFunc('Product_Files', 'getPFileInfo', $hotlink_info['file_id']); $HotlinkInfoTags = array("{DownloadLink}" => $hotlink_info['hotlink_value'], "{DownloadLinkExpiryDate}" => date("d M Y, H:i", $hotlink_info['expire_date']), "{DownloadLinkAttempts}" => $hotlink_info['max_try'], "{DownloadFilename}" => $file_info['file_name'], "{DownloadFileDescription}" => $file_info['file_descr']); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($HotlinkInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; } break; case '{OrderedGiftCertificateBlock}': $gcs = array(); if ($this->gift_cert) { $gcs = array(modApiFunc("GiftCertificateApi", "getGiftCertificate", $this->gift_cert->code)); } else { if ($this->orderId) { $gcs = modApiFunc("GiftCertificateApi", "getGiftCertificatesForOrderId", $this->orderId); } } if (sizeof($gcs) > 0) { foreach ($gcs as $gc) { $GCInfoTags = array("{PurchasedGiftCertificateCode}" => $gc["gc_code"], "{PurchasedGiftCertificateMessage}" => $gc["gc_message"], "{PurchasedGiftCertificateAmount}" => modApiFunc("Localization", "currency_format", $gc["gc_amount"]), "{PurchasedGiftCertificateFrom}" => $gc["gc_from"], "{PurchasedGiftCertificateTo}" => $gc["gc_to"], "{PurchasedGiftCertificateType}" => $gc["gc_sendtype"]); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($GCInfoTags as $tag => $val) { $blocktag_body = str_replace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; } } break; case '{AppliedGiftCertificateBlock}': $gcs = modApiFunc("GiftCertificateApi", "getOrderGCs", $this->orderId); if (!empty($gcs) && is_array($gcs)) { foreach ($gcs as $i => $gc_data) { $gc = new GiftCertificate($gc_data['gc_code']); $GCInfoTags = array("{AppliedGiftCertificateCode}" => $gc->code, "{AppliedGiftCertificateMessage}" => $gc->message, "{AppliedGiftCertificateAmount}" => modApiFunc("Localization", "currency_format", $gc->amount), "{AppliedGiftCertificateFrom}" => $gc->from, "{AppliedGiftCertificateTo}" => $gc->to, "{AppliedGiftCertificateType}" => $gc->sendtype); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($GCInfoTags as $tag => $val) { $blocktag_body = str_replace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; } } break; } } $this->EmailText = $this->getNotificationBody(); $this->EmailSubject = $this->subject; foreach ($infotags as $tag => $val) { $this->EmailText = str_ireplace($tag, $val, $this->EmailText); $this->EmailSubject = str_ireplace($tag, $val, $this->EmailSubject); } $this->EmailText = $this->html_replace($this->EmailText); $this->EmailSubject = $this->html_replace($this->EmailSubject); if ($pushedCurrency) { modApiFunc("Localization", "popDisplayCurrency"); } }