if (is_array($value)) {
             $match = $_GET['match' . $e['id']];
             $where_str .= " and (";
             $first = true;
             foreach ($value as $vid) {
                 if ($first) {
                     $first = false;
                 } else {
                     $where_str .= $match == 'all' ? ' and ' : ' or ';
                 }
                 $where_str .= "(pd." . $e['field'] . " like '%|" . (int) $vid . "|%')";
             }
             $where_str .= ")";
         }
     } else {
         $where_str .= " and (pd." . $e['field'] . " in (" . (int) $value . tep_list_epf_children($value) . "))";
     }
 } else {
     unset($epf_value_keywords);
     // erase any keywords from previous field
     tep_parse_search_string($value, $epf_value_keywords);
     if ($value != '' && isset($epf_value_keywords) && sizeof($epf_value_keywords) > 0) {
         $where_str .= " and (";
         for ($i = 0, $n = sizeof($epf_value_keywords); $i < $n; $i++) {
             switch ($epf_value_keywords[$i]) {
                 case '(':
                 case ')':
                 case 'and':
                 case 'or':
                     $where_str .= " " . $epf_value_keywords[$i] . " ";
                     break;
Exemplo n.º 2
0
function tep_list_epf_children($parent_id)
{
    $sql = tep_db_query("select value_id from " . TABLE_EPF_VALUES . " where parent_id = " . (int) $parent_id);
    $list = '';
    while ($i = tep_db_fetch_array($sql)) {
        $list .= ',' . $i['value_id'] . tep_list_epf_children($i['value_id']);
    }
    return $list;
}
Exemplo n.º 3
0
function get_children($value_id)
{
    return explode(',', $value_id . tep_list_epf_children($value_id));
}
Exemplo n.º 4
0
         }
         // 9 end else { // either retail...
         // EOF Separate Pricing per Customer
     }
     // 7
 }
 // 1
 // BOF SPPC Hide products and categories from groups
 $listing_sql .= " and find_in_set('" . $customer_group_id . "', p.products_hide_from_groups) = 0 ";
 // EOF SPPC Hide products and categories from groups
 // BOF: extra product fields
 $restrict_by = '';
 foreach ($epf as $e) {
     if ($e['restrict']) {
         if (isset($_GET[$e['field']]) && is_numeric($_GET[$e['field']])) {
             $restrict_by .= ' and (pd.' . $e['field'] . ' in (' . (int) $_GET[$e['field']] . tep_list_epf_children($_GET[$e['field']]) . '))';
         }
     }
 }
 $listing_sql .= $restrict_by;
 // EOF: extra product fields
 // Add new products limit and order
 if (isset($_GET['new_products']) && tep_not_null($_GET['new_products'])) {
     $new_products_sort = "products_date_added desc, ";
 } else {
     $new_products_sort = "";
 }
 if (!isset($_GET['sort']) || !preg_match('/^[0-8][ad]$/', $_GET['sort']) || substr($_GET['sort'], 0, 1) > sizeof($column_list)) {
     for ($i = 0, $n = sizeof($column_list); $i < $n; $i++) {
         if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
             $_GET['sort'] = $i . 'a';
Exemplo n.º 5
0
 if ($field_info['epf_has_linked_field'] && $field_info['epf_multi_select']) {
     $vallist = array();
     foreach ($query as $val) {
         $vallist[$val['value_depends_on']][] = $val['value_id'];
     }
     $query = tep_db_query('select epf_label from ' . TABLE_EPF_LABELS . ' where epf_id = ' . $field_info['epf_links_to'] . ' and languages_id = ' . (int) $lid);
     $value = tep_db_fetch_array($query);
     $label = $field_info['epf_links_to'] . ' ' . $value['epf_label'];
     $link_query = tep_db_query("select epf_value_display_type from " . TABLE_EPF . " where epf_id = " . (int) $field_info['epf_links_to']);
     $linked_field_info = tep_db_fetch_array($link_query);
     foreach ($vallist as $required => $values) {
         if ($required == 0) {
             echo TEXT_ALWAYS_AVAILABLE . $label;
         } else {
             echo sprintf(TEXT_AVAILABLE_REQUIRED, $label);
             $check = explode(',', (string) $required . tep_list_epf_children($required));
             $reqlist = array();
             foreach ($check as $val) {
                 $reqlist[] = tep_get_extra_field_list_value($val, false, $linked_field_info['epf_value_display_type']);
             }
             echo implode(', ', $reqlist);
         }
         $col = 0;
         echo '<table><tr>';
         foreach ($values as $val) {
             $col++;
             if ($col > $field_info['epf_num_columns']) {
                 echo '</tr><tr>';
                 $col = 1;
             }
             echo '<td>' . tep_draw_checkbox_field('example', $val['value_id']) . '</td><td>' . tep_get_extra_field_list_value($val, false, $field_info['epf_value_display_type']) . '</td><td>&nbsp;</td>';