function __formatRow($row)
 {
     $row['date'] = $this->__prepareDateToDisplay($row);
     if ($row['items_sold'] == 0 or $row['product_added_to_cart_qty'] == 0) {
         $row['cr_added_sold'] = '0';
     } else {
         $row['cr_added_sold'] = round(100 * (1 - $row['items_sold'] / $row['product_added_to_cart_qty']), 2);
     }
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['items_sold'] = modApiFunc("Localization", "num_format", $row['items_sold']);
             $row['product_added_to_cart_qty'] = modApiFunc("Localization", "num_format", $row['product_added_to_cart_qty']);
             $row['cr_added_sold'] .= '%';
             break;
         case 'creportrendercsv':
             //                           Stock Chart'
             $date = mktime(0, 0, 0, $row['datetime_month'], $row['datetime_day'], $row['datetime_year']);
             $row['date'] = date('Y-m-d', $date);
             break;
         default:
             // simple html table, binary excel or chart
             // Let's stay as is.
             break;
     }
     return $row;
 }
 function __formatRow($row)
 {
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['view_number'] = modApiFunc("Localization", "num_format", $row['view_number']);
             $parsed = @parse_url($row['page_url']);
             if (isset($parsed['path']) and !empty($parsed['path'])) {
                 $url = $parsed['path'];
                 if (isset($parsed['query']) and !empty($parsed['query'])) {
                     $url .= '?' . $parsed['query'];
                 }
             } else {
                 $url = $row['page_url'];
             }
             //        ,
             $row['page_url'] = $this->__prepareLongUrl($url, 80, 'font-weight: bold; color: #666666;');
             $row['bar'] = $this->__getBar($row['percent_pixel']);
             $row['percent'] = modApiFunc("Localization", "num_format", $row['percent']) . '%';
             break;
         default:
             // simple html table, binary excel or chart
             // Let's stay as is.
             break;
     }
     return $row;
 }
 function __formatRow($row)
 {
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['bar'] = $this->__getBar($row['percent_pixel']);
             if (isset($row['items_sold'])) {
                 $row['items_sold'] = modApiFunc("Localization", "num_format", $row['items_sold']);
             }
             if (isset($row['product_views'])) {
                 $row['product_views'] = modApiFunc("Localization", "num_format", $row['product_views']);
             }
             if (isset($row['product_added_to_cart_times'])) {
                 $row['product_added_to_cart_times'] = modApiFunc("Localization", "num_format", $row['product_added_to_cart_times']);
             }
             if (isset($row['product_deleted_from_cart_times'])) {
                 $row['product_deleted_from_cart_times'] = modApiFunc("Localization", "num_format", $row['product_deleted_from_cart_times']);
             }
             if (isset($row['product_added_to_cart_qty'])) {
                 $row['product_added_to_cart_qty'] = modApiFunc("Localization", "num_format", $row['product_added_to_cart_qty']);
             }
             if (isset($row['product_deleted_from_cart_qty'])) {
                 $row['product_deleted_from_cart_qty'] = modApiFunc("Localization", "num_format", $row['product_deleted_from_cart_qty']);
             }
             if (isset($row['product_name'])) {
                 $row['product_name'] = $this->getProductInfoLink($row['product_id'], $row['product_name']);
             }
             break;
     }
     return $row;
 }
 function onHook($actionObj)
 {
     switch (_ml_strtolower(get_class($actionObj))) {
         case "confirmdeleteproducts":
             $parent_entity = "product";
             $entities_ids = modApiFunc("Catalog", "getEditableProductsID");
             break;
         case "confirmdeletecategory":
             global $application;
             $request =& $application->getInstance('Request');
             $parent_entity = "product";
             $entities_ids = explode("|", $request->getValueByKey('ProdsId'));
             break;
         case "confirmdeleteproducttypes":
             global $application;
             $request =& $application->getInstance('Request');
             $parent_entity = "ptype";
             $entities_ids = $request->getValueByKey('ProductType');
             break;
     }
     modApiFunc("Product_Options", "delAllOptionsFromEntities", $parent_entity, $entities_ids);
     modApiFunc("Product_Options", "delAllCRulesFromEntities", $parent_entity, $entities_ids);
     modApiFunc("Product_Options", "delAllInventoryFromEntities", $parent_entity, $entities_ids);
     modApiFunc("Product_Options", "delAllOptionsSettingsFromEntities", $parent_entity, $entities_ids);
 }
 function __formatRow($row)
 {
     if ($row['carts_created_qty'] == 0) {
         $row['abandonment_rate'] = '0';
     } else {
         $row['abandonment_rate'] = round(100 * (1 - $row['order_qty'] / $row['carts_created_qty']), 2);
     }
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['abandonment_rate'] .= '%';
             $row['order_qty'] = modApiFunc("Localization", "num_format", $row['order_qty']);
             $row['carts_created_qty'] = modApiFunc("Localization", "num_format", $row['carts_created_qty']);
             $row['date'] = $this->__prepareDateToDisplay($row);
             break;
         case 'creportrenderchart':
             $row['date'] = $this->__prepareDateToDisplay($row);
             break;
         case 'creportrendercsv':
             //                           Stock Chart'
             $date = mktime(0, 0, 0, $row['datetime_month'], $row['datetime_day'], $row['datetime_year']);
             $row['date'] = date('Y-m-d', $date);
             break;
         default:
             $row['abandonment_rate'] .= '%';
             $row['date'] = $this->__prepareDateToDisplay($row);
             break;
     }
     return $row;
 }
 function onAction()
 {
     global $application;
     $mm = $application->getInstance('Modules_Manager');
     $lang = _ml_strtolower($application->getAppIni('LANGUAGE'));
     $_path = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/avactis-themes/system/resources/messages.ini';
     modApiFunc("Resources", "dropMessageGroupByMetaId", 'CZ');
     modApiFunc("Resources", "dropMessageMetaByMetaId", 'CZ');
     modApiFunc("Resources", "addResourceIniToDB", $_path, 'CZ', 'customer_messages', 'CZ');
     modApiFunc("Resources", "dropMessageGroupByMetaId", 'SYS');
     modApiFunc("Resources", "dropMessageMetaByMetaId", 'SYS');
     modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'system-messages-' . $lang . '.ini', 'SYS', 'system_messages', 'AZ');
     modApiFunc("Resources", "dropMessageGroupByMetaId", 'ML');
     modApiFunc("Resources", "dropMessageMetaByMetaId", 'ML');
     modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'multilang-messages-' . $lang . '.ini', 'ML', 'MultiLang', 'AZ');
     modApiFunc("Resources", "dropMessageGroupByMetaId", 'CFG');
     modApiFunc("Resources", "dropMessageMetaByMetaId", 'CFG');
     modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'configuration-messages-' . $lang . '.ini', 'CFG', 'Configuration', 'AZ');
     foreach ($mm->moduleList as $module_name => $moduleInfo) {
         if (isset($mm->modulesResFiles[$moduleInfo->shortName])) {
             modApiFunc("Resources", "dropMessageGroupByMetaId", $moduleInfo->shortName);
             modApiFunc("Resources", "dropMessageMetaByMetaId", $moduleInfo->shortName);
             modApiFunc("Resources", "addResourceIniToDB", $mm->modulesResFiles[$moduleInfo->shortName], $moduleInfo->shortName, $moduleInfo->name, 'AZ');
         }
     }
     CCacheFactory::clearAll();
     die('done');
 }
 function onHook($actionObj)
 {
     switch (_ml_strtolower(get_class($actionObj))) {
         case "copytoproducts":
             $from_entity = "product";
             $to_entity = "product";
             $copy_results = modApiFunc("Session", "get", "CopyProductsResult");
             break;
         case "addproductinfoaction":
             if ($actionObj->new_product_id == null) {
                 return;
             }
             $from_entity = "ptype";
             $to_entity = "product";
             $copy_results = array($actionObj->ptype_id_of_new_product => $actionObj->new_product_id);
             break;
     }
     if (!empty($copy_results)) {
         foreach ($copy_results as $old_eid => $new_eid) {
             $tmap = modApiFunc("Product_Options", "copyAllOptionsFromEntityToEntity", $from_entity, $old_eid, $to_entity, $new_eid);
             modApiFunc("Product_Options", "copyAllOptionsSettingsFromEntityToEntity", $from_entity, $old_eid, $to_entity, $new_eid);
             modApiFunc("Product_Options", "copyAllCRulesFromEntityToEntity", $from_entity, $old_eid, $to_entity, $new_eid, $tmap);
             modApiFunc("Product_Options", "copyAllInventoryFromEntityToEntity", $from_entity, $old_eid, $to_entity, $new_eid, $tmap);
         }
     }
 }
 function __formatRow($row)
 {
     $row['date'] = $this->__prepareDateToDisplay($row);
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $this->__total_views += $row['product_views'];
             $this->__total_items_sold += $row['items_sold'];
             $this->__total_added_to_cart_times += $row['product_added_to_cart_times'];
             $this->__total_added_to_cart_qty += $row['product_added_to_cart_qty'];
             $this->__total_deleted_from_cart_qty += $row['product_deleted_from_cart_qty'];
             $this->__total_deleted_from_cart_times += $row['product_deleted_from_cart_times'];
             $row['product_views'] = modApiFunc("Localization", "num_format", $row['product_views']);
             $row['items_sold'] = modApiFunc("Localization", "num_format", $row['items_sold']);
             $row['product_added_to_cart_times'] = modApiFunc("Localization", "num_format", $row['product_added_to_cart_times']);
             $row['product_deleted_from_cart_times'] = modApiFunc("Localization", "num_format", $row['product_deleted_from_cart_times']);
             $row['product_added_to_cart_qty'] = modApiFunc("Localization", "num_format", $row['product_added_to_cart_qty']);
             $row['product_deleted_from_cart_qty'] = modApiFunc("Localization", "num_format", $row['product_deleted_from_cart_qty']);
             break;
         default:
             // simple html table, binary excel or chart
             // Let's stay as is.
             $this->__total_views += $row['product_views'];
             $this->__total_items_sold += $row['items_sold'];
             $this->__total_added_to_cart_times += $row['product_added_to_cart_times'];
             $this->__total_added_to_cart_qty += $row['product_added_to_cart_qty'];
             $this->__total_deleted_from_cart_qty += $row['product_deleted_from_cart_qty'];
             $this->__total_deleted_from_cart_times += $row['product_deleted_from_cart_times'];
             break;
     }
     return $row;
 }
 function &getMessageResources()
 {
     global $application;
     static $_messageResources;
     if (!isset($_messageResources)) {
         $lang = _ml_strtolower($application->getAppIni('LANGUAGE'));
         $_messageResources = new MessageResources(dirname(__FILE__) . '/resources/subscriptions-messages-' . $lang . '.ini', 'AdminZone');
     }
     return $_messageResources;
 }
 function isPromoCodePromoCodeUnique($data)
 {
     $promo_code_list = modApiFunc("PromoCodes", "getPromoCodesListFullAZ");
     foreach ($promo_code_list as $pc_info) {
         if (_ml_strtolower($pc_info["promo_code"]) == _ml_strtolower($data)) {
             return $pc_info["id"];
         }
     }
     return true;
 }
 function onHook($actionObj)
 {
     switch (_ml_strtolower(get_class($actionObj))) {
         case "copytoproducts":
             $copy_results = modApiFunc("Session", "get", "CopyProductsResult");
             break;
     }
     if (!empty($copy_results)) {
         foreach ($copy_results as $old_pid => $new_pid) {
             modApiFunc("Product_Images", "copyAllImagesFromProductToProduct", $old_pid, $new_pid);
         }
     }
 }
 function output()
 {
     global $application;
     $fargs = func_get_args();
     $start_dir = isset($fargs[4]) ? $fargs[4] : $application->getAppIni('PATH_ASC_ROOT');
     $start_dir = str_replace("\\", "/", $start_dir);
     $browser_type = _ml_strtolower($fargs[0]);
     $template_contents = array('StartFolder' => $start_dir, 'ParentBlock' => $fargs[1], 'ParentField' => $fargs[2], 'PostChoiceJScode' => isset($fargs[3]) ? $fargs[3] : '');
     $this->_Template_Contents = $template_contents;
     $application->registerAttributes($this->_Template_Contents);
     $this->mTmplFiller =& $application->getInstance('TmplFiller');
     return $this->mTmplFiller->fill("shell/" . $browser_type . "_browser/", "container.tpl.html", array());
 }
 function onHook($actionObj)
 {
     switch (_ml_strtolower(get_class($actionObj))) {
         case "confirmdeleteproducts":
             $products_ids = modApiFunc("Catalog", "getEditableProductsID");
             break;
         case "confirmdeletecategory":
             global $application;
             $request =& $application->getInstance('Request');
             $products_ids = explode("|", $request->getValueByKey('ProdsId'));
             break;
     }
     modApiFunc('Product_Files', 'delAllFilesFromProducts', $products_ids);
 }
 function __formatRow($row)
 {
     $row['date'] = $this->__prepareDateToDisplay($row);
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['order_qty'] = modApiFunc("Localization", "num_format", $row['order_qty']);
             $row['order_total_sum'] = modApiFunc("Localization", "currency_format", round($row['order_total_sum'], 2));
             break;
         case 'creportrenderchart':
             $row['order_total_sum'] = round($row['order_total_sum'], 2);
             break;
     }
     return $row;
 }
 function __formatRow($row)
 {
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrendercsv':
             $date = mktime(0, 0, 0, $row['datetime_month'], $row['datetime_day'], $row['datetime_year']);
             $row['date'] = date('Y-m-d', $date);
             break;
         default:
             $date = mktime(0, 0, 0, $row['datetime_month'], $row['datetime_day'], $row['datetime_year']);
             $row['date'] = modApiFunc("Localization", "date_format", $date, false);
             // false - do not apply time shift
             break;
     }
     return $row;
 }
 function __formatRow($row)
 {
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['number'] = modApiFunc("Localization", "num_format", $row['number']);
             $row['bar'] = $this->__getBar($row['percent_pixel']);
             $row['percent'] = modApiFunc("Localization", "num_format", $row['percent']) . '%';
             break;
         default:
             // simple html table, binary excel or chart
             // Let's stay as is.
             break;
     }
     return $row;
 }
 /**
  * Parse .csv file.
  *
  * @example layout and data, relative path
  *      $parser = new CSV_Parser();
  *      list($layout,$data) = $parser->parse_file('example.csv');
  *
  * @example only data, absolute path
  *      $parser = new CSV_Parser();
  *      $data = $parser->parse_file('/home/user/data/example.csv',false);
  *
  * @param $fname - path to the .csv file (absolute or relative)
  * @param $delimetr - CSV delimetr (',' or ';' or '\t')
  * @param $read_layout - true if the first line of file contains the fields names
  * @return array of the data from the .csv file
  *      if $read_layout is true then also return fields layout
  *      if $read_layout is true then return the associative arrays
  *      if $read_layout is false then return the numeric arrays
  */
 function parse_file($fname, $delimetr = ";", $read_layout = true)
 {
     if (!file_exists($fname) or !is_readable($fname)) {
         return false;
     }
     if (!in_array($delimetr, array(",", ";", "\t"))) {
         return false;
     }
     $csv_data = array();
     CProfiler::ioStart($fname, 'read');
     $fh = @fopen($fname, "r");
     if ($fh != false) {
         if ($read_layout) {
             $layout = fgetcsv($fh, 262144, $delimetr);
             $layout = convertImportDataArray($layout);
         }
         while (!feof($fh)) {
             $data = fgetcsv($fh, 262144, $delimetr);
             // skipping empty strings...
             if (empty($data) || count($data) == 1 && $data[0] === null) {
                 continue;
             }
             $data = convertImportDataArray($data);
             $tmp = array();
             if ($read_layout) {
                 for ($i = 0; $i < count($layout); $i++) {
                     if (isset($data[$i])) {
                         $tmp[_ml_strtolower($layout[$i])] = $data[$i];
                     } else {
                         $tmp[_ml_strtolower($layout[$i])] = '';
                     }
                 }
             } else {
                 $tmp = $data;
             }
             $csv_data[] = $tmp;
         }
         fclose($fh);
         CProfiler::ioStop();
         if ($read_layout) {
             return array($layout, $csv_data);
         } else {
             return $csv_data;
         }
     }
     CProfiler::ioStop();
     return false;
 }
 function setReportPeriodLabel($report_class_name, $period_label)
 {
     //         ,             $period_lable
     $labels = $this->getDatetimePeriodLabels(DATETIME_PERIOD_DISCONTINUITY_DAY);
     $correct_period = false;
     foreach ($labels as $l) {
         if (in_array($period_label, $l)) {
             $correct_period = true;
             break;
         }
     }
     if ($correct_period) {
         $params = array('report_class_name' => _ml_strtolower($report_class_name), 'report_period_label' => $period_label);
         execQuery('REPLACE_REPORT_PERIOD', $params);
     }
 }
 function onHook($actionObj)
 {
     $categories_ids = array();
     switch (_ml_strtolower(get_class($actionObj))) {
         case "confirmdeleteproducts":
             $products_ids = modApiFunc("Catalog", "getEditableProductsID");
             break;
         case "confirmdeletecategory":
             global $application;
             $request =& $application->getInstance('Request');
             $products_ids = array_filter(explode("|", $request->getValueByKey('ProdsId')));
             $categories_ids = array_filter(explode("|", $request->getValueByKey('CatsId')));
             break;
     }
     modApiFunc('Featured_Products', 'OnProductsWereDeleted', $products_ids);
     modApiFunc('Featured_Products', 'OnCategoriesWereDeleted', $categories_ids);
 }
Example #20
0
 /**
  * Crypt_Blowfish Constructor
  * Initializes the Crypt_Blowfish object, and sets the secret key
  *
  * @param string $key
  * @param string $mode operating mode 'ecb', 'cbc'...
  * @param string $iv initialization vector
  * @access public
  */
 function Crypt_Blowfish_MCrypt($key = null, $mode = 'ecb', $iv = null)
 {
     $this->_iv = $iv . (_byte_strlen($iv) < 8 ? str_repeat(_byte_chr(0), 8 - _byte_strlen($iv)) : '');
     $this->_td = mcrypt_module_open(MCRYPT_BLOWFISH, '', $mode, '');
     if (is_null($iv)) {
         $this->_iv = mcrypt_create_iv(8, MCRYPT_RAND);
     }
     switch (_ml_strtolower($mode)) {
         case 'ecb':
             $this->_iv_required = false;
             break;
         case 'cbc':
         default:
             $this->_iv_required = true;
             break;
     }
     $this->setKey($key, $this->_iv);
 }
 /**
  *
  */
 function onAction()
 {
     global $application;
     $getRebuildVal = $application->getInstance('Request');
     $rebuildval = $getRebuildVal->getValueByKey('rebuildval');
     if ($rebuildval == 'yes') {
         $lang = _ml_strtolower($application->getAppIni('LANGUAGE'));
         modApiFunc('Resources', 'deleteSYSLabels', 'SYS');
         modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'system-messages-' . $lang . '.ini', 'SYS', 'system_messages', 'AZ');
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_CACHE_UPDATED');
     } else {
         CCacheFactory::clearAll();
         $request = new Request();
         $request->setView(CURRENT_REQUEST_URL);
         $application->redirect($request);
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_CACHE_UPDATED');
     }
 }
 function __formatRow($row)
 {
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['page_url'] = $this->__prepareLongUrl($row['page_url'], 80, 'font-weight: bold; color: #666666;');
             if ($row['next_visit_time'] == null) {
                 $row['visit_time'] = getMsg('RPTS', 'NO_ACTIVITY');
             } else {
                 $duration = strtotime($row['next_visit_time']) - strtotime($row['visit_time']);
                 $row['visit_time'] = modApiFunc("Localization", "formatTimeDuration", $duration);
             }
             break;
         default:
             // simple html table, binary excel or chart
             // Let's stay as is.
             break;
     }
     return $row;
 }
Example #23
0
 function isValid($attr, &$value)
 {
     $method_name = "__is_valid_";
     switch (_ml_strtolower($attr)) {
         case 'accountname':
         case 'email':
         case 'passwd':
         case 'country':
         case 'country_state':
             $method_name .= $attr;
             break;
         default:
             $method_name .= 'string';
             break;
     }
     if (method_exists($this, $method_name)) {
         return $this->{$method_name}($value);
     } else {
         return false;
     }
 }
 function __formatRow($row)
 {
     switch (_ml_strtolower($this->__render_class_name)) {
         case 'creportrenderflattable':
             $row['visit_number'] = modApiFunc("Localization", "num_format", $row['visit_number']);
             if (empty($row['referer'])) {
                 $row['referer'] = getMsg('RPTS', 'DIRECT_ACCESS');
             } else {
                 //        ,                                                   URL
                 $row['referer'] = $this->__prepareLongUrl($row['referer'], 80, 'font-weight: bold; color: #666666;');
             }
             $row['bar'] = $this->__getBar($row['percent_pixel']);
             $row['percent'] = modApiFunc("Localization", "num_format", $row['percent']) . '%';
             break;
         default:
             // simple html table, binary excel or chart
             if (empty($row['referer'])) {
                 $row['referer'] = getMsg('RPTS', 'DIRECT_ACCESS');
             }
             break;
     }
     return $row;
 }
 /**
  * @ describe the function OrderInfo->.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'CustomerInfo':
             $value = $this->getCustomerInfo();
             break;
         case 'BillingInfo':
             $value = $this->getBillingInfo();
             break;
         case 'ShippingInfo':
             $value = $this->getShippingInfo();
             break;
         case 'CreditCardInfo':
             $value = $this->getCreditCardInfo();
             break;
         case 'Orders':
             $value = $this->getOrders();
             break;
         case 'LastOrderId':
             $value = $this->_customer['ID'];
             break;
         case 'CHECKOUT_ORDER_INFO_REMOVE_ENCRYPTED_PERSON_INFO_MSG':
         case 'CHECKOUT_ORDER_INFO_REMOVE_ENCRYPTED_PERSON_INFO_CONFIRM_MSG':
             $value = $this->_msg[$tag];
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'group') {
                 $value = getKeyIgnoreCase($tag, $this->_group);
             } elseif ($entity == 'attribute') {
                 $value = getKeyIgnoreCase($tag, $this->_attr);
             } elseif ($entity == 'order') {
                 if (_ml_strpos($tag, 'price') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('price')));
                     if ($tag == 'total') {
                         $value = $this->_order['Total'];
                     } elseif ($tag == 'subtotal') {
                         $value = $this->_order['Subtotal'];
                     } else {
                         $prices = getKeyIgnoreCase('price', $this->_order);
                         $value = getKeyIgnoreCase($tag, $prices);
                     }
                 } elseif (_ml_strpos($tag, 'customer') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('customer')));
                     $customer = getKeyIgnoreCase('customer', $this->_order);
                     $value = $customer['attr'][$tag]['value'];
                 } else {
                     $value = getKeyIgnoreCase($tag, $this->_order);
                 }
             }
             break;
     }
     return $value;
 }
 /**
  * If for the selected Shipping address only one shipping method
  * (and one shipping module) is available it returns its module id and
  * method id. It returns false otherwise.
  */
 function getTheOnlyAvailableAndComputableShippingMethodId()
 {
     global $application;
     $groups = NULL;
     $SelectedModules = $this->getSelectedModules("shipping");
     $sm_list = $this->getInstalledAndActiveModulesListData("shipping", $groups);
     $there_is_a_shipping_module_with_only_one_available_method = false;
     $res = false;
     foreach ($sm_list as $sm_item) {
         // create/use some mm function to convert class names.
         $name = _ml_strtolower($sm_item->name);
         $smInfo = modApiFunc($name, "getInfo");
         // : check if function exists
         $module_uid = $smInfo['GlobalUniqueShippingModuleID'];
         if (array_key_exists($module_uid, $SelectedModules) == true) {
             /* Check, if for the current address even one method works.
                  Otherwise output a special template "No shipping method
                  available for the inputted address".
                  What should be outputted, if the address hasn't been inputted yet?
                */
             //$methods_info_list = modApiFunc($smInfo['APIClassName'], "getShippingMethods", "AVAILABLE", true);
             # Added by egor
             $formatted_cart = modApiFunc("Shipping_Cost_Calculator", "formatCart", modApiFunc("Cart", "getCartContent"));
             modApiFunc("Shipping_Cost_Calculator", "setShippingInfo", $this->getPrerequisiteValidationResults("shippingInfo"));
             modApiFunc("Shipping_Cost_Calculator", "setCart", $formatted_cart);
             $calculation_result = modApiFunc("Shipping_Cost_Calculator", "calculateShippingCost");
             if (!empty($calculation_result)) {
                 $first_api_result = array_shift($calculation_result);
                 if (isset($first_api_result['methods']) and is_array($first_api_result['methods']) and !empty($first_api_result['methods'])) {
                     $methods_info_list = $first_api_result['methods'];
                 } else {
                     $methods_info_list = array();
                 }
             } else {
                 $methods_info_list = array();
             }
             # end
             if (!empty($methods_info_list)) {
                 if (count($methods_info_list) == 1) {
                     if ($there_is_a_shipping_module_with_only_one_available_method == true) {
                         //This is the SECOND module, which has available methods.
                         return false;
                     } else {
                         $there_is_a_shipping_module_with_only_one_available_method = true;
                         $res = array("module_id" => $module_uid, "method_id" => $methods_info_list[0]["id"]);
                     }
                 } else {
                     if (count($methods_info_list) > 1) {
                         //Which method has more than one available method.
                         return false;
                     }
                 }
             }
         }
     }
     return $res;
 }
 /**
  * @ describe the function ManageOrders->.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'CountByStatus0':
             $value = modApiFunc('Checkout', 'getOrderCount', 0);
             break;
         case 'CountByStatus1':
             $value = modApiFunc('Checkout', 'getOrderCount', 1);
             break;
         case 'CountByStatus2':
             $value = modApiFunc('Checkout', 'getOrderCount', 2);
             break;
         case 'CountByStatus3':
             $value = modApiFunc('Checkout', 'getOrderCount', 3);
             break;
         case 'SearchStatusSelector':
             $this->_simple_selector['options'] = array();
             $status_array = modApiFunc('Checkout', 'getOrderStatusList');
             if (isset($this->_filter['status_id']) && $this->_filter['status_id'] != "") {
                 $this->_simple_selector['selected'] = $this->_filter['status_id'];
             }
             foreach ($status_array as $status) {
                 $sel = 0;
                 if (isset($this->_filter['order_statuses']) && is_array($this->_filter['order_statuses']) && isset($this->_filter['order_statuses'][$status['id']])) {
                     $sel = 1;
                 }
                 $this->_simple_selector['options'][] = array('value' => $status['id'], 'name' => $status['name'], 'selected' => $sel);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-status-selector.tpl.html", array());
             break;
         case 'SearchPaymentStatusSelector':
             $this->_simple_selector['options'] = array();
             if (isset($this->_filter['payment_status_id']) && $this->_filter['payment_status_id'] != "") {
                 $this->_simple_selector['selected'] = $this->_filter['payment_status_id'];
             }
             $status_array = modApiFunc('Checkout', 'getOrderPaymentStatusList');
             foreach ($status_array as $status) {
                 $sel = 0;
                 if (isset($this->_filter['payment_statuses']) && is_array($this->_filter['payment_statuses']) && isset($this->_filter['payment_statuses'][$status['id']])) {
                     $sel = 1;
                 }
                 $this->_simple_selector['options'][] = array('value' => $status['id'], 'name' => $status['name'], 'selected' => $sel);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-payment-status-selector.tpl.html", array());
             break;
         case 'SearchFromDaySelector':
             $this->_simple_selector['selected'] = $this->_filter['from_day'];
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 31; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-from-day-selector.tpl.html", array());
             break;
         case 'SearchFromMonthSelector':
             $this->_simple_selector['selected'] = $this->_filter['from_month'];
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 12; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $this->MessageResources->getMessage("GENERAL_MONTH_" . $num));
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-from-month-selector.tpl.html", array());
             break;
         case 'SearchFromYearSelector':
             $this->_simple_selector['selected'] = $this->_filter['from_year'];
             $this->_simple_selector['options'] = array();
             $curr_year_4digits = date('Y');
             $start_year = (int) modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_START_YEAR');
             $offset_to = modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_YEAR_OFFSET');
             for ($i = $start_year; $i <= $curr_year_4digits + $offset_to; $i++) {
                 $this->_simple_selector['options'][] = array('value' => $i, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-from-year-selector.tpl.html", array());
             break;
         case 'SearchToDaySelector':
             if (empty($this->_filter['to_day']) == false) {
                 $this->_simple_selector['selected'] = $this->_filter['to_day'];
             } else {
                 $this->_simple_selector['selected'] = date("j");
             }
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 31; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-to-day-selector.tpl.html", array());
             break;
         case 'SearchToMonthSelector':
             if (empty($this->_filter['to_month']) == false) {
                 $this->_simple_selector['selected'] = $this->_filter['to_month'];
             } else {
                 $this->_simple_selector['selected'] = date("m");
             }
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 12; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $this->MessageResources->getMessage("GENERAL_MONTH_" . $num));
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-to-month-selector.tpl.html", array());
             break;
         case 'SearchToYearSelector':
             if (empty($this->_filter['to_year']) == false) {
                 $this->_simple_selector['selected'] = $this->_filter['to_year'];
             } else {
                 $this->_simple_selector['selected'] = date("Y");
             }
             $this->_simple_selector['options'] = array();
             $curr_year_4digits = date('Y');
             $start_year = (int) modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_START_YEAR');
             $offset_to = modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_YEAR_OFFSET');
             for ($i = $start_year; $i <= $curr_year_4digits + $offset_to; $i++) {
                 $this->_simple_selector['options'][] = array('value' => $i, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-to-year-selector.tpl.html", array());
             break;
         case 'SimpleSelectorOption':
             $selected = $this->_simple_selector['selected'];
             $value = "";
             foreach ($this->_simple_selector['options'] as $option) {
                 $sel = $option['value'] == $selected ? " selected" : "";
                 $value .= "<OPTION value=\"" . $option['value'] . "\"" . $sel . ">" . $option['name'] . "</OPTION>\n";
             }
             break;
         case 'SimpleCheckBoxGroup_Orders':
             $selected = $this->_simple_selector['selected'];
             $value = "";
             $items_per_col = 2;
             // number of items per column
             $idx = 0;
             $flag = 0;
             foreach ($this->_simple_selector['options'] as $option) {
                 if ($idx % $items_per_col == 0) {
                     $value .= "<TR>\n";
                     $flag = 0;
                 }
                 $sel = "";
                 $highlight = "";
                 if ($option['selected'] == 1) {
                     $sel = "checked";
                     if ($this->_filter['search_by'] == "date") {
                         $highlight = "style='color: black;'";
                     }
                 }
                 $name = "order_" . preg_replace("/ /", "", $option['name']);
                 $value .= "<TD {$highlight}><INPUT class='form-control input-inline input-sm' id='" . $name . "' name='order_status[" . $option['value'] . "]' type='checkbox' " . $sel . "> " . $option['name'] . "</TD>\n";
                 if ($idx % $items_per_col == 0 && $flag == 1) {
                     $value .= "</TR>\n";
                     $flag = 0;
                 }
                 $flag = 1;
                 $idx++;
             }
             break;
         case 'SimpleCheckBoxGroup_Payments':
             $selected = $this->_simple_selector['selected'];
             $value = "";
             $items_per_col = 1;
             // number of items per column
             $idx = 0;
             $flag = 0;
             foreach ($this->_simple_selector['options'] as $option) {
                 if ($idx % $items_per_col == 0) {
                     $value .= "<TR>\n";
                     $flag = 0;
                 }
                 $sel = "";
                 $highlight = "";
                 if ($option['selected'] == 1) {
                     $sel = "checked";
                     if ($this->_filter['search_by'] == "date") {
                         $highlight = "color: black;";
                     }
                 }
                 $name = "payment_" . preg_replace("/ /", "", $option['name']);
                 $value .= "<TD style='margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" . $highlight . "'><INPUT class='form-control input-inline input-sm' id='" . $name . "' name='payment_status[" . $option['value'] . "]' type='checkbox' " . $sel . "> " . $option['name'] . "</TD>\n";
                 if ($idx % $items_per_col == 0 && $flag == 1) {
                     $value .= "</TR>\n";
                     $flag = 0;
                 }
                 $flag = 1;
                 $idx++;
             }
             break;
         case 'ResultCount':
             $from = modApiFunc("Paginator", "getCurrentPaginatorOffset") + 1;
             $to = modApiFunc("Paginator", "getCurrentPaginatorOffset") + modApiFunc("Paginator", "getPaginatorRowsPerPage", "Checkout_Orders");
             $total = modApiFunc("Paginator", "getCurrentPaginatorTotalRows");
             if ($to > $total) {
                 $to = $total;
             }
             if ($total <= modApiFunc("Paginator", "getPaginatorRowsPerPage", "Checkout_Orders")) {
                 $value = $this->MessageResources->getMessage(new ActionMessage(array("ORDERS_RESULTS_LESS_THEN_ROWS_PER_PAGE_FOUND", $total)));
             } else {
                 $value = $this->MessageResources->getMessage(new ActionMessage(array("ORDERS_RESULTS_MORE_THEN_ROWS_PER_PAGE_FOUND", $from, $to, $total)));
             }
             break;
         case 'ResultDateRange':
             $count = count($this->_orders);
             if ($count == 0) {
                 $value = "";
                 break;
             } elseif ($count == 1) {
                 $orderInfo = $this->_fetched_orders[$this->_orders[0]];
                 $value = modApiFunc("Localization", "SQL_date_format", $orderInfo['order_date']);
                 break;
             }
             $first_in_list_order_info = $this->_fetched_orders[$this->_orders[0]];
             $last_in_list_order_info = $this->_fetched_orders[$this->_orders[$count - 1]];
             $value = $value = modApiFunc("Localization", "SQL_date_format", $last_in_list_order_info['order_date']) . " - " . modApiFunc("Localization", "SQL_date_format", $first_in_list_order_info['order_date']);
             break;
         case 'ResultAmount':
             if (count($this->_orders) == 0) {
                 $value = 0;
                 break;
             }
             $amount = 0;
             $all_orders_are_in_main_currency = true;
             $main_store_currency = modApiFunc("Localization", "getCurrencyCodeById", modApiFunc("Localization", "getMainStoreCurrency"));
             foreach ($this->_orders as $order_id) {
                 //           order_total   main_store_currency       .
                 //           order'                      ,                                 default ( . .
                 //       main_store_currency                 ).
                 //     default currency                                                 main_store_currency,
                 //                                               ,            .          order_total
                 //                                          .
                 $order_default_currency = modApiFunc("Localization", "getOrderMainCurrency", $order_id, $this->_fetched_orders[$order_id]['order_currencies_list']);
                 $order_total_in_order_default_currency = $this->_fetched_orders[$order_id]['price_total'][$order_default_currency]['order_total'];
                 if ($order_default_currency == $main_store_currency) {
                     //var_dump($order);
                     $amount += $order_total_in_order_default_currency;
                 } else {
                     $all_orders_are_in_main_currency = false;
                     $total = modApiFunc('Currency_Converter', 'convert', $order_total_in_order_default_currency, $order_default_currency, $main_store_currency);
                     $amount += $total;
                 }
             }
             $main_store_currency_id = modApiFunc("Localization", "getMainStoreCurrency");
             modApiFunc("Localization", "pushDisplayCurrency", $main_store_currency_id, $main_store_currency_id);
             $value = modApiFunc("Localization", "currency_format", $amount);
             modApiFunc("Localization", "popDisplayCurrency");
             if ($all_orders_are_in_main_currency == false) {
                 $value = "~" . $value;
             }
             break;
         case 'ResultTaxTotal':
             break;
         case 'ResultFullTaxExempt':
             break;
         case 'ResultTaxTotalMinusFullTaxExempt':
             $tax_summary = $this->__getTaxSummary();
             $value = $tax_summary[$tag];
             break;
         case 'Items':
             $value = $this->getOrders();
             break;
         case 'OrderStatusSelector':
             $value = '<select class="form-control input-sm input-small" name="status_id[' . $this->_order['IdInt'] . ']" onchange="onStatusChanged(' . $this->_order['IdInt'] . ')">';
             if (!isset($this->OrderStatusList)) {
                 $this->OrderStatusList = modApiFunc('Checkout', 'getOrderStatusList');
             }
             foreach ($this->OrderStatusList as $status) {
                 $value .= '<option value="' . $status['id'] . '" ' . ($status['id'] == $this->_order['StatusId'] ? " selected" : "") . '>' . $status['name'] . '</option>';
             }
             $value .= '</select>';
             break;
         case 'OrderIdLinkTitle':
             $value = $this->MessageResources->getMessage('ORDERS_RESULTS_ORDER_ID_LINK_TITLE');
             break;
         case 'OrderCustomerNameLinkTitle':
             $value = $this->MessageResources->getMessage('ORDERS_RESULTS_ORDER_CUSTOMER_NAME_LINK_TITLE');
             break;
         case 'OrderPaymentStatusSelector':
             $value = '<select class="form-control input-sm input-small" name="payment_status_id[' . $this->_order['IdInt'] . ']" onchange="onStatusChanged(' . $this->_order['IdInt'] . ')">\\n';
             if (!isset($this->OrderPaymentStatusList)) {
                 $this->OrderPaymentStatusList = modApiFunc('Checkout', 'getOrderPaymentStatusList');
             }
             foreach ($this->OrderPaymentStatusList as $status) {
                 $this->_payment_status = $status;
                 $value .= '<option value="' . $status['id'] . '" ' . ($status['id'] == $this->_order['PaymentStatusId'] ? ' selected' : '') . '>' . $status['name'] . '</option>';
             }
             $value .= '</select>';
             break;
         case 'SearchOrders':
             $value = $this->TemplateFiller->fill("checkout/orders/", "search.tpl.html", array());
             break;
         case 'SearchBy':
             if ($this->_filter['search_by'] == 'status') {
                 $msg = "";
                 switch ($this->_filter['filter_status_id']) {
                     case 0:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_ALL');
                         break;
                     case 1:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_NEW_ORDERS');
                         break;
                     case 2:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_IN_PROGRESS');
                         break;
                     case 3:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_READY_TO_SHIP');
                         break;
                 }
                 $value = $msg;
             } elseif ($this->_filter['search_by'] == 'date') {
                 $value = $this->MessageResources->getMessage('ORDERS_SEARCH_FILTER');
             } elseif ($this->_filter['search_by'] == 'id') {
                 $value = $this->MessageResources->getMessage('ORDERS_SEARCH_ORDER_ID');
             }
             break;
         case 'SearchResults':
             if (count($this->_orders) == 0) {
                 $value = modApiFunc('TmplFiller', 'fill', "checkout/orders/", "empty.tpl.html", array());
             } else {
                 $value = $this->TemplateFiller->fill("checkout/orders/", "results.tpl.html", array());
             }
             break;
         case 'HighLightAll':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 0) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightNewOrders':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 1) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightInProgress':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 2) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightReadyToShip':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 3) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightDate':
             if ($this->_filter['search_by'] == 'date') {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightDateOrderStatus':
             if ($this->_filter['search_by'] == 'date' && isset($this->_filter['order_statuses'])) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightDateOrderPaymentStatus':
             if ($this->_filter['search_by'] == 'date' && isset($this->_filter['payment_statuses'])) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightOrderId':
             if ($this->_filter['search_by'] == 'id') {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightAffiliateId':
             if ($this->_filter['search_by'] == 'date' && !empty($this->_filter['affiliate_id'])) {
                 $value = "style='color: blue;font-weight:bold;'";
             }
             break;
         case 'SearchingOrderId':
             $value = "";
             if ($this->_filter['search_by'] == 'id' && !empty($this->_filter['order_id'])) {
                 $value = $this->_filter['order_id'];
             }
             break;
         case 'DeleteOrdersLink':
             $request = new Request();
             $request->setView('DeleteOrders');
             $request->setAction('SetOrdersForDeleteAction');
             $value = $request->getURL();
             break;
         case 'PaginatorLine':
             $obj =& $application->getInstance($tag);
             $value = $obj->output("Checkout_Orders", "Orders");
             break;
             #                               PaginatorRows
         #                               PaginatorRows
         case 'PaginatorRows':
             $obj =& $application->getInstance($tag);
             $value = $obj->output("Checkout_Orders", 'Orders', 'PGNTR_ORD_ITEMS');
             break;
         case 'ResultMessageRow':
             $value = $this->outputResultMessage();
             break;
         case 'ResultMessage':
             $value = $this->_Template_Contents['ResultMessage'];
             break;
         case 'PackingSlipLink':
             $request = new Request();
             $request->setView('OrderPackingSlip');
             $request->setAction('SetCurrentOrder');
             $request->setKey('order_id', $this->_order['IdInt']);
             // uncomment the following link to force printing
             // $request -> setKey('do_print', 'Y');
             $value = $request->getURL();
             break;
         case 'InvoiceLink':
             $request = new Request();
             $request->setView('OrderInvoice');
             $request->setAction('SetCurrentOrder');
             $request->setKey('order_id', $this->_order['IdInt']);
             // uncomment the following link to force printing
             // $request -> setKey('do_print', 'Y');
             $value = $request->getURL();
             break;
         case 'AffiliateIDSearch':
             $v = isset($this->_filter['affiliate_id']) ? $this->_filter['affiliate_id'] : "";
             $value = "<input type='text' name='affiliate_id' size='28' class='form-control form-filter input-sm' value='" . $v . "' />";
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'order') {
                 if (_ml_strpos($tag, 'price') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('price')));
                     if ($tag == 'total') {
                         $value = $this->_order['Total'];
                         if ($this->_order['TotalInMainStoreCurrency'] !== NULL) {
                             $value = $this->_order['TotalInMainStoreCurrency'] . ' (' . $value . ')';
                         }
                     } elseif ($tag == 'subtotal') {
                         $value = $this->_order['Subtotal'];
                     } else {
                         if ($tag == 'taxes') {
                             $full_tax_exempt_orders = $this->__getFullTaxExemptOrders();
                             $code = $this->_fetched_orders[$this->_order['IdInt']]["order_currencies_list"]["CURRENCY_TYPE_MAIN_STORE_CURRENCY"]["currency_code"];
                             $value = $this->_fetched_orders[$this->_order['IdInt']]["price_total"][$code]["order_tax_total"];
                             $crcy_id = modApiFunc("Localization", "getCurrencyIdByCode", $code);
                             modApiFunc("Localization", "pushDisplayCurrency", $crcy_id, $crcy_id);
                             $value = modApiFunc("Localization", "currency_format", $value);
                             $null_value = modApiFunc("Localization", "currency_format", "0.0000");
                             modApiFunc("Localization", "popDisplayCurrency");
                             if (array_key_exists($this->_order['IdInt'], $full_tax_exempt_orders)) {
                                 $value = $null_value . " (ex. {$value})";
                             }
                         } else {
                             $prices = getKeyIgnoreCase('price', $this->_order);
                             $value = $prices[$tag];
                         }
                     }
                 } elseif (_ml_strpos($tag, 'customer') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('customer')));
                     switch ($tag) {
                         case 'name':
                             $value = $this->_order['PersonName'];
                             break;
                         case 'id':
                             $value = $this->_order['PersonId'];
                             break;
                         case 'infoname':
                             $value = $this->_order['PersonInfoName'];
                             break;
                     }
                 } else {
                     $value = getKeyIgnoreCase($tag, $this->_order);
                 }
             }
             break;
     }
     return $value;
 }
 /**
  * Outputs language filter
  */
 function outputLangSelect()
 {
     $values = array();
     $default_language = modApiFunc('MultiLang', 'getDefaultLanguage');
     // if list of languages is empty create a hidden field
     if (!is_array($this->_languages) || empty($this->_languages)) {
         return getMsg('ML', 'ML_DEFAULT') . '<input type="hidden" ' . HtmlForm::genHiddenField('lng', '') . ' />';
     }
     foreach ($this->_languages as $v) {
         $values[] = array('value' => $v['lng'], 'contents' => $v['lng_name'] . ($v['lng'] == $default_language ? ' (' . _ml_strtolower(getMsg('ML', 'ML_DEFAULT')) . ')' : ''));
     }
     return HtmlForm::genDropdownSingleChoice(array('select_name' => 'lng', 'selected_value' => @$this->_search_filter['lng'], 'id' => 'lng', 'values' => $values, 'onChange' => 'checkLanguage(this); this.form.submit();'));
 }
Example #29
0
 function addSelectTableByField($field)
 {
     if ($pos = _ml_strpos($field, '.')) {
         $table_name = _ml_substr($field, 0, $pos);
         //      $field                           ,
         if (_ml_strpos($table_name, '(') || _ml_strpos(_ml_strtolower($table_name), 'distinct') !== false) {
             return;
         }
         //DB_Select::addSelectTable($table_name)
         if (!array_key_exists($table_name, $this->SelectTables)) {
             $add_from = true;
             if (!empty($this->SelectJoins)) {
                 foreach ($this->SelectJoins as $value) {
                     if ($value['TABLE'] == $table_name || $value['ALIAS'] == $table_name) {
                         $add_from = false;
                     }
                 }
             }
             if ($add_from) {
                 $this->SelectTables[$table_name] = '';
             }
         }
     }
 }
 /**
  * Returns true if the specified tag exists in the given product object.
  * It searches among all the available tags:
  * - additional
  * - artificial
  * - in the attribute database.
  *
  * @param string $tag Tag name
  * @return boolean Return true if tag name exists in the object
  */
 function isTagExists($tag)
 {
     /*
      If creating an object the incorrect id was passed to the category, then
      the method will return false for any tag.
     */
     if ($this->_fCategoryIDIsIncorrect == true) {
         return $this->debugmode ? 'Category ID is incorrect' : false;
     }
     # Check additional tag list
     if (array_key_exists($tag, $this->_fAdditionalTagList)) {
         return true;
     }
     # Check artificial tag list
     if (array_key_exists(_ml_strtolower($tag), $this->_fArtificialTagList)) {
         return true;
     }
     return false;
 }