0

I have a view with Infinite Scroll Pager giving me the latest products of the website.

Every taxonomy term has an image attatched on it.

I want to display taxonomy terms every 3 rows of products.

4
  • What version of drupal do you use? – Alireza Tabatabaeian Sep 30 '16 at 9:05
  • @AlirezaTabatabaeian thanks for commenting. I am on 7. – Konstantinos Koletsas Sep 30 '16 at 9:11
  • and do you have coding skills? I think you will need to write some code to achieve functionality you desire – Alireza Tabatabaeian Sep 30 '16 at 9:14
  • yes, I might need to alter the views but that's no problem for me – Konstantinos Koletsas Sep 30 '16 at 9:15
0

I think you must alter the view.

  1. Create the views normally, add taxo to every rows.

  2. Use the Hook hook_views_pre_render(&$view)

  3. Delete the term for every rows except 1/3.

For example something like this:

function MYMODULE_views_pre_render(&$view) {
  if ($view->name == 'view_myviewname') {
    $result = $view->result;
    $count = 0;
    foreach ($result as $i => $row) {
      if(!$count % 3){
        unset($view->result[$i]->field_MYTEXONOMYFIELD[0]);
      }
      $count++;
    }
  }
}

Example from : http://www.drupal8.ovh/en/tutoriels/238/alter-a-view-edit-view-result-programmatically

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.