/**
  * @ describe the function AddCategory->getTag.
  */
 function getTag($tag)
 {
     global $application;
     $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
     if ($value == null) {
         switch ($tag) {
             case 'Breadcrumb':
                 $obj =& $application->getInstance('Breadcrumb');
                 $value = $obj->output(false);
                 break;
             case 'ErrorIndex':
                 $value = $this->_error_index;
                 break;
             case 'Error':
                 $value = $this->_error;
                 break;
         }
     }
     return $value;
 }
 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 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;
 }
 function getTag($tag)
 {
     return getKeyIgnoreCase($tag, $this->_Template_Contents);
 }
 function getSortLink($tag)
 {
     # THIS FUNCTION TEMPORARY DISABLED
     return getMsg('CTL', 'LINK_NAME_' . getKeyIgnoreCase($tag, $this->__sort_tag_suffix));
     list($curr_sort_field, $curr_sort_direction) = modApiFunc('CProductListFilter', 'getCurrentSortField');
     $_sort_field = getKeyIgnoreCase($tag, $this->__sort_tag_suffix);
     if ($curr_sort_field == $_sort_field) {
         if ($curr_sort_direction == SORT_DIRECTION_ASC) {
             $_sort_direction = SORT_DIRECTION_DESC;
             $_template_name = "sort_link_asc.tpl.html";
         } else {
             $_sort_direction = SORT_DIRECTION_ASC;
             $_template_name = "sort_link_desc.tpl.html";
         }
     } else {
         $_sort_direction = SORT_DIRECTION_ASC;
         $_template_name = "sort_link.tpl.html";
     }
     $_request = new Request();
     $_request->setView('ProductList');
     $_request->setAction('SetProductListSortField');
     $_request->setKey('field', $_sort_field . ',' . $_sort_direction);
     $params = array('LINK_HREF' => $_request->getURL(), 'LINK_NAME' => getMsg('CTL', 'LINK_NAME_' . $_sort_field));
     $value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", $_template_name, $params);
     return $value;
 }
 function getTag($tag)
 {
     global $application;
     switch ($tag) {
         case "ErrorIndex":
             $value = $this->_error_index;
             break;
         case "Error":
             $value = $this->_error;
             break;
         case 'ResultMessage':
             $value = $this->_Template_Contents['ResultMessage'];
             break;
         default:
             $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
             if ($value === NULL) {
                 $value = getKeyIgnoreCase($tag, $this->_CCType);
             }
             break;
     }
     return $value;
 }
 /**
  * @param $tag name of the requested tag
  * @return value of the tag
  */
 function getTag($tag)
 {
     global $application;
     $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
     return $value;
 }
 function getTag($tag)
 {
     // overriding paginator line
     if ($tag == 'PaginatorLine') {
         return getPaginatorLine($this->_pagname, $this->_pagblock, modApiFunc('CProductListFilter', 'getCurrentCategoryId'), $this->product_id);
     }
     // overriding paginator dropdown
     if ($tag == 'PaginatorDropdown') {
         return getPaginatorDropdown($this->_pagname, $this->_pagblock, 'customer reviews');
     }
     return getKeyIgnoreCase($tag, $this->_Template_Contents);
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         default:
             $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
             break;
     }
     return $value;
 }
 /**
  * Returns the tag output, whose name is specified in $tag.
  */
 function getTag($tag)
 {
     global $application;
     $value = "";
     if ($tag == "Error") {
         $value = $this->_error;
     } elseif ($tag == "ErrorIndex") {
         $value = $this->_error_index;
     } else {
         $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
     }
     return $value;
 }
 /**
  * Processes tags in the templates for the given view.
  *
  * @return string tag value, if tag has been processed. NULL, otherwise.
  */
 function getTag($tag)
 {
     $args = func_get_args();
     array_shift($args);
     $second_arg = @array_shift($args);
     $sort_direction = @$second_arg[0];
     if ($sort_direction === SORT_DIRECTION_DESC) {
         $sort_direction = SORT_DIRECTION_DESC;
     } else {
         $sort_direction = SORT_DIRECTION_ASC;
     }
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_LinkList':
             $value = $this->outputLinkList();
             break;
         case 'Local_Href':
             $value = $this->_local_href_tag;
             break;
         case 'Local_Name':
             $value = $this->_local_name_tag;
             break;
         default:
             if (_ml_strpos($tag, $this->__href_tag_prefix) === 0) {
                 $sort_field_key = _ml_substr($tag, _ml_strlen($this->__href_tag_prefix));
                 $sort_field = getKeyIgnoreCase($sort_field_key, $this->__sort_field_list);
                 $_request = new Request();
                 #$_request->setView('ProductList');
                 #$_request->setCategoryID($this->__current_category_id);
                 $_request->setView(CURRENT_REQUEST_URL);
                 $_request->setAction('SetProductListSortField');
                 $_request->setKey('field', $sort_field . ',' . $sort_direction);
                 $value = $_request->getURL();
             }
     }
     return $value;
 }
 /**
  * Otputs the view.
  *
  * @ $request->setView  ( '' ) - define the view name
  */
 function outputGA()
 {
     global $application;
     $last_placed_order_id = modApiFunc("Checkout", "getLastPlacedOrderID");
     if ($last_placed_order_id !== NULL) {
         $settings = TransactionTracking::getModulesSettings();
         $GA_ACCOUNT_NUMBER = $settings[MODULE_GOOGLE_ANALYTICS_UID]['GA_ACCOUNT_NUMBER'];
         $container_template = TransactionTracking::getIncludedFileContents("google_analytics_container.tpl.html");
         $item_template = TransactionTracking::getIncludedFileContents("google_analytics_item.tpl.html");
         $orderInfo = modApiFunc("Checkout", "getOrderInfo", $last_placed_order_id, modApiFunc("Localization", "whichCurrencySendOrderToPaymentShippingGatewayIn", $last_placed_order_id, GET_PAYMENT_MODULE_FROM_ORDER));
         $ITEMS = "";
         foreach ($orderInfo['Products'] as $product_info) {
             $handpicked_options = "";
             for ($j = 0; $j < count($product_info['options']); $j++) {
                 $handpicked_options .= $product_info['options'][$j]['option_name'] . ": " . $product_info['options'][$j]['option_value'] . ";";
             }
             $handpicked_options = htmlspecialchars($handpicked_options);
             $SKU = getKeyIgnoreCase('SKU', $product_info['attr']);
             $SKU = $SKU['value'];
             $SalePrice = getKeyIgnoreCase('SalePrice', $product_info['attr']);
             $SalePrice = $SalePrice['value'];
             $item_data = array("ORDER_ID" => $last_placed_order_id, "SKU" => $SKU, "PRODUCT_NAME" => $product_info['name'], "CATEGORY" => $handpicked_options, "PRICE" => $SalePrice, "QUANTITY" => $product_info['qty']);
             $encoded_item_data = array();
             foreach ($item_data as $key => $value) {
                 $encoded_item_data[$key] = htmlspecialchars($value);
             }
             $ITEMS .= strtr($item_template, $encoded_item_data) . "\n";
         }
         //                               CITY, STATE, COUNTRY -        .           Shipping -             ,
         //       ,           Billing -             .
         if (!empty($orderInfo['Shipping']['attr'])) {
             $person_info = $orderInfo['Shipping']['attr'];
         } else {
             $person_info = $orderInfo['Billing']['attr'];
         }
         $CITY = getKeyIgnoreCase("city", $person_info);
         $CITY = $CITY['value'];
         $STATE = getKeyIgnoreCase("state", $person_info);
         $STATE = $STATE['value'];
         $COUNTRY = getKeyIgnoreCase("country", $person_info);
         $COUNTRY = $COUNTRY['value'];
         $currency_id = modApiFunc("Localization", "whichCurrencySendOrderToPaymentShippingGatewayIn", $last_placed_order_id, GET_PAYMENT_MODULE_FROM_ORDER);
         $container_data = array("UA-XXXXX-1" => $GA_ACCOUNT_NUMBER, "ORDER_ID" => $last_placed_order_id, "AFFILIATION" => modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_OWNER_NAME), "TOTAL" => modApiFunc("Checkout", "getOrderPrice", "Total", $currency_id), "TAX" => $this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "Tax", $currency_id)), "SHIPPING" => $this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "TotalShippingAndHandlingCost", $currency_id)), "CITY" => $CITY, "STATE" => $STATE, "COUNTRY" => $COUNTRY);
         $encoded_container_data = array();
         foreach ($container_data as $key => $value) {
             $encoded_container_data[$key] = htmlspecialchars($value);
         }
         $encoded_container_data["ITEMS"] = $ITEMS;
         $value = strtr($container_template, $encoded_container_data) . "\n";
         return $value;
     } else {
         return "";
     }
 }
 function getTag($tag)
 {
     $res = null;
     if ($tag == 'MessagesList' || $tag == 'SelfUrl') {
         $res = getKeyIgnoreCase($tag, $this->_templateContents);
     } else {
         $res = getKeyIgnoreCase($tag, $this->_listTemplateContents);
     }
     return $res;
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'ListManageExtensionItems':
             $value = $this->outputExtDetailList();
             if ($value == "") {
                 $value = '<div style="font-weight:bold;padding: 44px;text-align: center;">' . getMsg('SYS', 'NO_EXT_INSTALLED_MSG') . '</div>';
             }
             break;
         case 'StatusMessage':
             $value = $this->outputStatusMessage();
             break;
         case 'UninstallMessage':
             $value = $this->outputUninstallMessage();
             break;
         case 'SelectExtensionType':
             $value = $this->outputExtensionTypeFilterSelect();
             break;
         case 'ReloadMarketPlace':
             $value = "configure-extensions.php?reload";
             break;
         case 'ErrorMessage':
             $value = $this->outputErrorMessage();
             break;
         case 'Local_ConfigureURL':
             $value = 'configure-extensions.php';
             break;
         default:
             $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
             break;
     }
     return $value;
 }
 function getTag($tag)
 {
     $value = null;
     if ($tag == 'ErrorIndex') {
         $value = $this->_errorIndex;
     } else {
         if ($tag == 'Error') {
             $value = $this->_error;
         } else {
             $value = getKeyIgnoreCase($tag, $this->_templateContents);
         }
     }
     return $value;
 }
 /**
  * @ describe the function ManageOrders->.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'SearchCustomers':
             $application->registerAttributes(array('CustomersSearchByField', 'CustomersSearchByFieldValue', 'CustomersSearchByLetter'));
             $value = $this->TemplateFiller->fill("checkout/customers/", "search.tpl.html", array());
             break;
         case 'CustomersSearchByLetter':
             $value = "<td style='vertical-align: bottom'><a href='customers.php?asc_action=CustomersSearchByLetter&letter='>" . $this->MessageResources->getMessage('CUSTOMERS_SEARCH_ALL') . "</a></td><td>";
             for ($i = 65; $i <= 90; $i++) {
                 $letter = _byte_chr($i);
                 if ($this->_filter['search_by'] == 'letter' && !empty($this->_filter['letter'])) {
                     if (_byte_chr($i + 32) == $this->_filter['letter']) {
                         $letter = "<span class='required'>" . _byte_chr($i) . "</span>";
                     }
                 }
                 $value .= "<a href='customers.php?asc_action=CustomersSearchByLetter&letter=" . _byte_chr($i + 32) . "'><b>" . $letter . "</b></a>&nbsp;";
             }
             $value .= "</td>";
             break;
         case 'CustomersSearchByField':
             $value = "<OPTION value='name'>" . $this->MessageResources->getMessage("CUSTOMERS_SEARCH_BY_NAME") . "</OPTION>";
             if ($this->_filter['search_by'] == 'field' && !empty($this->_filter['field_name']) && $this->_filter['field_name'] == 'Email') {
                 $value .= "<OPTION value='Email' selected>" . $this->MessageResources->getMessage("CUSTOMERS_SEARCH_BY_EMAIL") . "</OPTION>";
             } else {
                 $value .= "<OPTION value='Email'>" . $this->MessageResources->getMessage("CUSTOMERS_SEARCH_BY_EMAIL") . "</OPTION>";
             }
             break;
         case 'CustomersSearchByFieldValue':
             $value = '';
             if ($this->_filter['search_by'] == 'field' && !empty($this->_filter['field_name']) && !empty($this->_filter['field_value'])) {
                 $value = $this->_filter['field_value'];
             }
             break;
         case 'SearchResults':
             if (count($this->_customers) == 0) {
                 $value = $this->TemplateFiller->fill("checkout/customers/", "empty.tpl.html", array());
             } else {
                 $value = $this->TemplateFiller->fill("checkout/customers/", "results.tpl.html", array());
             }
             break;
         case 'Items':
             $value = $this->getCustomers();
             break;
         case 'CustomerId':
             $value = getKeyIgnoreCase('Id', $this->_customer);
             break;
         case 'ResultCount':
             $from = modApiFunc("Paginator", "getCurrentPaginatorOffset") + 1;
             $to = modApiFunc("Paginator", "getCurrentPaginatorOffset") + modApiFunc("Paginator", "getPaginatorRowsPerPage", "Checkout_Customers");
             $total = modApiFunc("Paginator", "getCurrentPaginatorTotalRows");
             if ($to > $total) {
                 $to = $total;
             }
             if ($total <= modApiFunc("Paginator", "getPaginatorRowsPerPage", "Checkout_Customers")) {
                 $value = $this->MessageResources->getMessage(new ActionMessage(array("CUSTOMERS_RESULTS_LESS_THEN_ROWS_PER_PAGE_FOUND", $total)));
             } else {
                 $value = $this->MessageResources->getMessage(new ActionMessage(array("CUSTOMERS_RESULTS_MORE_THEN_ROWS_PER_PAGE_FOUND", $from, $to, $total)));
             }
             break;
         case 'CustomerTotalOrders':
             $value = getKeyIgnoreCase('TotalOrders', $this->_customer);
             break;
         case 'CustomerTotalAmount':
             $value = modApiFunc("Localization", "currency_format", getKeyIgnoreCase('TotalAmount', $this->_customer));
             break;
         case 'PaginatorLine':
             $obj =& $application->getInstance($tag);
             $value = $obj->output("Checkout_Customers", "Customers");
             break;
             #                               PaginatorRows
         #                               PaginatorRows
         case 'PaginatorRows':
             $obj =& $application->getInstance($tag);
             $value = $obj->output("Checkout_Customers", 'Customers', 'PGNTR_CUST_ITEMS');
             break;
         case 'CustomerRegStatus':
             $customerInfo = getKeyIgnoreCase('Customer', $this->_customer);
             $email = getKeyIgnoreCase('Email', $customerInfo['attr']);
             if (modApiFunc('Customer_Account', 'doesAccountExists', $email['value'])) {
                 $value = 'reg';
             } else {
                 $value = 'not-reg';
             }
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'customer') {
                 $customerInfo = getKeyIgnoreCase('Customer', $this->_customer);
                 if (!($tagvalue = getKeyIgnoreCase($tag, $customerInfo['attr']))) {
                     break;
                 }
                 $value = $tagvalue['value'];
             }
             break;
     }
     return $value;
 }
 function getTag($tag)
 {
     global $application;
     switch ($tag) {
         case "ErrorIndex":
             $value = $this->_error_index;
             break;
         case "Error":
             $value = $this->_error;
             break;
         default:
             $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
             break;
     }
     return $value;
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'HiddenArrayViewState':
             $value = $this->outputViewState();
             break;
         case 'MessageBox':
             $value = $this->getMessageBox();
             break;
         case 'Messages':
             $value = $this->__msg;
             break;
         case 'Errors':
             $value = '';
             //$this->__msg;
             break;
         case 'CreditCardAttributesAction':
             loadCoreFile('html_form.php');
             $HtmlForm1 = new HtmlForm();
             $request = new Request();
             $request->setView('CreditCardAttributes');
             $request->setAction("UpdateCreditCardAttributes");
             $request->setKey('cc_id', $this->cc_id);
             $form_action = $request->getURL();
             $value = $HtmlForm1->genForm($form_action, "POST", "CreditCardAttributesForm");
             break;
         case "CardName":
             $value = '';
             if (isset($this->card['name'])) {
                 $value = $this->card['name'];
             }
             break;
         case 'Items':
             $value = '';
             foreach ($this->attr as $id => $a) {
                 $value .= $this->outputItem($id);
             }
             break;
         default:
             $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
             break;
     }
     return $value;
 }
 /**
  * Processes tags in the templates for the given view.
  *
  * @return string tag value, if tag has been processed. NULL, otherwise.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_JSfuncProductFormSubmit':
             $value = "<script type=\"text/javascript\">" . "function ProductFormSubmit_" . $this->_ProductInfo['ID'] . "()" . "{" . " document.forms['ProductForm_" . $this->_ProductInfo['ID'] . "'].submit();" . "};" . "</script>";
             break;
         case 'Local_ProductStockWarnings':
             if (!modApiFunc('Session', 'is_set', 'StockDiscardedBy')) {
                 $value = '';
             } else {
                 $stock_discarded_by = modApiFunc('Session', 'get', 'StockDiscardedBy');
                 modApiFunc('Session', 'un_set', 'StockDiscardedBy');
                 $value = $stock_discarded_by;
                 //cz_getMsg($stock_discarded_by);
             }
             break;
         case 'Local_ProductFormStart':
             $value = '<form action="cart.php" name="ProductForm_' . $this->_ProductInfo['ID'] . '" id="ProductForm_' . $this->_ProductInfo['ID'] . '" method="post" enctype="multipart/form-data">
                       <input type="hidden" name="asc_action" value="AddToCart" />
                       <input type="hidden" name="prod_id" value="' . $this->_ProductInfo['ID'] . '" />
                     <script type="text/javascript">
                     function ProductFormSubmit_' . $this->_ProductInfo['ID'] . '()
                     {
                         document.forms[\'ProductForm_' . $this->_ProductInfo['ID'] . '\'].submit();
                     };
                     </script>';
             break;
         case 'Local_ProductFormEnd':
             $value = '</form>';
             break;
         case 'Local_ProductAddToCart':
             $value = 'javascript: ProductFormSubmit_' . $this->_ProductInfo['ID'] . '();';
             break;
         case 'ProductOptionsForm':
             $value = getOptionsChoice($this->_ProductInfo['ID']);
             break;
         case 'Local_FormQuantityFieldName':
             $value = 'quantity_in_cart';
             break;
         case 'Local_ProductQuantityOptions':
             $qty_in_cart = modApiFunc("Cart", "getProductQuantity", $this->_ProductInfo['ID']);
             $value = modApiFunc("Cart", "getProductQuantityOptions", $qty_in_cart, $this->_ProductInfo['ID']);
             break;
         case 'RelatedProducts':
             $value = $this->_rp_output;
             //                           output
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'product') {
                 $value = getKeyIgnoreCase($tag, $this->_ProductInfo);
             }
             break;
     }
     return $value;
 }
 /**
  * Processes tags in the templates for the given view.
  *
  * @return string tag value, if the tag is not processed. NULL otherwise.
  */
 function getTag($tag)
 {
     $value = null;
     switch ($tag) {
         case 'Items':
             $value = $this->outputCheckoutNavigationBarList();
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'step') {
                 $value = getKeyIgnoreCase($tag, $this->_Step_Info);
             }
             break;
     }
     return $value;
 }
 function getTag($tag)
 {
     if (getKeyIgnoreCase($tag, $this->_Template_Contents) == null) {
         if (preg_match("/Product(.+)/", $tag, $matches)) {
             //return $this->currentSL_obj->getProductTagValue($matches[1]);
         }
     } else {
         return getKeyIgnoreCase($tag, $this->_Template_Contents);
     }
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Items':
             $value = $this->getModulesList();
             break;
         case 'ShippingModulesList':
             $value = "Shipping Modules List";
             break;
             /*            case 'SubmitedCheckoutStoreBlocksListItemName':
                           $value = "SubmitedCheckoutStoreBlocksList[shipping-method-list-input]";
                           break;*/
         /*            case 'SubmitedCheckoutStoreBlocksListItemName':
                       $value = "SubmitedCheckoutStoreBlocksList[shipping-method-list-input]";
                       break;*/
         case 'List_SelectedModules':
             $items = array();
             $SelectedModules = modApiFunc("Checkout", "getSelectedModules", "shipping");
             $new_selected_module_sort_order = 0;
             $modules = $this->getInstalledModulesListData();
             foreach ($modules as $module) {
                 $name = _ml_strtolower($module->name);
                 $Shipping_group = modApiFunc("Checkout", "getShippingModuleGroup", $module);
                 if ($Shipping_group != '') {
                     $smInfo = modApiFunc($name, "getInfo");
                     //// INCORRECT method to get group name! Remove group name from id at all.
                     //$groups_array = explode(',', $module->groups);
                     if (array_key_exists($smInfo['GlobalUniqueShippingModuleID'], $SelectedModules)) {
                         $ShippingModulesGroupsInfo = modApiFunc("Checkout", "getShippingModulesGroupsInfo");
                         //If sort id is not defined then assign the highest possible sort id to this item: 0, -1, -2 ...
                         $sort_id = empty($SelectedModules[$smInfo["GlobalUniqueShippingModuleID"]]["sort_order"]) ? $new_selected_module_sort_order-- : $SelectedModules[$smInfo["GlobalUniqueShippingModuleID"]]["sort_order"];
                         $items[$sort_id] = "<option value=\"" . $smInfo['GlobalUniqueShippingModuleID'] . "\" id=\"" . $smInfo['GlobalUniqueShippingModuleID'] . "\">" . prepareHTMLDisplay($smInfo["Name"]) . "</option>";
                     }
                 }
             }
             //Sort items by sort id and implode them.
             ksort($items, SORT_NUMERIC);
             $value = implode("", $items);
             break;
         case 'HiddenSelectedModules':
             //Hidden field to store selected ("Selected Shipping Modules") select state
             $value = "";
             $SelectedModules = modApiFunc("Checkout", "getSelectedModules", "shipping");
             $new_selected_module_sort_order = 0;
             $modules = $this->getInstalledModulesListData();
             foreach ($modules as $module) {
                 $name = _ml_strtolower($module->name);
                 $Shipping_group = modApiFunc("Checkout", "getShippingModuleGroup", $module);
                 if ($Shipping_group != '') {
                     $smInfo = modApiFunc($name, "getInfo");
                     //// INCORRECT method to get group name! Remove group name from id at all.
                     //$groups_array = explode(',', $module->groups);
                     if (array_key_exists($smInfo['GlobalUniqueShippingModuleID'], $SelectedModules)) {
                         $ShippingModulesGroupsInfo = modApiFunc("Checkout", "getShippingModulesGroupsInfo");
                         //If sort id is not defined then assign the highest possible sort id to this item: 0, -1, -2 ...
                         $sort_id = empty($SelectedModules[$smInfo["GlobalUniqueShippingModuleID"]]["sort_order"]) ? $new_selected_module_sort_order-- : $SelectedModules[$smInfo["GlobalUniqueShippingModuleID"]]["sort_order"];
                         $value .= $value == "" ? $smInfo['GlobalUniqueShippingModuleID'] : "," . $smInfo['GlobalUniqueShippingModuleID'];
                     }
                 }
             }
             break;
         case 'SaveSelectedShippingModulesListHref':
             ////                $request = new Request();
             ////                $request->setView  ('CheckoutShippingModulesList');
             $value = $application->getPagenameByViewname("StoreSettingsPage", -1, -1, 'AdminZone');
             //////: should set action?
             ////                $request->setAction('SaveSelectedShippingModulesList');
             ////                $value = modApiFunc('application', 'href', $request);
             break;
         case 'HiddenFieldAction':
             loadCoreFile('html_form.php');
             $HtmlForm = new HtmlForm();
             $value = $HtmlForm->genHiddenField('asc_action', 'SaveSelectedShippingModulesList');
             break;
         case 'HiddenArrayViewState':
             break;
         case 'getShippingModuleInfoItemsJS':
             $value = "";
             $modules = $this->getInstalledModulesListData();
             foreach ($modules as $module) {
                 $name = _ml_strtolower($module->name);
                 $pmInfo = modApiFunc($name, "getInfo");
                 $Shipping_group = modApiFunc("Checkout", "getShippingModuleGroup", $module);
                 if ($Shipping_group != '') {
                     $ShippingModulesGroupsInfo = modApiFunc("Checkout", "getShippingModulesGroupsInfo");
                     $value .= "case '" . $pmInfo['GlobalUniqueShippingModuleID'] . "': switch(key){case 'ShippingModulesGroupID': value = '" . $Shipping_group . "'; break; case 'ShortName': value ='" . $pmInfo["Name"] . "'; break; case 'FullName': value ='" . $pmInfo["Name"] . "'; break;}; break;";
                     //e.g. ShippingModulesGroupID = OnlineCC
                     //     ShortName             = Paypal
                     //     FullName              = [Online CC]Paypal
                     //Notice whitespace in "[Online CC]"
                 }
             }
             break;
         case 'getShippingModuleGroupsItemsJS':
             $value = "";
             $ShippingModulesGroupsInfo = modApiFunc("Checkout", "getShippingModulesGroupsInfo");
             $bFirstItem = true;
             foreach ($ShippingModulesGroupsInfo as $ShippingModulesGroupInfo) {
                 if ($bFirstItem) {
                     $value .= "'" . $ShippingModulesGroupInfo['group_id'] . "'";
                     $bFirstItem = false;
                 } else {
                     $value .= ", '" . $ShippingModulesGroupInfo['group_id'] . "'";
                 }
             }
             break;
         case 'ShippingModulesLink':
             $request = new Request();
             $request->setView(CURRENT_REQUEST_URL);
             $value = $request->getURL();
             break;
         case 'ResultMessageRow':
             $value = $this->outputResultMessage();
             break;
         case 'ResultMessage':
             $value = $this->_Template_Contents['ResultMessage'];
             break;
         default:
             $value = "";
             $pos = _ml_strpos($tag, "_");
             if ($pos != FALSE) {
                 $prefix = _ml_substr($tag, 0, $pos);
                 switch ($prefix) {
                     case "ShippingModuleCheckGroupList":
                         //Options for "Offline" "Online CC" "Online eCheck" and "Online Shipping" <select> control.
                         $SelectedModules = modApiFunc("Checkout", "getSelectedModules", "shipping");
                         $group_name = _ml_substr($tag, _ml_strlen($prefix) + 1);
                         $modules = $this->getInstalledModulesListData(array($group_name));
                         $free_shipping_sm_guid = modApiFunc('Shipping_Module_Free_Shipping', 'getUID');
                         foreach ($modules as $module) {
                             $name = _ml_strtolower($module->name);
                             $pmInfo = modApiFunc($name, "getInfo");
                             if ($pmInfo['GlobalUniqueShippingModuleID'] == $free_shipping_sm_guid) {
                                 continue;
                             }
                             $value .= "<ul id='isSelect' class='list-inline'><li style='list-style-type: none;'>";
                             if (array_key_exists($pmInfo['GlobalUniqueShippingModuleID'], $SelectedModules)) {
                                 $value .= "<label id='module-name'><input type='checkbox' class='checkbox-inline' name='sel_shipping' value='" . $pmInfo['GlobalUniqueShippingModuleID'] . "' id='chk_" . $pmInfo['GlobalUniqueShippingModuleID'] . "' style='margin: 0px 0px 2px;' checked>" . prepareHTMLDisplay($pmInfo["Name"]) . "</label></li></ul>";
                             } else {
                                 $value .= "<label id='module-name'><input type='checkbox' class='checkbox-inline' name='sel_shipping' value='" . $pmInfo['GlobalUniqueShippingModuleID'] . "' id='chk_" . $pmInfo['GlobalUniqueShippingModuleID'] . "' style='margin: 0px 0px 2px;'>" . prepareHTMLDisplay($pmInfo["Name"]) . "</label></li></ul>";
                             }
                         }
                         break;
                     case "ShippingModuleGroupList":
                         //Options for "Offline" "Online CC" "Online eCheck" and "Online Shipping" <select> control.
                         $SelectedModules = modApiFunc("Checkout", "getSelectedModules", "shipping");
                         $group_name = _ml_substr($tag, _ml_strlen($prefix) + 1);
                         $modules = $this->getInstalledModulesListData(array($group_name));
                         $free_shipping_sm_guid = modApiFunc('Shipping_Module_Free_Shipping', 'getUID');
                         foreach ($modules as $module) {
                             $name = _ml_strtolower($module->name);
                             $pmInfo = modApiFunc($name, "getInfo");
                             if ($pmInfo['GlobalUniqueShippingModuleID'] == $free_shipping_sm_guid) {
                                 continue;
                             }
                             if (!array_key_exists($pmInfo['GlobalUniqueShippingModuleID'], $SelectedModules)) {
                                 $value .= "<option value=\"" . $pmInfo['GlobalUniqueShippingModuleID'] . "\">" . prepareHTMLDisplay($pmInfo["Name"]) . "</option>";
                             }
                         }
                         break;
                     case "HiddenAvailable":
                         break;
                     default:
                         ////// can it be Current Module (Modules List Item) details?
                         ////_fatal(__CLASS__ .'::'. __FUNCTION__. ': prefix = ' . $prefix);
                         break;
                 }
             } else {
                 //Current Module (Modules List Item) details
                 $value = getKeyIgnoreCase($tag, $this->_Current_Module);
             }
             break;
     }
     return $value;
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'LatestCoreVersion':
             $value = modApiFunc('Extension_Manager', 'getLatestCoreVer');
             break;
         case 'Local_ErrorMessage':
             $value = $this->getLocal_ErrorMessage();
             break;
         case 'Local_CoreUpgradeAction':
             $value = 'index.php?asc_action=GetCoreUpgradeFile';
             break;
         case 'Local_StoreStatus':
             $value = "javascript:openURLinNewWindow('store_settings_general.php', 'General Settings');";
             break;
             /*case 'Local_StoreOnline':
             			$value = 'index.php?asc_action=UpdateGeneralSettings&store_online=1';
             			break;
             		case 'Local_SuccessMessage':
             			$value = $this->getLocal_SuccessMessage();
             			break;*/
         /*case 'Local_StoreOnline':
         			$value = 'index.php?asc_action=UpdateGeneralSettings&store_online=1';
         			break;
         		case 'Local_SuccessMessage':
         			$value = $this->getLocal_SuccessMessage();
         			break;*/
         default:
             $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
             break;
     }
     return $value;
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     $curr_id = modApiFunc("Localization", "getMainStoreCurrency");
     switch ($tag) {
         case 'Local_Items':
             $value = $this->outputCartContent();
             break;
         case 'Local_ProductOptionsSelected':
             $value = getOptionsCombination($this->_Cart_Item['Options'], 'Order', $this->order_mode_enabled);
             break;
         case 'Local_Subtotal':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "Subtotal", $curr_id));
             break;
         case 'Local_GlobalDiscount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "SubtotalGlobalDiscount", $curr_id));
             break;
         case 'Local_PromoCodeDiscount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "SubtotalPromoCodeDiscount", $curr_id));
             break;
         case 'Local_QuantityDiscount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "QuantityDiscount", $curr_id));
             break;
         case 'Local_ShippingCost':
         case 'Local_TotalShippingAndHandlingCost':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalShippingAndHandlingCost", $curr_id));
             break;
         case 'Local_FreeHandlingForOrdersOver':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "FreeHandlingForOrdersOver", $curr_id));
             break;
         case 'Local_PerItemShippingCostSum':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerItemShippingCostSum", $curr_id));
             break;
         case 'Local_ShippingMethodCost':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "ShippingMethodCost", $curr_id));
             break;
         case 'Local_FreeShippingForOrdersOver':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "FreeShippingForOrdersOver", $curr_id));
             break;
         case 'Local_MinimumShippingCost':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "MinimumShippingCost", $curr_id));
             break;
         case 'Local_PerOrderShippingFee':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerOrderShippingFee", $curr_id));
             break;
         case 'Local_TotalShippingCharge':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalShippingCharge", $curr_id));
             break;
         case 'Local_ShippingMethodName':
             $shipping_module_id = modApiFunc("Checkout", "getChosenShippingModuleIdCZ");
             if ($shipping_module_id === NULL) {
                 //                               ,
                 return '---';
             }
             $shipping_method_id = modApiFunc("Checkout", "getChosenShippingMethodIdCZ");
             $shipping_module_info = modApiFunc("Checkout", "getShippingModuleInfo", $shipping_module_id);
             if ($shipping_module_info["GlobalUniqueShippingModuleID"] == "6F82BA03-C5B1-585B-CE2E-B8422A1A19F6") {
                 $mRes =& $application->getInstance('MessageResources', "messages");
                 $value = $mRes->getMessage('ALL_SM_ARE_INACTIVE');
                 unset($mRes);
             } else {
                 $ShippingMethodInfo = modApiFunc("Shipping_Cost_Calculator", "getCalculatedMethod", $shipping_module_info["APIClassName"], $shipping_method_id);
                 $value = $ShippingMethodInfo['method_name'];
             }
             break;
         case 'Local_PerItemHandlingCostSum':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerItemHandlingCostSum", $curr_id));
             break;
         case 'Local_PerOrderHandlingFee':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerOrderHandlingFee", $curr_id));
             break;
         case 'Local_TotalHandlingCharge':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalHandlingCharge", $curr_id));
             break;
         case 'Local_Taxes':
             $value = $this->outputTax();
             break;
         case 'Local_Total':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "Total", $curr_id));
             break;
         case 'Local_GiftCertificatePrepaidAmount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalPrepaidByGC", $curr_id));
             break;
         case 'Local_TotalToPay':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalToPay", $curr_id));
             break;
         case 'Local_SwatchColorSelected':
             $colname = $this->_Cart_Item['Colorname'];
             $value = "";
             if (!($colname == "")) {
                 $value = "<div style='clear:both;float:left; padding-left: 10px;'>Chosen colors : </div><div style='font-weight:normal;float: left;'>&nbsp;{$colname}</div>";
             }
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'product' || $entity == 'unknown') {
                 //                        "                             Subtotal",
                 //                                                    .
                 if (getKeyIgnoreCase($tag, $this->_Cart_Item)) {
                     $value = getKeyIgnoreCase($tag, $this->_Cart_Item);
                 } else {
                     $value = isset($this->_Tax_Item) ? getKeyIgnoreCase($tag, $this->_Tax_Item) : null;
                     if ($value == null && $entity == 'product') {
                         $po = new CProductInfo($this->_Cart_Item['ID']);
                         if ($tag == "infolink" && $this->_Cart_Item['TypeID'] == GC_PRODUCT_TYPE_ID) {
                             $request = new Request();
                             $request->setView("GiftCertificate");
                             return $request->getURL();
                         }
                         $value = $po->getProductTagValue($tag);
                     }
                 }
             }
             break;
     }
     return $value;
 }
 /**
  * @                      AddManufacturer->getTag.
  */
 function getTag($tag)
 {
     global $application;
     $value = getKeyIgnoreCase($tag, $this->_Template_Contents);
     if ($value == null) {
         switch ($tag) {
             case 'ErrorIndex':
                 $value = $this->_error_index;
                 break;
             case 'Error':
                 $value = $this->_error;
                 break;
         }
     }
     return $value;
 }
 function getTag($tag)
 {
     if ($tag == 'ProductInfoLink') {
         $cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list();
         LayoutConfigurationManager::static_activate_cz_layout(array_shift(array_keys($cz_layouts)));
         $request = new CZRequest();
         $request->setView('ProductInfo');
         $request->setAction('SetCurrentProduct');
         $request->setKey('prod_id', $this->product_id);
         $request->setProductID($this->product_id);
         return $request->getURL();
     }
     return getKeyIgnoreCase($tag, $this->_Template_Contents);
 }
 /**
  * Processes local tags
  */
 function getTag($tag)
 {
     if ($tag == 'PaginatorLine') {
         return $this->outputPaginatorLine();
     }
     if ($tag == 'PaginatorRows') {
         return $this->outputPaginatorRows();
     }
     return getKeyIgnoreCase($tag, $this->_Template_Contents);
 }
 function getTag($tag)
 {
     switch ($tag) {
         case 'MessageBox':
             return $this->getMessageBox();
         case 'Messages':
             return $this->__msg;
         case 'Errors':
             return $this->__msg;
     }
     return getKeyIgnoreCase($tag, $this->_Template_Contents);
 }
 /**
  * @ 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;
 }
Beispiel #30
0
 function includeViewFileOnce($viewName)
 {
     global $zone;
     if ($zone == 'CustomerZone') {
         if (isset($this->czViewList[$viewName])) {
             $this->includeFile($this->czViewList[$viewName]);
         }
     } else {
         if (getKeyIgnoreCase($viewName, $this->azViewList) !== null) {
             $this->includeFile(getKeyIgnoreCase($viewName, $this->azViewList));
         }
     }
 }