I am currently creating some product tables and this module seems like the way to do it. I have installed dev and nearly got what I am after.

The only problem is, multiple nodes are showing in 1 cell. I would like to sort those result by cheapest and only show 1 node per cell.

Is it possible to add in a node limit per cell feature, which will limit to the number it will show?

Thanks a lot.
Tony

Comments

mradcliffe’s picture

It's showing multiple results in a cell because two results match the same criteria (have the same header and row column values).

This is a viable feature request, but just want to make sure you could probably do it without limiting the results per cell if there were no overlapping values.

TonyxTony’s picture

I have tried to limit the result by using aggregation and adding in extra filter. However due to the fact that there are multiple products in the db with the same filter criteria but with different pricing. I could not single out the lowest price. Im sorting by price and that works in terms of the order of pricing within the cell. However still showing multiple nodes.

Thanks

TonyxTony’s picture

I managed to work it out for what I need. However I dont know if it will cause any problems in the future:

Line 147 includes/fcl_views_matrix.theme.inc

foreach ($result as $index => $item) {
    // Go through each view row and repack the item after markup.
    $rendered_item = '';

    // Get the coordinates out of the array.
    $x_coordinate = $coordinates[$index]['x'];
    $y_coordinate = $coordinates[$index]['y'];

    // Limit to 1 node per cell.
    if (empty($vars['rows'][$y_coordinate][$x_coordinate]['data'])) {

      foreach (element_children($fields) as $field_name) {
        // Create the markup for the field.
        $field_handler = &$fields[$field_name];
        $alias = $field_handler->field_alias;

        if ($field_handler->options['exclude']) {
          // Don't render the field.
          continue;
        }

        // Field wrapper
        $wrapper_type = $field_handler->element_wrapper_type();
        $field_output = '<' . $wrapper_type;
        if ($field_handler->options['element_default_classes']) {
          $wrapper_classes = 'views-field views-field-' . $field_name;
        }
        $wrapper_classes .= $field_handler->element_wrapper_classes();
        $field_output .= (!empty($wrapper_classes)) ? ' class="' . $wrapper_classes . '">' : '>';

        if ($label = $field_handler->label()) {
          // Field label
          $label_type = $field_handler->element_label_type();
          $field_output .= '<' . $label_type;
          $label_classes = $field_handler->element_label_classes();
          $field_output .= (!empty($label_clases)) ? ' class="' . $label_classes . '">' : '>';
          $field_output .= '</' . $label_type . '>';
        }

        // Field
        $field_type = $field_handler->element_type();
        $field_output .= '<' . $field_type;
        $field_classes = $field_handler->element_classes();
        $field_output .= (!empty($field_classes)) ? ' class="' . $field_classes . '">' : '>';
        $field_output .= $renders[$index][$field_name];
        $field_output .= '</' . $field_type . '>';

        $field_output .= '</' . $wrapper_type . '>';
        $rendered_item .= $field_output;
      }
    }    

    // The row number is y, the column number is x.
    $vars['rows'][$y_coordinate][$x_coordinate]['data'] .= $rendered_item;

    // Remove class fcl-views-matrix-empty
    $vars['rows'][$y_coordinate][$x_coordinate]['attributes']['class'] = array_diff($vars['rows'][$y_coordinate][$x_coordinate]['attributes']['class'], array('fcl-views-matrix-empty'));
  }